blob: fe1c15db62851d0b07bd26869d269c9392187231 [file] [log] [blame]
Skyler Grey245a88f2023-05-01 21:35:57 +00001# Home manager is used separately from this deploy, but we still need to create
2# user accounts in the system config
Skyler Greya78aa672023-05-20 13:48:18 +02003{ base, pkgs, lib, config, ... }:
Skyler Grey245a88f2023-05-01 21:35:57 +00004let
Skyler Greyfe1740c2023-10-21 01:24:18 +00005 mkUser = username:
6 {
7 isSystemUser = true;
8 linger = true;
9 createHome = true;
10 home = "/services/${username}";
11 group = "clicks";
12 shell = pkgs.bashInteractive;
Samuel Shuertf68685d2023-10-28 20:07:56 -040013 } // (if builtins.pathExists "${../../services}/${username}/system.nix" then
14 import "${../../services}/${username}/system.nix"
Skyler Greyfe1740c2023-10-21 01:24:18 +000015 else
16 { });
17in {
Samuel Shuertf68685d2023-10-28 20:07:56 -040018 users.users = lib.pipe ../../services [
Skyler Grey245a88f2023-05-01 21:35:57 +000019 builtins.readDir
20 (lib.filterAttrs (_name: value: value == "directory"))
21 builtins.attrNames
Skyler Greyfe1740c2023-10-21 01:24:18 +000022 (map (name: {
23 inherit name;
24 value = mkUser name;
25 }))
Skyler Grey245a88f2023-05-01 21:35:57 +000026 builtins.listToAttrs
27 ];
Skyler Greyfe1740c2023-10-21 01:24:18 +000028} // (if (base != null) then
29 {
30 /* users.groups = lib.mapAttrs'
31 (_: user: {
32 name = user.group;
33 value = { };
34 })
35 base.config.users.users;
36 */
37 }
38else
39 { })