blob: 007e209b0aa3a3d86ef06bcb29c25377d27bad94 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
{
config,
inputs,
lib,
...
}:
let
cfg = config.nixfiles.modules.ark;
in
{
imports = [
inputs.impermanence.nixosModules.impermanence
(lib.mkAliasOptionModule
[ "ark" ]
[
"nixfiles"
"modules"
"ark"
]
)
];
options.nixfiles.modules.ark =
let
mkListOfAnythingOption = lib.mkOption {
type = with lib.types; listOf anything; # Assumed to be matching with the upstream type.
default = [ ];
};
in
{
enable = lib.mkEnableOption "persistent storage support via impermanence";
path = lib.mkOption {
type = lib.types.str;
default = "/ark";
};
directories = mkListOfAnythingOption;
files = mkListOfAnythingOption;
# hm = {
# directories = mkListOfAnythingOption;
# files = mkListOfAnythingOption;
# };
};
config = lib.mkIf cfg.enable {
environment.persistence.${cfg.path} = {
hideMounts = true;
enableDebugging = false;
enableWarnings = false;
inherit (cfg) directories files;
};
# NOTE We can't reliably[1] use this, so for the time being, this will stay
# commented out. Probably forever.
#
# [1]: https://github.com/nix-community/impermanence/issues/18
#
# hm = {
# imports = [inputs.impermanence.nixosModules.home-manager.impermanence];
# home.persistence."${cfg.path}/${config.my.home}" = {
# allowOther = false;
# inherit (cfg.hm) directories files;
# };
# };
};
}
|