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.
Jail.nix does not expose `$PATH` by default because the automatic
runtime-closure binding often means your `$PATH` won't work anyway.
However, for some jails, you may want to disable the runtime-closure
binding and just bind your whole nix store. In those cases, it would be
nice if `fwd-env "PATH"` worked correctly.
At some point example.org changed something about their certificate
chain and causes `curl https://example.org` to fail on NixOS systems.
For now, I'm going to use `https://alexdav.id`.
Some software reasonably expects `sh` to exist in PATH. I think I
haven't run into this before since a lot of nixified software explicitly
declares its dependencies on bash, but I've run into a few where this
isn't the case.
* Allow running test apps in repo root (e.g. `nix run ./tests#runTests`)
* Pass argv to cabal to allow filtering tests with `-m`
* Use `cabal run spec` rather than `cabal test`
On Nixos, it may be desirable to install some software using
`programs.*.enable = true`. Jail.nix mostly supports this because you
can either use `jail-nix.mkOverlay`, or just use Nixos
`programs.*.package = jail ...` to inject a jailed version of the
package.
However, for some modules, like Firefox, the Nixos module calls
`override` on the package. Normally, you would just call `override` on
the package passed into jail, but this is not possible to do within a
Nixos module.
To address this, this patch will check to see if a package passed into
jail has an `override` field, and if so will add an `override` on the
jailed derivation that passes the override function to the entrypoint.
Thanks to ~juanjakobo for reporting this!
Fixes https://todo.sr.ht/~alexdavid/jail.nix/1
In 8fa6d132e1, ~mathiassven submitted a
patch that fixes the `readonly-paths-from-var` combinator omitting the
final path.
The tests didn't catch this since the final path in the test was a
non-existent path.
This commit backfills the test to catch regressions related to this bug.
The test now makes sure that the first, last, and at least one middle
test path are real paths that show up in the jail.
This is unlikely to be exploited since the combinator only allows a
single argument and is not parsed by any shell, but it seems like a good
thing to ensure that only valid non-local URLs will be forwarded to
$BROWSER.
Before this change, combinators that call `add-runtime` were assuming
coreutils were available, however `add-runtime` did not inject coreutils
as a runtime input.
This also removes forwarding $PATH in the tests which should catch any
issues like this in the future.
Thanks Epsylon for the report:
https://lists.sr.ht/~alexdavid/general/%3C331f3203-d6bf-4c53-824c-4d05088ec47e@gmail.com%3E
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.
* 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.