Add no-die-with-parent combinator

This commit is contained in:
Alex David 2025-11-28 11:45:17 -08:00
commit 053e2c1364
9 changed files with 131 additions and 12 deletions

View file

@ -27,8 +27,6 @@ in
* Sets up a fake dev at `/dev` (Using `--dev /dev` bwrap args)
* Sets up a tmpfs at `/tmp` (Using `--tmpfs /tmp` bwrap args)
* Sets up a tmpfs at your home (Using `--tmpfs ~` bwrap args)
* Ensures all processes in the jail are killed when the jail exits
(Using `--die-with-parent` bwrap arg)
* Adds coreutils to the package deps (`add-pkg-deps [ pkgs.coreutils ]`)
* Binds `/bin/sh` from `pkgs.bash` and adds `/bin` to `$PATH`
(`ro-bind "''${pkgs.bash}/bin/sh" "/bin/sh"`)
@ -45,7 +43,6 @@ in
(unsafe-add-raw-args "--dev /dev")
(unsafe-add-raw-args "--tmpfs /tmp")
(unsafe-add-raw-args "--tmpfs ~")
(unsafe-add-raw-args "--die-with-parent")
(ro-bind "${pkgs.bash}/bin/sh" "/bin/sh")
(add-path "/bin")
(helpers.pushState "additionalRuntimeClosures" pkgs.bash)

View file

@ -0,0 +1,15 @@
{ ... }:
{
sig = "Permission";
doc = ''
Disables `--die-with-parent`
By default, jail-nix includes the `--die-with-parent` bwrap flag which
kills all processes within this jail when the parent process dies. Use this
combinator if you don't want this behavior.
This may be useful if the software you are jailing forks a daemon and then
exits.
'';
impl = state: state // { dieWithParent = false; };
}