File tree Expand file tree Collapse file tree 9 files changed +82
-38
lines changed Expand file tree Collapse file tree 9 files changed +82
-38
lines changed Original file line number Diff line number Diff line change 2
2
Suites provide a mechanism for users to easily combine and name collections of
3
3
profiles.
4
4
5
- ` suites ` are defined in the ` importables ` argument in either the ` home ` or ` nixos `
6
- namespace. They are a special case of an ` importable ` which is passed as a special
7
- argument (one that can be use in an ` imports ` line) to your hosts. All lists defined
8
- in ` suites ` are flattened and type-checked as paths.
5
+ ` suites ` are defined in the ` importables ` argument in any of the ` nixos ` ,
6
+ ` darwin ` , or ` home ` namespaces. They are a special case of an ` importable ` which
7
+ is passed as a special argument (one that can be use in an ` imports ` line) to
8
+ your hosts. All lists defined in ` suites ` are flattened and type-checked as
9
+ paths.
9
10
10
11
## Definition
12
+
11
13
``` nix
12
14
rec {
13
- workstation = [ profiles.develop profiles.graphical users.nixos ];
14
- mobileWS = workstation ++ [ profiles.laptop ];
15
+ workstation = [
16
+ profiles.develop
17
+ profiles.graphical
18
+ users.primary
19
+ ];
20
+ portableWorkstation =
21
+ workstation
22
+ ++ [ profiles.laptop ];
15
23
}
16
24
```
17
25
18
26
## Usage
27
+
19
28
` hosts/my-laptop.nix ` :
29
+
20
30
``` nix
21
31
{ suites, ... }:
22
32
{
23
- imports = suites.mobileWS ;
33
+ imports = suites.portableWorkstation ;
24
34
}
25
35
```
Original file line number Diff line number Diff line change 119
119
users = digga . lib . rakeLeaves ./users ;
120
120
} ;
121
121
suites = with profiles ; rec {
122
- base = [ core . nixos users . nixos users . root ] ;
122
+ base = [
123
+ core . nixos
124
+ users . root
125
+ users . primary
126
+ ] ;
123
127
} ;
124
128
} ;
125
129
} ;
147
151
users = digga . lib . rakeLeaves ./users ;
148
152
} ;
149
153
suites = with profiles ; rec {
150
- base = [ core . darwin users . admin ] ;
154
+ base = [
155
+ core . darwin
156
+ users . primary
157
+ ] ;
151
158
} ;
152
159
} ;
153
160
} ;
162
169
} ;
163
170
} ;
164
171
users = {
165
- nixos = { suites , ... } : { imports = suites . base ; } ;
166
172
primary = { suites , ... } : { imports = suites . base ; } ;
167
173
} ;
168
174
} ;
Original file line number Diff line number Diff line change 1
1
{ profiles , ... } :
2
2
{
3
- imports = [
4
- # profiles.networking
5
- profiles . core . nixos
6
- profiles . users . root # make sure to configure ssh keys
7
- profiles . users . nixos
3
+ imports = with profiles ; [
4
+ core . nixos
5
+ # N.B. Make sure to add your public SSH keys to authorized keys!
6
+ users . root
7
+ # Note that this is different than the usual `primary` user for the sake of
8
+ # a familiar installation UX.
9
+ users . nixos
8
10
] ;
9
11
10
12
boot . loader . systemd-boot . enable = true ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ { hmUsers , ... } :
2
+ {
3
+ # In this profile, the `nixos` system-level user loads the home-manager
4
+ # profile for the `primary` user defined in the flake's
5
+ # `self.home.users.primary` option.
6
+ #
7
+ # The user profile names defined in `self.home.users.<name>` don't need to
8
+ # correspond directly to system-level usernames. They can, instead, be
9
+ # imported as a module in any `home-manager.users` configuration, allowing for
10
+ # more flexibility.
11
+ #
12
+ # Compare with the `primary` system user (in this directory), which uses a
13
+ # simplified (but limited) approach.
14
+ home-manager . users . nixos = { ...} : { imports = [ hmUsers . primary ] ; } ;
15
+
16
+ users . users . nixos = {
17
+ # This is the standard password for installation media.
18
+ password = "nixos" ;
19
+ description = "default" ;
20
+ isNormalUser = true ;
21
+ extraGroups = [ "wheel" ] ;
22
+ } ;
23
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ { hmUsers , ... } :
2
+ {
3
+ users . users . primary = {
4
+ description = "primary administrative user on this machine" ;
5
+ isNormalUser = true ;
6
+ extraGroups = [ "wheel" ] ;
7
+
8
+ # Make sure to change this!
9
+ initialPassword = "nixos" ;
10
+ } ;
11
+
12
+ # The following home-manager user definition doesn't include any further
13
+ # customization beyond the default `hmUsers.primary` profile, so its
14
+ # implementation can be simplified.
15
+ #
16
+ # Note, however, that the pattern demonstrated in the `nixos` user profile is
17
+ # more flexible in the long run, especially if you want to share the same
18
+ # home-manager profile amongst multiple users with different usernames.
19
+ home-manager . users = { inherit ( hmUsers ) primary ; } ;
20
+ }
File renamed without changes.
Original file line number Diff line number Diff line change 17
17
18
18
globalDefaults = { hmUsers } :
19
19
{ config , pkgs , self , ... } : {
20
- # digga lib can be accessed in modules directly as config.lib.digga
20
+ # Digga's library functions can be accessed directly through the module
21
+ # system as `config.lib.digga`.
21
22
lib = {
22
23
inherit ( pkgs . lib ) digga ;
23
24
} ;
32
33
} ;
33
34
34
35
nixosDefaults = { self , ... } : {
36
+ # N.B. If users are not explicitly defined in configuration, they will be
37
+ # removed from the resulting system. This could result in data loss if
38
+ # you're not starting from a fresh install -- even if you are currently
39
+ # logged in!
35
40
users . mutableUsers = lib . mkDefault false ;
36
41
hardware . enableRedistributableFirmware = lib . mkDefault true ;
37
42
system . configurationRevision = lib . mkIf ( self ? rev ) self . rev ;
You can’t perform that action at this time.
0 commit comments