From 5ed01579afe46f14ee999b7d2d8be18d6f7d347e Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 2 Aug 2022 17:34:28 -0400 Subject: Make bild dev build work again Unfortunately, until bild can instantiate nix builds, it needs all of its compilers in the dev environment, and I need to pass this environment into the dev nix-shell in order for it to work in the repl or after being built to _/bin. --- Biz/Bild.nix | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'Biz/Bild.nix') diff --git a/Biz/Bild.nix b/Biz/Bild.nix index abff330..ab120db 100644 --- a/Biz/Bild.nix +++ b/Biz/Bild.nix @@ -38,6 +38,16 @@ rec { # generally-useful things from nixpkgs inherit (nixpkgs) lib stdenv sources; + # remove this when I switch to all-nix builds + bildRuntimeDeps = with nixpkgs; [ + pkg-config + guile_3_0 + private.ghcPackageSetBild + rustc + gcc + (private.sbclWith (p: with p; [asdf alexandria])) # just enough to build Example.lisp + ]; + # a standard nix build for `bild` - this should be the only hand-written # builder we need bild = stdenv.mkDerivation { @@ -45,13 +55,7 @@ rec { src = ../.; nativeBuildInputs = [ private.ghcPackageSetBild ]; buildInputs = [ nixpkgs.makeWrapper ]; - propagatedBuildInputs = with nixpkgs; [ - pkg-config - guile_3_0 - rustc - gcc - (private.sbclWith (p: with p; [asdf alexandria])) # just enough to build Example.lisp - ]; + propagatedBuildInputs = bildRuntimeDeps; strictDeps = true; buildPhase = '' mkdir -p $out/bin $out/lib/ghc-${private.ghcPackageSetFull.version} @@ -124,10 +128,12 @@ rec { installPhase = "exit 0"; } // { env = ghc; }; - env = let linters = with nixpkgs.pkgs; [ ormolu hlint deadnix ]; in nixpkgs.pkgs.mkShell { + env = let + linters = with nixpkgs.pkgs; [ ormolu hlint deadnix ]; + in nixpkgs.pkgs.mkShell { name = "bizdev"; # this should just be dev tools - buildInputs = with nixpkgs.pkgs; linters ++ [ + buildInputs = with nixpkgs.pkgs; linters ++ bildRuntimeDeps ++ [ bild ctags figlet @@ -140,6 +146,9 @@ rec { shellcheck wemux ]; + shellHook = '' + export GHC_PACKAGE_PATH=${bild}/lib/ghc-${private.ghcPackageSetFull.version}/package.conf.d + ''; }; # build an operating system. 'cfg' is the NixOS config -- cgit v1.2.3