2025-08-07 15:29:16 -07:00
|
|
|
# Advanced Configuration
|
|
|
|
|
|
|
|
|
|
All configuration options on this page can be passed into `jail-nix.lib.extend`.
|
|
|
|
|
|
|
|
|
|
## additionalCombinators
|
|
|
|
|
|
|
|
|
|
`additionalCombinators` takes in a list of custom combinators to expose under
|
|
|
|
|
`jail.combinators` and in jail definitions. If passed a funciton, jail.nix will
|
|
|
|
|
inject the builtin combinators.
|
|
|
|
|
|
2025-08-07 15:42:36 -07:00
|
|
|
For example, this creates a `jail` function that exposes a `my-permission`
|
2025-08-07 15:29:16 -07:00
|
|
|
combinator:
|
|
|
|
|
|
|
|
|
|
```nix
|
|
|
|
|
jail = jail-nix.lib.extend {
|
|
|
|
|
inherit pkgs;
|
|
|
|
|
additionalCombinators = builtinCombinators: with builtinCombinators; [
|
2025-08-07 15:42:36 -07:00
|
|
|
my-permission = compose [
|
2025-08-07 15:29:16 -07:00
|
|
|
(readonly "/foo")
|
|
|
|
|
(readonly "/bar")
|
|
|
|
|
];
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
2025-08-07 15:42:36 -07:00
|
|
|
# Now my-permission is exposed in all the places the builtin combinators are exposed:
|
2025-08-07 15:29:16 -07:00
|
|
|
|
|
|
|
|
jailed-hello = jail "jailed-hello" pkgs.hello (c: with c; [
|
2025-08-07 15:42:36 -07:00
|
|
|
my-permission
|
2025-08-07 15:29:16 -07:00
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
# Alternatively, using jail.combinators:
|
|
|
|
|
|
|
|
|
|
jailed-hello = jail "jailed-hello" pkgs.hello [
|
2025-08-07 15:42:36 -07:00
|
|
|
jail.combinators.my-permission
|
2025-08-07 15:29:16 -07:00
|
|
|
];
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## basePermissions
|
|
|
|
|
|
|
|
|
|
By default, jail.nix comes with a base set of permissions that all jails
|
|
|
|
|
inherit by default. This configuration option allows you to override these.
|
|
|
|
|
|
|
|
|
|
The goal of the base permissions are to provide a reasonably secure default
|
|
|
|
|
with enough permissions to have most software behave correctly.
|
|
|
|
|
|
2025-08-07 17:26:51 -07:00
|
|
|
If you override this, you may want to take a look at the [default included
|
2025-08-15 08:31:06 -07:00
|
|
|
combinators](combinators.md#default-included-combinators).
|
2025-08-07 17:26:51 -07:00
|
|
|
|
2025-10-04 15:10:08 -07:00
|
|
|
For example, here is the default set of base permissions:
|
2025-08-07 15:29:16 -07:00
|
|
|
```nix
|
|
|
|
|
jail = jail-nix.lib.extend {
|
|
|
|
|
inherit pkgs;
|
2025-10-04 15:10:08 -07:00
|
|
|
basePermissions = combinators: with combinators; [
|
|
|
|
|
base
|
|
|
|
|
bind-nix-store-runtime-closure
|
|
|
|
|
fake-passwd
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
However if you wanted to bind in your entire nix store rather than using the
|
|
|
|
|
bind-nix-store-runtime-closure combinator you could do that like so:
|
|
|
|
|
|
|
|
|
|
```nix
|
|
|
|
|
jail = jail-nix.lib.extend {
|
|
|
|
|
inherit pkgs;
|
|
|
|
|
basePermissions = combinators: with combinators; [
|
|
|
|
|
base
|
2025-08-07 15:29:16 -07:00
|
|
|
(readonly "/nix/store")
|
2025-10-04 15:10:08 -07:00
|
|
|
fake-passwd
|
2025-08-07 15:29:16 -07:00
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
```
|
2025-08-07 16:32:58 -07:00
|
|
|
|
|
|
|
|
## bubblewrapPackage
|
|
|
|
|
|
|
|
|
|
This configuration option allows you to override what bubblewrap package
|
|
|
|
|
jail.nix uses for its jails. The default value is `pkgs.bubblewrap`.
|