Rename helpers -> combinators
This commit is contained in:
parent
162e22d7ca
commit
dd40b566ac
4 changed files with 8 additions and 8 deletions
|
|
@ -19,10 +19,10 @@ A helper to make it easy and ergonomic to wrap your derivations in
|
|||
ls -la $HOME
|
||||
'';
|
||||
in {
|
||||
packages.x86_64-linux.jailed = jail "my-jail" untrusted-package (h: with h; [
|
||||
packages.x86_64-linux.jailed = jail "my-jail" untrusted-package (combinators: with combinators; [
|
||||
# By default, only the bare minimum permissions are exposed, in this list
|
||||
# you can add additional permissions that you want the program to have.
|
||||
# See ./helpers.nix for more functions that can go here
|
||||
# See ./combinators.nix for more functions that can go here
|
||||
|
||||
# Give program access to the network
|
||||
network
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
inherit pkgs name exe getOpts;
|
||||
};
|
||||
|
||||
extend = { pkgs, additionalHelpers }: name: exe: getOpts: runJail {
|
||||
extend = { pkgs, additionalCombinators }: name: exe: getOpts: runJail {
|
||||
inherit pkgs name exe;
|
||||
getOpts = helpers: getOpts (helpers // additionalHelpers helpers);
|
||||
getOpts = combinators: getOpts (combinators // additionalCombinators combinators);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
8
lib.nix
8
lib.nix
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
exe-str = if builtins.typeOf exe == "string" then lib.escapeShellArg exe else lib.getExe exe;
|
||||
|
||||
jail-helpers = import ./helpers.nix pkgs;
|
||||
combinators = import ./combinators.nix pkgs;
|
||||
|
||||
initial-state = lib.pipe {
|
||||
cmd = "${lib.getExe pkgs.bubblewrap}";
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
new-session = true;
|
||||
hostname = "jail";
|
||||
env = {};
|
||||
} (with jail-helpers; [
|
||||
} (with combinators; [
|
||||
(unsafe-add-raw-args "--proc /proc")
|
||||
(unsafe-add-raw-args "--dev /dev")
|
||||
(unsafe-add-raw-args "--tmpfs /tmp")
|
||||
|
|
@ -35,13 +35,13 @@
|
|||
'')
|
||||
(unsafe-add-raw-args "--ro-bind ~/.local/share/jails/passwd /etc/passwd")
|
||||
]);
|
||||
in lib.pipe jail-helpers [
|
||||
in lib.pipe combinators [
|
||||
# collect opts
|
||||
getOpts
|
||||
(lib.foldl (acc: el: el acc) initial-state)
|
||||
|
||||
# finalize state
|
||||
(with jail-helpers; compose [
|
||||
(with combinators; compose [
|
||||
(s: set-env "PATH" s.path s)
|
||||
(s: if s.new-session then unsafe-add-raw-args "--new-session" s else s)
|
||||
(s: lib.foldr (envVar:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue