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.
This commit is contained in:
parent
8fa6d132e1
commit
6181276ae1
54 changed files with 1531 additions and 1260 deletions
27
lib/combinators/persist-home.nix
Normal file
27
lib/combinators/persist-home.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ 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 "~"))
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue