mirror of
https://github.com/NixOS/nix
synced 2025-06-26 20:01:15 +02:00
Move some corepkgs into the nix binary
This commit is contained in:
parent
e02481ded2
commit
9950cdec35
8 changed files with 23 additions and 7 deletions
21
src/libexpr/imported-drv-to-derivation.nix
Normal file
21
src/libexpr/imported-drv-to-derivation.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
attrs @ { drvPath, outputs, name, ... }:
|
||||
|
||||
let
|
||||
|
||||
commonAttrs = (builtins.listToAttrs outputsList) //
|
||||
{ all = map (x: x.value) outputsList;
|
||||
inherit drvPath name;
|
||||
type = "derivation";
|
||||
};
|
||||
|
||||
outputToAttrListElement = outputName:
|
||||
{ name = outputName;
|
||||
value = commonAttrs // {
|
||||
outPath = builtins.getAttr outputName attrs;
|
||||
inherit outputName;
|
||||
};
|
||||
};
|
||||
|
||||
outputsList = map outputToAttrListElement outputs;
|
||||
|
||||
in (builtins.head outputsList).value
|
|
@ -31,3 +31,5 @@ clean-files += $(d)/parser-tab.cc $(d)/parser-tab.hh $(d)/lexer-tab.cc $(d)/lexe
|
|||
dist-files += $(d)/parser-tab.cc $(d)/parser-tab.hh $(d)/lexer-tab.cc $(d)/lexer-tab.hh
|
||||
|
||||
$(eval $(call install-file-in, $(d)/nix-expr.pc, $(prefix)/lib/pkgconfig, 0644))
|
||||
|
||||
$(d)/primops.cc: $(d)/imported-drv-to-derivation.nix.gen.hh
|
||||
|
|
|
@ -121,10 +121,17 @@ static void prim_scopedImport(EvalState & state, const Pos & pos, Value * * args
|
|||
mkString(*(outputsVal->listElems()[outputs_index++]), o.first);
|
||||
}
|
||||
w.attrs->sort();
|
||||
Value fun;
|
||||
state.evalFile(settings.nixDataDir + "/nix/corepkgs/imported-drv-to-derivation.nix", fun);
|
||||
state.forceFunction(fun, pos);
|
||||
mkApp(v, fun, w);
|
||||
|
||||
static Value * fun = nullptr;
|
||||
if (!fun) {
|
||||
fun = state.allocValue();
|
||||
state.eval(state.parseExprFromString(
|
||||
#include "imported-drv-to-derivation.nix.gen.hh"
|
||||
, "/"), *fun);
|
||||
}
|
||||
|
||||
state.forceFunction(*fun, pos);
|
||||
mkApp(v, *fun, w);
|
||||
state.forceAttrs(v, pos);
|
||||
} else {
|
||||
state.forceAttrs(*args[0]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue