ERROR
packetmix/npins/sources.json
ERROR
packetmix/npins/sources.json
Failed to calculate interdiff for this file.
NEW
packetmix/modules/nilla-home/home.nix
NEW
packetmix/modules/nilla-home/home.nix
···
12
default.value = { };
13
type = homes-type;
14
};
15
-
16
-
config = {
17
-
assertions = lib.attrs.mapToList (name: value: {
18
-
assertion = !(builtins.isNull value.pkgs);
19
-
message = "A Nixpkgs instance is required for the home-manager home \"${name}\", but none was provided and \"inputs.nixpkgs\" does not exist.";
20
-
}) config.homes;
21
-
};
22
}
NEW
packetmix/modules/nilla-home/homes-type.nix
NEW
packetmix/modules/nilla-home/homes-type.nix
···
106
description = "The created Home Manager home for each of the systems.";
107
type = lib.types.attrs.of lib.types.raw;
108
writable = false;
109
+
default.value =
110
+
if builtins.isNull config.pkgs then
111
+
"A Nixpkgs instance is required for the home-manager home \"${name}\", but none was provided and \"inputs.nixpkgs\" does not exist."
112
+
else
113
+
result;
114
};
115
};
116
NEW
packetmix/modules/nilla-home/nixos.nix
NEW
packetmix/modules/nilla-home/nixos.nix
···
30
31
config.modules =
32
let
33
warn' = builtins.warn or builtins.trace; # builtins.warn doesn't exist on some versions of nix/lix
34
warnIf =
35
condition: message: value:
···
37
homeManager = submodule.config.home-manager;
38
in
39
(lib.fp.pipe [
40
(lib.attrs.mapToList (
41
homeName: home:
42
let
43
homeNameParts = builtins.match "([a-z][-a-z0-9]*)(@([-A-Za-z0-9]+))?(:([-_A-Za-z0-9]+))?" homeName;
44
username = builtins.elemAt homeNameParts 0;
45
in
46
-
{
47
-
inherit home homeName username;
48
-
}
49
))
50
(builtins.map (
51
{
52
home,
53
homeName,
54
-
...
55
}@identity:
56
warnIf (home.home-manager != homeManager)
57
"The home \"${homeName}\" isn't using the same home-manager input as the NixOS system \"${name}\". This may work, but is not officially supported by the Nilla Home or Nilla NixOS maintainers. Please fix this before reporting any bugs you may find."
···
94
);
95
};
96
};
97
-
98
-
config = {
99
-
assertions = lib.lists.flatten (
100
-
lib.attrs.mapToList (
101
-
name: value:
102
-
let
103
-
hasNixpkgs = !(builtins.isNull value.pkgs);
104
-
requestedHomes = value.homes != [ ];
105
-
hasHomeManager = !(builtins.isNull value.home-manager);
106
-
in
107
-
[
108
-
{
109
-
assertion = hasNixpkgs;
110
-
message = "A Nixpkgs instance is required for the NixOS system \"${name}\", but none was provided and \"inputs.nixpkgs\" does not exist.";
111
-
}
112
-
{
113
-
assertion = !requestedHomes || hasHomeManager;
114
-
message = "A home-manager instance is required to enable homes for the NixOS system \"${name}\", but none was provided and \"inputs.home-manager\" does not exist.";
115
-
}
116
-
(lib.attrs.mapToList (
117
-
homeName: home:
118
-
let
119
-
homeHasHomeManager = !(builtins.isNull home.home-manager);
120
-
homeIsValidForSystem = home ? result.${value.pkgs.stdenv.hostPlatform.system};
121
-
in
122
-
[
123
-
{
124
-
assertion = homeHasHomeManager;
125
-
message = "You've asked for the home \"${homeName}\" to be activated in the NixOS system \"${name}\", but it needs a home-manager instance, none was provided and \"inputs.home-manager\" does not exist.";
126
-
}
127
-
{
128
-
assertion = !homeHasHomeManager || !hasNixpkgs || homeIsValidForSystem;
129
-
message = "You've asked for the home \"${homeName}\" to be activated in the NixOS system \"${name}\", but it isn't valid for \"${value.pkgs.stdenv.hostPlatform.system}\" systems.";
130
-
}
131
-
]
132
-
) value.homes)
133
-
(
134
-
let
135
-
usernames = lib.attrs.mapToList (
136
-
homeName: home:
137
-
let
138
-
homeHasHomeManager = !(builtins.isNull home.home-manager);
139
-
homeIsValidForSystem = home ? result.${value.pkgs.stdenv.hostPlatform.system};
140
-
in
141
-
if homeHasHomeManager && hasNixpkgs && homeIsValidForSystem then
142
-
let
143
-
homeNameParts = builtins.match "([a-z][-a-z0-9]*)(@([-A-Za-z0-9]+))?(:([-_A-Za-z0-9]+))?" homeName;
144
-
username = builtins.elemAt homeNameParts 0;
145
-
in
146
-
username
147
-
else
148
-
null
149
-
) value.homes;
150
-
existingUsernames = builtins.filter (username: username != null) usernames;
151
-
uniqueUsernames = lib.lists.unique existingUsernames;
152
-
in
153
-
{
154
-
assertion = !hasNixpkgs || (existingUsernames == uniqueUsernames);
155
-
message = "There are multiple homes for a single user in the NixOS system \"${name}\". Please make sure you've only enabled a single home per user.";
156
-
}
157
-
)
158
-
]
159
-
) global.config.systems.nixos
160
-
);
161
-
};
162
}
···
30
31
config.modules =
32
let
33
+
system = submodule.config.pkgs.stdenv.hostPlatform.system or submodule.config.pkgs.system;
34
warn' = builtins.warn or builtins.trace; # builtins.warn doesn't exist on some versions of nix/lix
35
warnIf =
36
condition: message: value:
···
38
homeManager = submodule.config.home-manager;
39
in
40
(lib.fp.pipe [
41
+
(
42
+
value:
43
+
if builtins.isNull homeManager && value != [ ] then
44
+
builtins.throw "A home-manager instance is required to enable homes for the NixOS system \"${name}\", but none was provided and \"inputs.home-manager\" does not exist."
45
+
else
46
+
value
47
+
)
48
(lib.attrs.mapToList (
49
homeName: home:
50
let
51
homeNameParts = builtins.match "([a-z][-a-z0-9]*)(@([-A-Za-z0-9]+))?(:([-_A-Za-z0-9]+))?" homeName;
52
username = builtins.elemAt homeNameParts 0;
53
+
homeHasHomeManager = !(builtins.isNull home.home-manager);
54
+
homeIsValidForSystem = home ? result.${value.pkgs.stdenv.hostPlatform.system or value.pkgs.system};
55
in
56
+
if !hasHomeManager then
57
+
builtins.throw "You've asked for the home \"${homeName}\" to be activated in the NixOS system \"${name}\", but it needs a home-manager instance, none was provided and \"inputs.home-manager\" does not exist."
58
+
else if !homeIsValidForSystem then
59
+
builtins.throw "You've asked for the home \"${homeName}\" to be activated in the NixOS system \"${name}\", but it isn't valid for \"${
60
+
value.pkgs.stdenv.hostPlatform.system or value.pkgs.system
61
+
}\" systems."
62
+
else
63
+
{
64
+
inherit home homeName username;
65
+
}
66
))
67
+
(
68
+
values:
69
+
let
70
+
existingUsernames = builtins.filter (username: value.username != null) values;
71
+
uniqueUsernames = lib.lists.unique existingUsernames;
72
+
in
73
+
if existingUsernames != uniqueUsernames then
74
+
builtins.throw "There are multiple homes for a single user in the NixOS system \"${name}\". Please make sure you've only enabled a single home per user."
75
+
else
76
+
values
77
+
)
78
(builtins.map (
79
{
80
home,
81
homeName,
82
+
username,
83
}@identity:
84
warnIf (home.home-manager != homeManager)
85
"The home \"${homeName}\" isn't using the same home-manager input as the NixOS system \"${name}\". This may work, but is not officially supported by the Nilla Home or Nilla NixOS maintainers. Please fix this before reporting any bugs you may find."
···
122
);
123
};
124
};
125
}