mirror of
				https://github.com/Jokiller230/puzzlevision.git
				synced 2025-10-31 13:50:04 +00:00 
			
		
		
		
	✨ Run nixfmt-rfc-style on repository and add it to Zed config
This commit is contained in:
		
							parent
							
								
									f5e5adb2fd
								
							
						
					
					
						commit
						45494079c5
					
				
					 41 changed files with 441 additions and 240 deletions
				
			
		|  | @ -3,12 +3,14 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.archetypes.laptop; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.archetypes.laptop = { | ||||
|     enable = mkEnableOption "the laptop archetype."; | ||||
|   }; | ||||
|  |  | |||
|  | @ -3,12 +3,14 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.archetypes.server; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.archetypes.server = { | ||||
|     enable = mkEnableOption "the server archetype for your current system"; | ||||
|   }; | ||||
|  |  | |||
|  | @ -4,12 +4,14 @@ | |||
|   pkgs, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf mkDefault; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.archetypes.workstation; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.archetypes.workstation = { | ||||
|     enable = mkEnableOption "the workstation archetype."; | ||||
|   }; | ||||
|  |  | |||
|  | @ -4,12 +4,14 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.desktop.gnome; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.desktop.gnome = { | ||||
|     enable = mkEnableOption "the gnome desktop environment"; | ||||
|   }; | ||||
|  |  | |||
|  | @ -3,18 +3,22 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf types; | ||||
|   inherit (self) namespace; | ||||
|   inherit (self.lib) mkOpt; | ||||
| 
 | ||||
|   cfg = config.${namespace}.services.atticd; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.services.atticd = { | ||||
|     enable = mkEnableOption "the attic service, a multi-tenant nix binary cache."; | ||||
|     sopsFile = mkOpt types.path null "The location of the sops secret file for the Atticd service."; | ||||
|     sopsFormat = mkOpt types.str null "The format of the sops secret file for the Atticd service."; | ||||
|     subdomain = mkOpt types.str "cache" "The subdomain, of the system domain, the service should be exposed on."; | ||||
|     subdomain = | ||||
|       mkOpt types.str "cache" | ||||
|         "The subdomain, of the system domain, the service should be exposed on."; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|  | @ -30,7 +34,7 @@ in { | |||
| 
 | ||||
|       settings = { | ||||
|         listen = "[::]:3900"; | ||||
|         jwt = {}; | ||||
|         jwt = { }; | ||||
| 
 | ||||
|         chunking = { | ||||
|           nar-size-threshold = 64 * 1024; # 64 KiB | ||||
|  | @ -50,9 +54,9 @@ in { | |||
| 
 | ||||
|     services.traefik.dynamicConfigOptions = { | ||||
|       http = { | ||||
|         services.atticd.loadBalancer.servers = [{url = "http://localhost:3900";}]; | ||||
|         services.atticd.loadBalancer.servers = [ { url = "http://localhost:3900"; } ]; | ||||
|         routers.atticd = { | ||||
|           entryPoints = ["websecure"]; | ||||
|           entryPoints = [ "websecure" ]; | ||||
|           service = "atticd"; | ||||
|           rule = "Host(`${cfg.subdomain}.${config.${namespace}.services.domain}`)"; | ||||
|         }; | ||||
|  |  | |||
|  | @ -2,13 +2,17 @@ | |||
|   lib, | ||||
|   self, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) types; | ||||
|   inherit (self) namespace; | ||||
|   inherit (self.lib) mkOpt; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.services = { | ||||
|     domain = mkOpt types.str "thevoid.cafe" "The main system domain, used for exposing services."; | ||||
|     mail = mkOpt types.str "system@thevoid.cafe" "The main system administration E-Mail, used for logs and services."; | ||||
|     mail = | ||||
|       mkOpt types.str "system@thevoid.cafe" | ||||
|         "The main system administration E-Mail, used for logs and services."; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -3,12 +3,14 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkIf mkEnableOption; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.services.docker; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.services.docker = { | ||||
|     enable = mkEnableOption "the docker service."; | ||||
|   }; | ||||
|  |  | |||
|  | @ -3,13 +3,15 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf types; | ||||
|   inherit (self) namespace; | ||||
|   inherit (self.lib) mkOpt; | ||||
| 
 | ||||
|   cfg = config.${namespace}.services.duckdns; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.services.duckdns = { | ||||
|     enable = mkEnableOption "DuckDNS, the dynamic dns service. Will periodically refresh your IP."; | ||||
|     sopsFile = mkOpt types.path null "The location of the sops secret file for the DuckDNS service."; | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| {...}: { | ||||
| { ... }: | ||||
| { | ||||
|   # Todo: rewrite as recursive operation, based on ${namespace}.users | ||||
|   system.userActivationScripts = { | ||||
|     removeConflictingHomeManagerBackups = { | ||||
|  |  | |||
|  | @ -3,17 +3,23 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf types; | ||||
|   inherit (self) namespace; | ||||
|   inherit (self.lib) mkOpt; | ||||
| 
 | ||||
|   cfg = config.${namespace}.services.homepage; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.services.homepage = { | ||||
|     enable = mkEnableOption "Homepage, an intuitive dashboard for your services."; | ||||
|     subdomain = mkOpt types.str "home" "The subdomain, of the system domain, the service should be exposed on."; | ||||
|     configDir = mkOpt types.path null "The config directory, which will be copied to the Homepage directory during compilation."; | ||||
|     subdomain = | ||||
|       mkOpt types.str "home" | ||||
|         "The subdomain, of the system domain, the service should be exposed on."; | ||||
|     configDir = | ||||
|       mkOpt types.path null | ||||
|         "The config directory, which will be copied to the Homepage directory during compilation."; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|  | @ -35,7 +41,9 @@ in { | |||
|       labels = { | ||||
|         "traefik.enable" = "true"; | ||||
|         "traefik.http.routers.homepage.entrypoints" = "websecure"; | ||||
|         "traefik.http.routers.homepage.rule" = "Host(`${cfg.subdomain}.${config.${namespace}.services.domain}`)"; | ||||
|         "traefik.http.routers.homepage.rule" = "Host(`${cfg.subdomain}.${ | ||||
|           config.${namespace}.services.domain | ||||
|         }`)"; | ||||
|         "traefik.http.services.homepage.loadbalancer.server.port" = "3000"; | ||||
|       }; | ||||
|       volumes = [ | ||||
|  | @ -48,7 +56,7 @@ in { | |||
|       environment = { | ||||
|         "HOMEPAGE_ALLOWED_HOSTS" = "${cfg.subdomain}.${config.${namespace}.services.domain}"; | ||||
|       }; | ||||
|       extraOptions = ["--network=proxy"]; | ||||
|       extraOptions = [ "--network=proxy" ]; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -3,13 +3,15 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf types; | ||||
|   inherit (self) namespace; | ||||
|   inherit (self.lib) mkOpt; | ||||
| 
 | ||||
|   cfg = config.${namespace}.services.traefik; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.services.traefik = { | ||||
|     enable = mkEnableOption "the Traefik service."; | ||||
|     sopsFile = mkOpt types.path null "The location of the sops secret file for the Traefik service."; | ||||
|  | @ -17,7 +19,11 @@ in { | |||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     networking.firewall.allowedTCPPorts = [80 8080 443]; # http, dashboard, https | ||||
|     networking.firewall.allowedTCPPorts = [ | ||||
|       80 | ||||
|       8080 | ||||
|       443 | ||||
|     ]; # http, dashboard, https | ||||
| 
 | ||||
|     sops.secrets."services/traefik" = { | ||||
|       sopsFile = cfg.sopsFile; | ||||
|  | @ -26,7 +32,7 @@ in { | |||
| 
 | ||||
|     systemd.services.traefik = { | ||||
|       serviceConfig = { | ||||
|         EnvironmentFile = [config.sops.secrets."services/traefik".path]; | ||||
|         EnvironmentFile = [ config.sops.secrets."services/traefik".path ]; | ||||
|       }; | ||||
|     }; | ||||
| 
 | ||||
|  | @ -84,11 +90,11 @@ in { | |||
|             domains = [ | ||||
|               { | ||||
|                 main = "thevoid.cafe"; | ||||
|                 sans = ["*.thevoid.cafe"]; | ||||
|                 sans = [ "*.thevoid.cafe" ]; | ||||
|               } | ||||
|               { | ||||
|                 main = "rhysbot.co.uk"; | ||||
|                 sans = ["*.rhysbot.co.uk"]; | ||||
|                 sans = [ "*.rhysbot.co.uk" ]; | ||||
|               } | ||||
|             ]; | ||||
|           }; | ||||
|  |  | |||
|  | @ -3,18 +3,24 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf types; | ||||
|   inherit (self) namespace; | ||||
|   inherit (self.lib) mkOpt; | ||||
| 
 | ||||
|   cfg = config.${namespace}.services.vaultwarden; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.services.vaultwarden = { | ||||
|     enable = mkEnableOption "Vaultwarden, a self-hostable password manager."; | ||||
|     sopsFile = mkOpt types.path null "The location of the sops secret file for the Vaultwarden service."; | ||||
|     sopsFile = | ||||
|       mkOpt types.path null | ||||
|         "The location of the sops secret file for the Vaultwarden service."; | ||||
|     sopsFormat = mkOpt types.str null "The format of the sops secret file for the Vaultwarden service."; | ||||
|     subdomain = mkOpt types.str "vault" "The subdomain, of the system domain, the service should be exposed on."; | ||||
|     subdomain = | ||||
|       mkOpt types.str "vault" | ||||
|         "The subdomain, of the system domain, the service should be exposed on."; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|  | @ -35,7 +41,9 @@ in { | |||
|       labels = { | ||||
|         "traefik.enable" = "true"; | ||||
|         "traefik.http.routers.vaultwarden.entrypoints" = "websecure"; | ||||
|         "traefik.http.routers.vaultwarden.rule" = "Host(`${cfg.subdomain}.${config.${namespace}.services.domain}`)"; | ||||
|         "traefik.http.routers.vaultwarden.rule" = "Host(`${cfg.subdomain}.${ | ||||
|           config.${namespace}.services.domain | ||||
|         }`)"; | ||||
|       }; | ||||
|       volumes = [ | ||||
|         "/var/lib/containers/vaultwarden/data:/data:rw" | ||||
|  | @ -43,7 +51,7 @@ in { | |||
|       environmentFiles = [ | ||||
|         config.sops.secrets."services/vaultwarden".path | ||||
|       ]; | ||||
|       extraOptions = ["--network=proxy"]; | ||||
|       extraOptions = [ "--network=proxy" ]; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -3,12 +3,14 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.system.audio; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.system.audio = { | ||||
|     enable = mkEnableOption "system audio support."; | ||||
|   }; | ||||
|  |  | |||
|  | @ -4,18 +4,20 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.system.bluetooth; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.system.bluetooth = { | ||||
|     enable = mkEnableOption "bluetooth support."; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     environment.systemPackages = with pkgs; [bluez]; | ||||
|     environment.systemPackages = with pkgs; [ bluez ]; | ||||
| 
 | ||||
|     hardware.bluetooth = { | ||||
|       enable = true; | ||||
|  |  | |||
|  | @ -4,12 +4,14 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf mkOption; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.system.fonts; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.system.fonts = with lib.types; { | ||||
|     enable = mkEnableOption "system font management"; | ||||
|     fonts = mkOption { | ||||
|  | @ -30,13 +32,16 @@ in { | |||
|         material-icons | ||||
|         material-design-icons | ||||
|       ]; | ||||
|       example = [noto-fonts noto-fonts-emoji]; | ||||
|       example = [ | ||||
|         noto-fonts | ||||
|         noto-fonts-emoji | ||||
|       ]; | ||||
|       description = "Install additional font packages"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     environment.systemPackages = with pkgs; [font-manager]; | ||||
|     environment.systemPackages = with pkgs; [ font-manager ]; | ||||
| 
 | ||||
|     fonts.packages = cfg.fonts; | ||||
|   }; | ||||
|  |  | |||
|  | @ -3,12 +3,14 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.system.grub; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.system.grub = { | ||||
|     enable = mkEnableOption "the grub bootloader."; | ||||
|   }; | ||||
|  | @ -18,7 +20,7 @@ in { | |||
| 
 | ||||
|     boot.loader.grub = { | ||||
|       enable = true; | ||||
|       devices = ["nodev"]; | ||||
|       devices = [ "nodev" ]; | ||||
|       efiInstallAsRemovable = true; | ||||
|       efiSupport = true; | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,16 +4,20 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf; | ||||
|   inherit (self) namespace; | ||||
|   inherit (self.lib) mkOpt; | ||||
| 
 | ||||
|   cfg = config.${namespace}.system.kernel; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.system.kernel = { | ||||
|     enable = mkEnableOption "Modify the standard kernel settings"; | ||||
|     version = mkOpt lib.types.str "linuxPackages_latest" "Set the kernel version to be used by your system"; | ||||
|     version = | ||||
|       mkOpt lib.types.str "linuxPackages_latest" | ||||
|         "Set the kernel version to be used by your system"; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|  |  | |||
|  | @ -3,12 +3,14 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf mkOption; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.system.locale; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.system.locale = { | ||||
|     enable = mkEnableOption "system locale tweaks."; | ||||
| 
 | ||||
|  |  | |||
|  | @ -3,12 +3,14 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf; | ||||
|   inherit (self) namespace; | ||||
| 
 | ||||
|   cfg = config.${namespace}.system.networking; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.system.networking = { | ||||
|     enable = mkEnableOption "networking."; | ||||
|   }; | ||||
|  |  | |||
|  | @ -4,18 +4,22 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf types; | ||||
|   inherit (self) namespace; | ||||
|   inherit (self.lib) mkOpt; | ||||
| 
 | ||||
|   cfg = config.${namespace}.system.nix; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.system.nix = { | ||||
|     enable = mkEnableOption "Nix configuration overrides."; | ||||
|     use-lix = mkEnableOption "Lix as an alternative to CppNix."; | ||||
|     use-nixld = mkEnableOption "the use of dynamically linked executables on nix based systems."; | ||||
|     trusted-users = mkOpt (types.listOf types.str) ["@wheel"] "List of trusted users for this NixOS system."; | ||||
|     trusted-users = mkOpt (types.listOf types.str) [ | ||||
|       "@wheel" | ||||
|     ] "List of trusted users for this NixOS system."; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|  | @ -23,7 +27,10 @@ in { | |||
|       settings = { | ||||
|         auto-optimise-store = true; | ||||
|         builders-use-substitutes = true; | ||||
|         experimental-features = ["nix-command" "flakes"]; | ||||
|         experimental-features = [ | ||||
|           "nix-command" | ||||
|           "flakes" | ||||
|         ]; | ||||
|         keep-derivations = true; | ||||
|         keep-outputs = true; | ||||
|         max-jobs = "auto"; | ||||
|  |  | |||
|  | @ -4,16 +4,18 @@ | |||
|   self, | ||||
|   config, | ||||
|   ... | ||||
| }: let | ||||
| }: | ||||
| let | ||||
|   inherit (lib) mkEnableOption mkIf types; | ||||
|   inherit (self) namespace; | ||||
|   inherit (self.lib) mkOpt; | ||||
| 
 | ||||
|   cfg = config.${namespace}.system.shell; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.system.shell = { | ||||
|     enable = mkEnableOption "custom user shells."; | ||||
|     installed = mkOpt (types.listOf types.package) [pkgs.fish] "List of shell packages to install"; | ||||
|     installed = mkOpt (types.listOf types.package) [ pkgs.fish ] "List of shell packages to install"; | ||||
|     default = mkOpt types.str "fish" "Set a custom shell as the default for all users."; | ||||
|   }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,8 +5,14 @@ | |||
|   config, | ||||
|   inputs, | ||||
|   ... | ||||
| }: let | ||||
|   inherit (lib) types mkEnableOption mkOption mkIf; | ||||
| }: | ||||
| let | ||||
|   inherit (lib) | ||||
|     types | ||||
|     mkEnableOption | ||||
|     mkOption | ||||
|     mkIf | ||||
|     ; | ||||
|   inherit (self) namespace; | ||||
|   inherit (self.lib) dirToModuleList; | ||||
| 
 | ||||
|  | @ -19,25 +25,38 @@ | |||
|       enable = mkEnableOption "this user."; | ||||
|       isNormalUser = self.lib.mkBool true "Whether this user is considered a normal user."; | ||||
|       isSystemUser = self.lib.mkBool false "Whether this user is considered a system user."; | ||||
|       initialPassword = self.lib.mkOpt (types.nullOr types.str) null "Plaintext insecure initial user password, only recommended for testing."; | ||||
|       password = self.lib.mkOpt (types.nullOr types.str) null "Plaintext insecure user password, only recommended for testing."; | ||||
|       hashedPasswordFile = self.lib.mkOpt (types.nullOr types.str) null "Secure, hashed user password stored in a separate file, recommended for production."; | ||||
|       hashedPassword = self.lib.mkOpt (types.nullOr types.str) null "Secure, hashed password, stored in plaintext, fine to use."; | ||||
|       extraGroups = self.lib.mkOpt (types.listOf types.str) [] "List of additional groups this user belongs to."; | ||||
|       initialPassword = | ||||
|         self.lib.mkOpt (types.nullOr types.str) null | ||||
|           "Plaintext insecure initial user password, only recommended for testing."; | ||||
|       password = | ||||
|         self.lib.mkOpt (types.nullOr types.str) null | ||||
|           "Plaintext insecure user password, only recommended for testing."; | ||||
|       hashedPasswordFile = | ||||
|         self.lib.mkOpt (types.nullOr types.str) null | ||||
|           "Secure, hashed user password stored in a separate file, recommended for production."; | ||||
|       hashedPassword = | ||||
|         self.lib.mkOpt (types.nullOr types.str) null | ||||
|           "Secure, hashed password, stored in plaintext, fine to use."; | ||||
|       extraGroups = | ||||
|         self.lib.mkOpt (types.listOf types.str) [ ] | ||||
|           "List of additional groups this user belongs to."; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   getHomeConfigPath = username: "${self.outPath}/homes/${system}/${username}"; | ||||
|   homeConfigExists = username: let | ||||
|     path = getHomeConfigPath username; | ||||
|   in | ||||
|   homeConfigExists = | ||||
|     username: | ||||
|     let | ||||
|       path = getHomeConfigPath username; | ||||
|     in | ||||
|     builtins.pathExists "${path}/default.nix"; | ||||
| 
 | ||||
|   homeModules = dirToModuleList "${self.outPath}/modules/home"; | ||||
| in { | ||||
| in | ||||
| { | ||||
|   options.${namespace}.users = mkOption { | ||||
|     type = types.attrsOf userSubmodule; | ||||
|     default = {}; | ||||
|     default = { }; | ||||
|     description = "List of users to create. Also handles home configurations, placed in self.outPath/homes/[x86_64-linux, aarch64-linux, etc...], through home-manager."; | ||||
|   }; | ||||
| 
 | ||||
|  | @ -47,12 +66,21 @@ in { | |||
| 
 | ||||
|     # Manage users declaratively and map userConfig to users.users by name; | ||||
|     users.mutableUsers = false; | ||||
|     users.users = lib.mapAttrs (username: userConfig: | ||||
|     users.users = lib.mapAttrs ( | ||||
|       username: userConfig: | ||||
|       mkIf userConfig.enable { | ||||
|         name = username; | ||||
|         inherit (userConfig) isNormalUser isSystemUser initialPassword hashedPasswordFile hashedPassword password extraGroups; | ||||
|       }) | ||||
|     cfg; | ||||
|         inherit (userConfig) | ||||
|           isNormalUser | ||||
|           isSystemUser | ||||
|           initialPassword | ||||
|           hashedPasswordFile | ||||
|           hashedPassword | ||||
|           password | ||||
|           extraGroups | ||||
|           ; | ||||
|       } | ||||
|     ) cfg; | ||||
| 
 | ||||
|     home-manager = { | ||||
|       useGlobalPkgs = true; | ||||
|  | @ -63,25 +91,24 @@ in { | |||
|         namespace = self.namespace; | ||||
|       }; | ||||
| 
 | ||||
|       users = | ||||
|         lib.mapAttrs ( | ||||
|           username: userConfig: | ||||
|             mkIf (userConfig.enable && homeConfigExists username) ( | ||||
|               {osConfig, ...}: { | ||||
|                 # Import user home configuration and general home modules | ||||
|                 imports = [ | ||||
|                   (getHomeConfigPath username) | ||||
|                   inputs.sops-nix.homeManagerModules.sops | ||||
|                   inputs.catppuccin.homeModules.default | ||||
|                   inputs.nixcord.homeModules.nixcord | ||||
|                   inputs.youtube-music.homeManagerModules.default | ||||
|                 ] ++ homeModules; | ||||
|       users = lib.mapAttrs ( | ||||
|         username: userConfig: | ||||
|         mkIf (userConfig.enable && homeConfigExists username) ( | ||||
|           { osConfig, ... }: | ||||
|           { | ||||
|             # Import user home configuration and general home modules | ||||
|             imports = [ | ||||
|               (getHomeConfigPath username) | ||||
|               inputs.sops-nix.homeManagerModules.sops | ||||
|               inputs.catppuccin.homeModules.default | ||||
|               inputs.nixcord.homeModules.nixcord | ||||
|               inputs.youtube-music.homeManagerModules.default | ||||
|             ] ++ homeModules; | ||||
| 
 | ||||
|                 home.stateVersion = lib.mkDefault osConfig.system.stateVersion; | ||||
|               } | ||||
|             ) | ||||
|             home.stateVersion = lib.mkDefault osConfig.system.stateVersion; | ||||
|           } | ||||
|         ) | ||||
|         cfg; | ||||
|       ) cfg; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue