From efc6f86ddd287f5ddaffda82141273cc9ebfdba3 Mon Sep 17 00:00:00 2001 From: thiloho <123883702+thiloho@users.noreply.github.com> Date: Tue, 27 Jun 2023 17:52:44 +0200 Subject: [PATCH] Avoid duplication in flake code --- flake.nix | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/flake.nix b/flake.nix index 6302e6c..3e237ef 100644 --- a/flake.nix +++ b/flake.nix @@ -8,24 +8,11 @@ }; outputs = { nixpkgs, home-manager, ... }: { - nixosConfigurations = { - pc = nixpkgs.lib.nixosSystem { + nixosConfigurations = let + mkSystem = entrypoint: nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - ./nixos-configurations/pc - home-manager.nixosModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - }; - } - ]; - }; - laptop = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./nixos-configurations/laptop + entrypoint home-manager.nixosModules.home-manager { home-manager = { @@ -35,6 +22,9 @@ } ]; }; + in { + pc = mkSystem ./nixos-configurations/pc; + laptop = mkSystem ./nixos-configurations/laptop; }; }; }