1
1
mirror of https://github.com/nmattia/snack.git synced 2024-11-28 03:45:45 +03:00

Use lightweight derivation

This commit is contained in:
Nicolas Mattia 2019-11-02 14:22:16 +01:00
parent 3f93f9d0f4
commit ddc5135b72

View File

@ -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
];
};
}