blob: d645bcb2b8368518e9562c757b9ed26d586a6940 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
{
config,
lib,
...
}: let
cfg = config.vhack.persist;
in {
options.vhack.persist = {
enable = lib.mkEnableOption "impermanence";
directories = lib.mkOption {
description = "The list of directories to persist";
type = lib.types.listOf (lib.types.coercedTo lib.types.str (d: {directory = d;}) (lib.types.attrsOf lib.types.anything));
};
};
config = lib.mkIf cfg.enable {
environment.persistence."/srv" = {
hideMounts = true;
directories =
[
"/etc/nixos"
"/var/log"
# TODO(@bpeetz): Instead of persisting that, encode each uid/gid directly in the
# config. <2024-12-24>
"/var/lib/nixos"
]
++ cfg.directories;
files = [
"/etc/machine-id"
];
};
};
}
|