Skyler Grey | 245a88f | 2023-05-01 21:35:57 +0000 | [diff] [blame] | 1 | # Home manager is used separately from this deploy, but we still need to create |
| 2 | # user accounts in the system config |
Skyler Grey | a78aa67 | 2023-05-20 13:48:18 +0200 | [diff] [blame^] | 3 | { base, pkgs, lib, config, ... }: |
Skyler Grey | 245a88f | 2023-05-01 21:35:57 +0000 | [diff] [blame] | 4 | let |
| 5 | mkUser = username: { |
| 6 | isSystemUser = true; |
| 7 | linger = true; |
| 8 | createHome = true; |
| 9 | home = "/services/${username}"; |
| 10 | group = "clicks"; |
| 11 | shell = pkgs.bashInteractive; |
Skyler Grey | a78aa67 | 2023-05-20 13:48:18 +0200 | [diff] [blame^] | 12 | } // ( |
| 13 | if builtins.pathExists "${../services}/${username}/system.nix" |
| 14 | then import "${../services}/${username}/system.nix" |
| 15 | else { } |
| 16 | ); |
Skyler Grey | 245a88f | 2023-05-01 21:35:57 +0000 | [diff] [blame] | 17 | in |
| 18 | { |
| 19 | imports = [ |
| 20 | (builtins.fetchurl { |
| 21 | url = "https://gist.githubusercontent.com/graham33/fdbdcc18317a621d9dd54beb36be6683/raw/776ed252749313470f1c9a286a0419ba9746d133/loginctl-linger.nix"; |
| 22 | sha256 = "sha256:0hwm4f13dwd27gbdn5ddvbrmcvfb70jr658jz4nbkzwzh8c02qj8"; |
| 23 | }) |
| 24 | ]; |
| 25 | |
| 26 | users.users = lib.pipe ../services [ |
| 27 | builtins.readDir |
| 28 | (lib.filterAttrs (_name: value: value == "directory")) |
| 29 | builtins.attrNames |
| 30 | (map (name: { inherit name; value = mkUser name; })) |
| 31 | builtins.listToAttrs |
| 32 | ]; |
Skyler Grey | a78aa67 | 2023-05-20 13:48:18 +0200 | [diff] [blame^] | 33 | } // ( |
| 34 | if (base != null) |
| 35 | then { |
| 36 | /* users.groups = lib.mapAttrs' |
| 37 | (_: user: { |
| 38 | name = user.group; |
| 39 | value = { }; |
| 40 | }) |
| 41 | base.config.users.users;*/ |
| 42 | } else { } |
| 43 | ) |