diff options
author | Artemis Tosini <lix@artem.ist> | 2024-05-19 22:25:30 +0000 |
---|---|---|
committer | Artemis Tosini <me@artem.ist> | 2024-07-03 22:16:03 +0000 |
commit | af1dcc2d5e5f9f1bc01e12face96259cf4183629 (patch) | |
tree | 7a61f880dc89afba1c8db4aec8169d46595325bc /src/libstore/build/local-derivation-goal.hh | |
parent | 5eec6418de35daaa7b14b5412e39d85ce80a37cb (diff) |
libstore: Add LocalDerivationGoal prepareSandbox hook
Add a new OS-specific hook called `prepareSandbox`, run before forking
On Darwin this is empty as nothing is required,
on Linux this creates the chroot directory and adds basic files,
and on platforms using a fallback this throws an exception
Change-Id: Ie30c38c387f2e0e5844b2afa32fd4d33b1180dae
Diffstat (limited to 'src/libstore/build/local-derivation-goal.hh')
-rw-r--r-- | src/libstore/build/local-derivation-goal.hh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libstore/build/local-derivation-goal.hh b/src/libstore/build/local-derivation-goal.hh index 91329ca35..857339b5d 100644 --- a/src/libstore/build/local-derivation-goal.hh +++ b/src/libstore/build/local-derivation-goal.hh @@ -325,11 +325,28 @@ protected: using DerivationGoal::DerivationGoal; /** + * Setup dependencies outside the sandbox. + * Called in the parent nix process. + */ + virtual void prepareSandbox() + { + throw Error("sandboxing builds is not supported on this platform"); + }; + + /** * Execute the builder, replacing the current process. * Generally this means an `execve` call. */ virtual void execBuilder(std::string builder, Strings args, Strings envStrs); + /** + * Whether derivation can be built on current platform with `uid-range` feature + */ + virtual bool supportsUidRange() + { + return false; + } + }; } |