Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 1 | { inputs, system, pkgs, drive_paths, ... }: |
| 2 | let |
| 3 | inherit (inputs) self home-manager deploy-rs nixpkgs; |
Skyler Grey | adab78f | 2023-11-26 21:59:40 +0000 | [diff] [blame] | 4 | config = (self.nixosConfigurations.clicks.extendModules { modules = [ |
| 5 | ./hardware-configuration.nix |
| 6 | ./networking.nix |
| 7 | ]; }); |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 8 | deploy = { |
| 9 | sudo = "doas -u"; |
| 10 | profiles = { |
| 11 | system = { |
| 12 | user = "root"; |
| 13 | path = deploy-rs.lib.x86_64-linux.activate.nixos config; |
| 14 | }; |
| 15 | } // (let |
| 16 | mkServiceConfig = service: { |
| 17 | user = service; |
| 18 | |
| 19 | profilePath = "/nix/var/nix/profiles/per-user/${service}/home-manager"; |
| 20 | path = deploy-rs.lib.x86_64-linux.activate.home-manager |
| 21 | (home-manager.lib.homeManagerConfiguration { |
| 22 | inherit pkgs; |
| 23 | modules = [ |
| 24 | { |
| 25 | home.homeDirectory = "/services/${service}"; |
| 26 | home.username = service; |
| 27 | home.stateVersion = "22.11"; |
| 28 | programs.home-manager.enable = true; |
| 29 | } |
| 30 | "${../../services}/${service}" |
| 31 | ]; |
| 32 | extraSpecialArgs = { |
| 33 | inherit (inputs) nixpkgs-clicksforms; |
| 34 | inherit system drive_paths; |
| 35 | }; |
| 36 | }); |
| 37 | }; |
| 38 | in nixpkgs.lib.pipe ../../services [ |
| 39 | builtins.readDir |
| 40 | (nixpkgs.lib.filterAttrs (_name: value: value == "directory")) |
| 41 | builtins.attrNames |
| 42 | (map (name: { |
| 43 | inherit name; |
| 44 | value = mkServiceConfig name; |
| 45 | })) |
| 46 | builtins.listToAttrs |
| 47 | ]) // (let |
| 48 | mkBlankConfig = username: { |
| 49 | user = username; |
| 50 | |
| 51 | profilePath = "/nix/var/nix/profiles/per-user/${username}/home-manager"; |
| 52 | path = deploy-rs.lib.x86_64-linux.activate.home-manager |
| 53 | (home-manager.lib.homeManagerConfiguration { |
| 54 | inherit pkgs; |
| 55 | modules = [ |
| 56 | { |
| 57 | home.username = username; |
| 58 | home.stateVersion = "22.11"; |
| 59 | programs.home-manager.enable = true; |
| 60 | } |
| 61 | "${../../homes}/${username}" |
| 62 | ]; |
| 63 | }); |
| 64 | }; |
| 65 | in nixpkgs.lib.pipe ../../homes [ |
| 66 | builtins.readDir |
| 67 | (nixpkgs.lib.filterAttrs (_name: value: value == "directory")) |
| 68 | builtins.attrNames |
| 69 | (map (name: { |
| 70 | inherit name; |
| 71 | value = mkBlankConfig name; |
| 72 | })) |
| 73 | builtins.listToAttrs |
| 74 | ]); |
| 75 | hostname = "a1d1"; |
| 76 | profilesOrder = [ "system" ]; |
| 77 | }; |
| 78 | in { inherit deploy config; } |