From ddc5135b727543a8f691cb4e0c092d5ca26ca3b6 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Sat, 2 Nov 2019 14:22:16 +0100 Subject: [PATCH] Use lightweight derivation --- snack-lib/build.nix | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/snack-lib/build.nix b/snack-lib/build.nix index 14c0db3..df3ac7f 100644 --- a/snack-lib/build.nix +++ b/snack-lib/build.nix @@ -4,6 +4,9 @@ , stdenv , rsync , symlinkJoin +, writeScript +, bash +, coreutils }: with (callPackage ./modules.nix {}); @@ -114,23 +117,24 @@ rec { modSpec.moduleFiles ) >= 1 ) base; - in stdenv.mkDerivation - { name = objectName; src = symlinkJoin { name = "extra-files"; paths = [ extraFiles ] ++ modSpec.moduleDirectories; }; - phases = - [ "unpackPhase" "buildPhase" ]; - + in builtins.derivation + { name = objectName; + system = stdenv.system; imports = map (mmm: mmm.moduleName) modSpec.moduleImports; - buildPhase = + PATH = lib.makeBinPath [ coreutils rsync ghc ]; + builder = writeScript "${objectName}-builder" '' + #!${bash}/bin/bash echo "Building module ${modSpec.moduleName}" echo "Local imports are:" for foo in $imports; do echo " - $foo" done + cp -r ${src}/. ./ mkdir -p $out echo "Creating dependencies symtree for module ${modSpec.moduleName}" @@ -144,14 +148,7 @@ rec { -outputdir $out \ ${ghcOptsArgs} \ 2>&1 - - ls $out echo "Done building module ${modSpec.moduleName}" ''; - - buildInputs = - [ ghc - rsync - ]; }; }