tangled
alpha
login
or
join now
bwc9876.dev
/
nixos-config
1
fork
atom
Flake for my NixOS devices
1
fork
atom
overview
issues
pulls
pipelines
Fix imperm
bwc9876.dev
4 months ago
ce58e4fe
1da90065
verified
This commit was signed with the committer's
known signature
.
bwc9876.dev
SSH Key Fingerprint:
SHA256:DanMEP/RNlSC7pAVbnXO6wzQV00rqyKj053tz4uH5gQ=
+30
-35
1 changed file
expand all
collapse all
unified
split
nixosModules
imperm.nix
+30
-35
nixosModules/imperm.nix
···
1
1
-
{...}: {
1
1
+
{ ... }:
2
2
+
{
2
3
config,
3
4
lib,
4
5
inputs,
5
6
...
6
6
-
}: {
7
7
-
imports = [inputs.imperm.nixosModules.default];
7
7
+
}:
8
8
+
{
9
9
+
imports = [ inputs.imperm.nixosModules.default ];
8
10
9
11
options.cow.imperm = {
10
12
enable = lib.mkEnableOption "Impermanence, turns off mutable users and expects you to define their password hashes";
···
21
23
keep = lib.mkOption {
22
24
type = lib.types.listOf lib.types.str;
23
25
description = "Paths to keep that should be backed up";
24
24
-
default = [];
26
26
+
default = [ ];
25
27
};
26
28
keepCache = lib.mkOption {
27
29
type = lib.types.listOf lib.types.str;
28
30
description = "Paths to keep that shouldn't be backed up";
29
29
-
default = [];
31
31
+
default = [ ];
30
32
};
31
33
};
32
34
33
33
-
config = let
34
34
-
users =
35
35
-
if config.cow.hm.enable
36
36
-
then config.home-manager.users
37
37
-
else {};
38
38
-
persistRoot = config.cow.imperm.persistRoot; # Anything important we want backed up
39
39
-
cacheRoot = config.cow.imperm.cacheRoot; # Anything not as important that we can stand losing
40
40
-
in
35
35
+
config =
36
36
+
let
37
37
+
users = if config.cow.hm.enable then config.home-manager.users else { };
38
38
+
persistRoot = config.cow.imperm.persistRoot; # Anything important we want backed up
39
39
+
cacheRoot = config.cow.imperm.cacheRoot; # Anything not as important that we can stand losing
40
40
+
in
41
41
lib.mkIf config.cow.imperm.enable {
42
42
users.mutableUsers = false;
43
43
···
45
45
"${cacheRoot}" = {
46
46
enable = true;
47
47
hideMounts = true;
48
48
-
directories =
49
49
-
[
50
50
-
"/var/log"
51
51
-
"/var/lib/nixos"
52
52
-
"/var/lib/systemd/coredump"
53
53
-
"/var/lib/systemd/timers"
54
54
-
"/var/lib/systemd/rfkill"
55
55
-
"/var/lib/systemd/backlight"
56
56
-
]
57
57
-
++ config.cow.imperm.keep;
58
58
-
users =
59
59
-
builtins.mapAttrs (_: v: {
60
60
-
directories = v.cow.imperm.keepCache or [];
61
61
-
})
62
62
-
users;
48
48
+
directories = [
49
49
+
"/var/log"
50
50
+
"/var/lib/nixos"
51
51
+
"/var/lib/systemd/coredump"
52
52
+
"/var/lib/systemd/timers"
53
53
+
"/var/lib/systemd/rfkill"
54
54
+
"/var/lib/systemd/backlight"
55
55
+
]
56
56
+
++ config.cow.imperm.keepCache;
57
57
+
users = builtins.mapAttrs (_: v: {
58
58
+
directories = v.cow.imperm.keepCache or [ ];
59
59
+
}) users;
63
60
};
64
61
"${persistRoot}" = {
65
62
enable = true;
66
63
hideMounts = true;
67
67
-
directories = config.cow.imperm.keepCache;
68
68
-
users =
69
69
-
builtins.mapAttrs (_: v: {
70
70
-
directories = v.cow.imperm.keep or [];
71
71
-
files = v.cow.imperm.keep or [];
72
72
-
})
73
73
-
users;
64
64
+
directories = config.cow.imperm.keep;
65
65
+
users = builtins.mapAttrs (_: v: {
66
66
+
directories = v.cow.imperm.keep or [ ];
67
67
+
files = v.cow.imperm.keep or [ ];
68
68
+
}) users;
74
69
};
75
70
};
76
71
};