mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Move call-flake.nix to nix-flake
As suggested by Ericson2314 in review https://github.com/NixOS/nix/pull/12759#issuecomment-2755352343
This commit is contained in:
parent
6fc9651d57
commit
0c75581d8b
7 changed files with 34 additions and 10 deletions
|
@ -288,10 +288,6 @@ EvalState::EvalState(
|
|||
CanonPath("derivation-internal.nix"),
|
||||
#include "primops/derivation.nix.gen.hh"
|
||||
)}
|
||||
, callFlakeInternal{internalFS->addFile(
|
||||
CanonPath("call-flake.nix"),
|
||||
#include "call-flake.nix.gen.hh"
|
||||
)}
|
||||
, store(store)
|
||||
, buildStore(buildStore ? buildStore : store)
|
||||
, debugRepl(nullptr)
|
||||
|
|
|
@ -274,14 +274,12 @@ public:
|
|||
|
||||
/**
|
||||
* In-memory filesystem for internal, non-user-callable Nix
|
||||
* expressions like call-flake.nix.
|
||||
* expressions like `derivation.nix`.
|
||||
*/
|
||||
const ref<MemorySourceAccessor> internalFS;
|
||||
|
||||
const SourcePath derivationInternal;
|
||||
|
||||
const SourcePath callFlakeInternal;
|
||||
|
||||
/**
|
||||
* Store used to materialise .drv files.
|
||||
*/
|
||||
|
|
|
@ -126,7 +126,6 @@ generated_headers = []
|
|||
foreach header : [
|
||||
'imported-drv-to-derivation.nix',
|
||||
'fetchurl.nix',
|
||||
'call-flake.nix',
|
||||
]
|
||||
generated_headers += gen_header.process(header)
|
||||
endforeach
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "memory-source-accessor.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
using namespace flake;
|
||||
|
@ -921,6 +923,25 @@ LockedFlake lockFlake(
|
|||
}
|
||||
}
|
||||
|
||||
static ref<SourceAccessor> makeInternalFS() {
|
||||
auto internalFS = make_ref<MemorySourceAccessor>(MemorySourceAccessor {});
|
||||
internalFS->setPathDisplay("«flakes-internal»", "");
|
||||
internalFS->addFile(
|
||||
CanonPath("call-flake.nix"),
|
||||
#include "call-flake.nix.gen.hh"
|
||||
);
|
||||
return internalFS;
|
||||
}
|
||||
|
||||
static auto internalFS = makeInternalFS();
|
||||
|
||||
static Value * requireInternalFile(EvalState & state, CanonPath path) {
|
||||
SourcePath p {internalFS, path};
|
||||
auto v = state.allocValue();
|
||||
state.evalFile(p, *v); // has caching
|
||||
return v;
|
||||
}
|
||||
|
||||
void callFlake(EvalState & state,
|
||||
const LockedFlake & lockedFlake,
|
||||
Value & vRes)
|
||||
|
@ -960,8 +981,7 @@ void callFlake(EvalState & state,
|
|||
|
||||
auto & vOverrides = state.allocValue()->mkAttrs(overrides);
|
||||
|
||||
auto vCallFlake = state.allocValue();
|
||||
state.evalFile(state.callFlakeInternal, *vCallFlake);
|
||||
Value * vCallFlake = requireInternalFile(state, CanonPath("call-flake.nix"));
|
||||
|
||||
auto vLocks = state.allocValue();
|
||||
vLocks->mkString(lockFileStr);
|
||||
|
|
|
@ -39,6 +39,15 @@ add_project_arguments(
|
|||
|
||||
subdir('nix-meson-build-support/common')
|
||||
|
||||
subdir('nix-meson-build-support/generate-header')
|
||||
|
||||
generated_headers = []
|
||||
foreach header : [
|
||||
'call-flake.nix',
|
||||
]
|
||||
generated_headers += gen_header.process(header)
|
||||
endforeach
|
||||
|
||||
sources = files(
|
||||
'flake/config.cc',
|
||||
'flake/flake.cc',
|
||||
|
@ -62,6 +71,7 @@ headers = files(
|
|||
this_library = library(
|
||||
'nixflake',
|
||||
sources,
|
||||
generated_headers,
|
||||
dependencies : deps_public + deps_private + deps_other,
|
||||
prelink : true, # For C++ static initializers
|
||||
install : true,
|
||||
|
|
|
@ -28,6 +28,7 @@ mkMesonLibrary (finalAttrs: {
|
|||
../../.version
|
||||
./.version
|
||||
./meson.build
|
||||
./call-flake.nix
|
||||
(fileset.fileFilter (file: file.hasExt "cc") ./.)
|
||||
(fileset.fileFilter (file: file.hasExt "hh") ./.)
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue