Commit graph

26 commits

Author SHA1 Message Date
Alex David
053e2c1364 Add no-die-with-parent combinator 2025-12-16 08:50:53 -08:00
Alex David
98a6bd032c Add reset combinator 2025-11-10 11:50:37 -08:00
Mathias Sven
23bf74dad6 Add add-seccomp combinator
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.
2025-10-18 22:44:01 -07:00
Alex David
b0a8a22983 Pull remaining default perms into base combinator
`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.
2025-10-10 16:28:45 -07:00
Alex David
977c3f2426 Add notifications combinator 2025-10-10 16:28:45 -07:00
Alex David
6181276ae1 Split combinators into files
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.
2025-10-10 16:28:43 -07:00
Mathias Sven
8fa6d132e1 Fix readonly-paths-from-var trailing DIR 2025-10-10 13:23:05 -07:00
Alex David
22ec74b9d1 Add pushState helper 2025-09-28 15:58:58 -07:00
Alex David
3610987241 Allow multiple calls to dbus combinator
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.
2025-09-28 15:44:36 -07:00
Alex David
3ccf1d42e2 Add try-* bind combinators 2025-09-27 10:51:19 -07:00
Alex David
25fe216eec Fix signature of open-urls-in-browser combinator 2025-09-15 22:26:44 -07:00
Alex David
45c2b47d71 Fix time-zone combinator
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.
2025-09-15 22:26:44 -07:00
Alex David
700189112f Format nix files with nixfmt-tree 2025-09-11 07:31:48 -07:00
Alex David
d35e9df391 Add open-urls-in-browser combinator 2025-09-01 21:47:48 -07:00
Alex David
f5cc61ef63 Add jail-to-host-channel combinator 2025-09-01 21:47:48 -07:00
Alex David
7dc202a5a7 Add dbus combinator 2025-09-01 21:47:48 -07:00
Alex David
275a1296e7 Fix network combinator binding too many paths 2025-09-01 21:47:48 -07:00
Alex David
b28610bb1e Bind write-text/bind-pkg runtime closure
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.
2025-08-27 12:14:55 -07:00
Alex David
7d3efead61 Only expose runtime closure by default
Instead of binding the entire `/nix/store`. This behavior can be changed
by overriding `basePermissions`.
2025-08-27 12:14:55 -07:00
Alex David
cd825bf411 Fix missing '' in add-cleanup docs
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 :(.
2025-08-27 12:14:55 -07:00
Alex David
fa989aa4fc Fix add-path docs
06c7210 changed this to prepend paths, but didn't update the docs.
2025-08-27 12:14:55 -07:00
Alex David
d8500ab273 Move fake-passwd into combinators 2025-08-07 17:26:51 -07:00
Alex David
5e86199537 Include deprecated combinators in the docs 2025-08-07 17:23:52 -07:00
Alex David
2ca02c8bfe Use camelCase for state attributes 2025-08-07 16:36:13 -07:00
Alex David
06c7210127 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.
2025-08-07 16:26:18 -07:00
Alex David
c7685334cf Restructure source 2025-08-07 15:54:50 -07:00
Renamed from combinators.nix (Browse further)