-
-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathhome-manager.nix
More file actions
86 lines (77 loc) · 2.05 KB
/
home-manager.nix
File metadata and controls
86 lines (77 loc) · 2.05 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{ pkgs
, config
, lib
, ...
}:
let
inherit (lib)
mkOption
types
catAttrs
any
hasInfix
attrValues
;
inherit (types)
attrsOf
submodule
bool
;
inherit (config) home;
cfg = config.home.persistence;
persistentStoragePaths = catAttrs "persistentStoragePath" (attrValues cfg);
in
{
options =
{
home.persistence = mkOption {
default = { };
type = attrsOf (
submodule (
{ name, config, ... }:
import ./submodule-options.nix {
inherit pkgs lib name config;
user = home.username;
homeDir = home.homeDirectory;
# Home Manager doesn't seem to know about the user's group,
# so we default it to null here and fill it in in the NixOS
# module instead
group = null;
}
));
};
home._nixosModuleImported = mkOption {
default = false;
type = bool;
internal = true;
description = ''
Internal option to signal whether the NixOS persistence
module was properly imported. Do not set this!
'';
};
};
config = {
assertions = [
{
assertion = config.home._nixosModuleImported;
message = ''
home.persistence: Module was imported manually!
The Home Manager persistence module should not be imported
manually. It will be imported by the NixOS module
automatically. See
https://github.com/nix-community/impermanence?tab=readme-ov-file#home-manager
for instructions and examples.
'';
}
{
assertion = !(any (hasInfix home.homeDirectory) persistentStoragePaths);
message = ''
home.persistence: persistentStoragePath contains home directory path!
The API has changed - the persistent storage path should no longer
contain the path to the user's home directory, as it will be added
automatically.
'';
}
];
};
}