I have a few combinator ideas that I'd like to try adding but I still
haven't fully fleshed them out yet. In order to reduce breaking people's
setup, this introduces a new `experimental` flag on combinators that
separates them on the docs website to let users know that their design
may not be fully finalized yet.
To make it easier to rename combinators without breaking anyone's
configuration, this change allows combinators to specify a list of
`aliases` that are also exported from `jail.combinators`.
The aliases are also documented on the documentation website.
These have been deprecated for some time now, and were deprecated before
I gave my nixcon talk which brought attention to this library. So I
think it's pretty doubtful that anyone is still using these.
This combinator allows for the use of bubblewrap's `--add-seccomp-fd`
option. Since multiple invocations of this combinator are allowed, this
commit also introduces a new state attribute `seccompPermissions`.
The implementation uses `test -x` against the given argument to decide
whether to use input redirection to a FD or process substitution.
`base-permissions.nix` was the source of truth for all of the base
combinators, but it was not documented well anywhere.
To make this easier and more obvious for users, this commit pulls all
remaining custom permissions into a new `base` combinator which is
included by default. This way there is no more undocumented permissions
included by default, they are all documented in the `Default included
combinators` section of the docs.
This should also make it easier to override base permissions because
users can now just specify `base` instead of all of the
`unsafe-add-raw-args` calls unless they really want to change them.
The `lib/combinators.nix` file was getting quite long and some ideas I
have for future combinators may even require ancillary files. To help
scale these changes, this commit breaks each combinator into its own
file under the `lib/combinators` directory.
Before this change, additional calls to the dbus combinator would add
multiple `xdg-dbus-proxy` instances, but only the latest call would be
forwarded into the jail.
With this change, all permissions are saved in state, then, in a
deferred `add-runtime` we add a single `xdg-dbus-proxy` exposing the
union of all previous dbus calls.
This should allow writing combinators that expose dbus permissions like
notifications, or reading light/dark mode changes which can be composed
just like the other non-dbus combinators.
Most software that wants to know the timezone reads the symlink in
`/etc/localtime`. A previous update broke this assumption when
attempting to fix the combinator to work on non-NixOS systems.
This change should fix the time-zone combinator in both NixOS and
non-NixOS systems.
39ca901 introduced only bind-mounting in the individual store paths that
make up the runtime closure for the jail. However, in practice I found a
few jails that were using `write-text` for configuration files that
referenced other store paths were no longer being bind mounted into the
jail.
I think it's reasonable that if you `write-text` or `bind-pkg`, and it
has runtime dependencies, those dependencies should be made available to
the jail.
This one is a bit confusing since these docs document a nix multi-line
string within a multi-line string, *and* there is a bash interpolation
within. We want the docs to render as `if [ -e "''${TMPFILE-}" ]`, since
the docs are within a multi-line string.
Sorry in advance for anyone attempting to parse this in the nix source
code instead of the docs website :(.
* 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.