chore: Nix: make buildMod nix develop-friendly
This commit is contained in:
parent
df99a6a469
commit
50555e7db5
1 changed files with 3 additions and 2 deletions
5
new.nix
5
new.nix
|
|
@ -3,6 +3,7 @@ with builtins; rec {
|
|||
# "Init.Core" ~> "Init/Core.lean"
|
||||
modToLean = mod: replaceStrings ["."] ["/"] mod + ".lean";
|
||||
mkDerivation = args@{ buildCommand, ... }: derivation (args // {
|
||||
inherit stdenv;
|
||||
inherit (stdenv) system;
|
||||
builder = stdenv.shell;
|
||||
args = [ "-c" ''
|
||||
|
|
@ -48,14 +49,14 @@ ${lean}/bin/lean --deps $src | ${gnused}/bin/sed "s!$LEAN_PATH/!!;s!/!.!g;s!.ole
|
|||
buildMod = mod: deps: let relpath = modToLean mod; in mkDerivation {
|
||||
name = "${mod}";
|
||||
LEAN_PATH = depRoot mod deps;
|
||||
inherit relpath;
|
||||
inherit lean relpath;
|
||||
outputs = [ "out" "c" ];
|
||||
src = src + ("/" + relpath);
|
||||
buildCommand = ''
|
||||
export PATH=${coreutils}/bin
|
||||
mkdir -p $(dirname $relpath) $out/$(dirname $relpath) $c
|
||||
cp $src $relpath
|
||||
${lean}/bin/lean -o $out/''${relpath%.lean}.olean -c $c/out.c $relpath
|
||||
$lean/bin/lean -o $out/''${relpath%.lean}.olean -c $c/out.c $relpath
|
||||
'';
|
||||
} // {
|
||||
inherit deps;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue