Files
org-parser/nix/lib/nimBuildGenerator.nix
Florian Schroedl 300b165da9 Init
2022-01-24 15:50:06 +01:00

31 lines
571 B
Nix

let
inherit (builtins) foldl';
in
rec {
makeNimBuildScript =
{ srcFile
, dstName
, packages ? [ ]
, extraLines ? [ ]
}:
let
packageLines = map (a: "-p:${a}/src") packages;
lines = [
"nim compile"
"-d:release"
"--hint[Processing]:off"
"--excessiveStackTrace:on"
] ++ packageLines
++ extraLines
++ [
"--out:$TMPDIR/${dstName}"
srcFile
];
buildCommand = foldl' (a: b: a + " " + b) "" lines;
in
''
HOME=$TMPDIR
${buildCommand}
'';
}