From 2f407dd8e502c27e4e5afdb8159cd2a6a54b7e55 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Wed, 7 Apr 2021 13:13:54 -0400 Subject: [PATCH] Generalize --- flake.nix | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/flake.nix b/flake.nix index 842e067..cd018b0 100644 --- a/flake.nix +++ b/flake.nix @@ -6,24 +6,29 @@ home-manager.url = "github:nix-community/home-manager"; }; - outputs = { self, home-manager, nixpkgs }: { - nixosConfigurations.p71 = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - # System configuration - ./p71/configuration.nix - ./modules/passwordstore.nix - ./modules/protonmail-bridge.nix - ./modules/monitor-brightness.nix + outputs = { self, home-manager, nixpkgs }: + let + # Make configuration for any computer I use in my home office. + mkHomeMachine = configurationNix: nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + # System configuration + configurationNix + ./modules/passwordstore.nix + ./modules/protonmail-bridge.nix + ./modules/monitor-brightness.nix - # home-manager configuration - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.srid = import ./home.nix; - } - ]; + # home-manager configuration + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.srid = import ./home.nix; + } + ]; + }; + in { + nixosConfigurations.p71 = mkHomeMachine ./p71/configuration.nix; + nixosConfigurations.x1c7 = mkHomeMachine ./x1c7/configuration.nix; }; - }; }