From 50555e7db53de3bfe7ecd9bc3fb8047a5bfaeef3 Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Sun, 1 Nov 2020 13:41:38 +0100 Subject: [PATCH] chore: Nix: make `buildMod` `nix develop`-friendly --- new.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/new.nix b/new.nix index c044362bb4..443dfcb84b 100644 --- a/new.nix +++ b/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;