Skip to content

Commit 5d3d311

Browse files
committed
suites: add users to suites
1 parent 57ce3b0 commit 5d3d311

File tree

6 files changed

+16
-5
lines changed

6 files changed

+16
-5
lines changed

DOC.md

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ directly imported from any host like so:
4141
}
4242
```
4343

44+
You can declare any combination of users and profiles that you wish, providing
45+
a nice abstraction, free from the idiosyncratic concerns of specific hardware.
46+
4447
## Users
4548
User declarations belong in the `users` directory.
4649

hosts/NixOS.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ suites, ... }:
22
{
33
### root password is empty by default ###
4-
imports = [ ../users/nixos ../users/root ] ++ suites.graphics;
4+
imports = suites.graphics;
55

66
boot.loader.systemd-boot.enable = true;
77
boot.loader.efi.canTouchEfiVariables = true;

hosts/ci.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{ suites, ... }:
22
{
3-
imports = [ ../users/nixos ../users/root ] ++ suites.all;
3+
imports = with suites; allProfiles ++ allUsers;
44

55
security.mitigations.acceptRisk = true;
66

profiles/suites.nix

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
{ lib, profiles }:
22
let
33
inherit (builtins) mapAttrs isFunction;
4-
all =
4+
5+
allProfiles =
56
let
67
filtered = lib.filterAttrs (n: _: n != "core") profiles;
78
in
89
lib.collect isFunction filtered;
10+
11+
allUsers = lib.collect isFunction users;
12+
13+
users = lib.flk.defaultImports (toString ../users);
914
in
1015
with profiles;
1116
mapAttrs (_: v: lib.flk.profileMap v)
17+
# define your own suites below
1218
rec {
13-
work = [ develop virt ];
19+
work = [ develop virt users.nixos users.root ];
1420

1521
graphics = work ++ [ graphical ];
1622

@@ -24,5 +30,5 @@ mapAttrs (_: v: lib.flk.profileMap v)
2430

2531
goPlay = play ++ [ laptop ];
2632
} // {
27-
inherit all;
33+
inherit allProfiles allUsers;
2834
}

users/nixos/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{ ... }:
12
{
23
home-manager.users.nixos = {
34
imports = [ ../profiles/git ../profiles/direnv ];

users/root/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{ ... }:
12
# recommend using `hashedPassword`
23
{
34
users.users.root.password = "";

0 commit comments

Comments
 (0)