Refactor path handling
* Moves the default coreutils path into base permissions to allow override. * Makes paths defined *later* in the permissions list appear *earlier* which should have the effect of later calls to `add-path` override binaries provided by earlier ones. * Makes the `path` variable on state a list rather than a string.
This commit is contained in:
parent
7f17289a72
commit
06c7210127
4 changed files with 7 additions and 5 deletions
|
|
@ -12,6 +12,7 @@ in {
|
|||
inherit pkgs;
|
||||
basePermissions = c: [
|
||||
(c.readonly "/build/secret")
|
||||
(c.add-pkg-deps [ pkgs.coreutils ])
|
||||
(c.readonly "/nix/store")
|
||||
];
|
||||
};
|
||||
|
|
@ -48,13 +49,13 @@ in {
|
|||
(jail "test" (sh ''echo "$PATH"'') (c: [
|
||||
(c.add-path "/some/new/path")
|
||||
]))
|
||||
"${defaultPath}:/some/new/path";
|
||||
"/some/new/path:${defaultPath}";
|
||||
|
||||
"combinators/add-pkg-deps" = assertStdout
|
||||
(jail "test" (sh ''echo "$PATH"'') (c: [
|
||||
(c.add-pkg-deps [ pkgs.hello ])
|
||||
]))
|
||||
"${defaultPath}:${pkgs.hello}/bin";
|
||||
"${pkgs.hello}/bin:${defaultPath}";
|
||||
|
||||
"combinators/bind-pkg" = assertStdout
|
||||
(jail "test" (sh "cat /foo") (c: [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue