jail.nix/lib/combinators/persist-home.nix
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

27 lines
689 B
Nix

{ combinators, helpers, ... }:
let
inherit (combinators)
add-runtime
compose
noescape
rw-bind
;
in
{
sig = "String -> Permission";
doc = ''
Persists the home directory across all jails with the specified name.
This is useful for a lot of software that may want to write arbitrary
things into your home directory and expect to read them back in a future
invocation.
The home directory is persisted in `~/.local/share/jail.nix/home/<name>`.
'';
impl =
name:
compose [
(add-runtime "mkdir -p ${helpers.dataDirSubPath "home/${name}"}")
(rw-bind (noescape (helpers.dataDirSubPath "home/${name}")) (noescape "~"))
];
}