From b480e8224d20e43e96ed14c2d0032aab99546d61 Mon Sep 17 00:00:00 2001 From: aaron Date: Sat, 21 Mar 2026 16:41:34 +0100 Subject: [PATCH] refactor(flake): simplify nix flake by deduplication --- flake.nix | 78 +++++++++++++++++-------------------------------------- 1 file changed, 24 insertions(+), 54 deletions(-) diff --git a/flake.nix b/flake.nix index 9683f2f..be2e4a0 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { description = "0x29a NixOS flake"; - + inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { @@ -16,60 +16,30 @@ inputs.nixpkgs.follows = "nixpkgs"; }; }; - - outputs = { self, nixpkgs, home-manager, nixvim, ... }@inputs: { + + outputs = { self, nixpkgs, home-manager, nixvim, ... }@inputs: + let + mkHost = hostName: nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/${hostName}/hardware-configuration.nix + ./hosts/${hostName}/configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.users.aaron.imports = [ + nixvim.homeModules.nixvim + ./users/aaron/home.nix + ]; + } + ]; + }; + in { nixosConfigurations = { - - default = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/default/hardware-configuration.nix - ./hosts/default/configuration.nix - home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = { inherit inputs; }; - home-manager.users.aaron.imports = [ - nixvim.homeModules.nixvim - ./users/aaron/home.nix - ]; - } - ]; - }; - - neon = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/neon/hardware-configuration.nix - ./hosts/neon/configuration.nix - home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = { inherit inputs; }; - home-manager.users.aaron.imports = [ - nixvim.homeModules.nixvim - ./users/aaron/home.nix - ]; - } - ]; - }; - - argon = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/argon/hardware-configuration.nix - ./hosts/argon/configuration.nix - home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = { inherit inputs; }; - home-manager.users.aaron.imports = [ - nixvim.homeModules.nixvim - ./users/aaron/home.nix - ]; - } - ]; - }; + default = mkHost "default"; + neon = mkHost "neon"; + argon = mkHost "argon"; }; }; }