From b01c8fd51d8d1c71c50f811806e66872a65439d6 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 9 Apr 2020 16:19:38 +0530 Subject: [PATCH] Create lib.runDhallCommand An optimization for using the Dhall library. --- lib/default.nix | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index 6b7cc62..8a6a318 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -9,34 +9,26 @@ let in rec { - linuxScript = name: env: bootDhall: - buildPackages.runCommand name ({ - inherit name; - buildInputs = [ buildPackages.dhall ]; - DHALL_GENODE = "${testPkgs.dhallGenode}/binary.dhall"; - } // env) '' + runDhallCommand = name: env: script: + nixpkgs.runCommand name + ({ nativeBuildInputs = [ buildPackages.dhall ]; } // env) '' export XDG_CACHE_HOME=$NIX_BUILD_TOP - + export DHALL_GENODE="${testPkgs.dhallGenode}/binary.dhall"; ${buildPackages.xorg.lndir}/bin/lndir -silent \ ${testPkgs.dhallGenode}/.cache \ $XDG_CACHE_HOME + ${script} + ''; + + linuxScript = name: env: bootDhall: + runDhallCommand name env '' dhall to-directory-tree --output $out \ <<< "${./linux-script.dhall} (${bootDhall}) \"$out\"" ''; compileBoot = name: env: bootDhall: - buildPackages.runCommand name ({ - inherit name; - buildInputs = [ buildPackages.dhall ]; - DHALL_GENODE = "${testPkgs.dhallGenode}/binary.dhall"; - } // env) '' - export XDG_CACHE_HOME=$NIX_BUILD_TOP - - ${buildPackages.xorg.lndir}/bin/lndir -silent \ - ${testPkgs.dhallGenode}/.cache \ - $XDG_CACHE_HOME - + runDhallCommand name env '' dhall to-directory-tree --output $out \ <<< "${./compile-boot.dhall} (${bootDhall}) \"$out\"" '';