From 0bf1f113f17d5e61137d70aaa389f9450e904181 Mon Sep 17 00:00:00 2001 From: TheWanderingCrow Date: Thu, 30 Jan 2025 17:31:06 -0500 Subject: [PATCH] reduce some more lines with custom mkSpecialArgs function --- flake.nix | 134 ++++++++++++++++++++++++------------------------------ 1 file changed, 59 insertions(+), 75 deletions(-) diff --git a/flake.nix b/flake.nix index fdf649e..4dbeeae 100644 --- a/flake.nix +++ b/flake.nix @@ -15,116 +15,100 @@ home-manager, sops-nix, ... - } @ inputs: let + } @ inputs: let baseModules = [ - home-manager.nixosModules.home-manager - sops-nix.nixosModules.sops + home-manager.nixosModules.home-manager + sops-nix.nixosModules.sops ]; + + mkSpecialArgs = system: { + inherit inputs; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + }; in { nixosConfigurations = { ################### # Primary Desktop # ################### Parzival = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - pkgs = import nixpkgs { - system = "x86_64-linux"; - config.allowUnfree = true; - }; - }; - modules = [ - ./hosts/Parzival - ] ++ baseModules; + specialArgs = mkSpecialArgs "x86_64-linux"; + modules = + [ + ./hosts/Parzival + ] + ++ baseModules; }; ################### # Personal Laptop # ################### Parzival-Mobile = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - pkgs = import nixpkgs { - system = "x86_64-linux"; - config.allowUnfree = true; - }; - }; - modules = [ - ./hosts/Parzival-Mobile - ] ++ baseModules; + specialArgs = mkSpecialArgs "x86_64-linux"; + modules = + [ + ./hosts/Parzival-Mobile + ] + ++ baseModules; }; ###################### # Work Issued Laptop # ###################### Parzival-Framework = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - pkgs = import nixpkgs { - system = "x86_64-linux"; - config.allowUnfree = true; - }; - }; - modules = [ - ./hosts/Parzival-Framework - ] ++ baseModules; + specialArgs = mkSpecialArgs "x86_64-linux"; + modules = + [ + ./hosts/Parzival-Framework + ] + ++ baseModules; }; ############### # Home Server # ############### WCE-Overseer = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - pkgs = import nixpkgs { - system = "x86_64-linux"; - config.allowUnfree = true; - }; - }; - modules = [ - ./hosts/WCE-Overseer - ] ++ baseModules; + specialArgs = mkSpecialArgs "x86_64-linux"; + modules = + [ + ./hosts/WCE-Overseer + ] + ++ baseModules; }; ################################### # ISO Installer w/ recovery tools # ################################### Parzival-Live = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - pkgs = import nixpkgs { - system = "x86_64-linux"; - config.allowUnfree = true; - }; - }; - modules = [ - ./hosts/Parzival-Live - ] ++ baseModules; + specialArgs = mkSpecialArgs "x86_64-linux"; + modules = + [ + ./hosts/Parzival-Live + ] + ++ baseModules; }; ######################### # DO Nebula Lighthouse1 # ######################### WCE-Lighthouse1 = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - pkgs = import nixpkgs { - system = "x86_64-linux"; - config.allowUnfree = true; - }; - }; - modules = [ - ./hosts/WCE-Lighthouse - { - networking.hostName = "WCE-Lighthouse1"; - networking.useDHCP = nixpkgs.lib.mkForce false; + specialArgs = mkSpecialArgs "x86_64-linux"; + modules = + [ + ./hosts/WCE-Lighthouse + { + networking.hostName = "WCE-Lighthouse1"; + networking.useDHCP = nixpkgs.lib.mkForce false; - services.cloud-init = { - enable = true; - network.enable = true; + services.cloud-init = { + enable = true; + network.enable = true; - # not strictly needed, just for good measure - datasource_list = ["DigitalOcean"]; - datasource.DigitalOcean = {}; - sops.defaultSopsFile = inputs.nix-secrets.secrets.lighthouse1; - }; - } - ] ++ baseModules; + # not strictly needed, just for good measure + datasource_list = ["DigitalOcean"]; + datasource.DigitalOcean = {}; + sops.defaultSopsFile = inputs.nix-secrets.secrets.lighthouse1; + }; + } + ] + ++ baseModules; }; }; };