From a65c4914b715b9cdebe1758bfe4ab57ccd7a8c59 Mon Sep 17 00:00:00 2001 From: Jan-Bulthuis Date: Fri, 24 Jan 2025 02:38:09 +0100 Subject: [PATCH] Moved user configuration to flake from machine --- flake.nix | 35 +++++++++++++++++++++-------------- machines/laptop.nix | 6 ------ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/flake.nix b/flake.nix index 3c5a921..4541140 100644 --- a/flake.nix +++ b/flake.nix @@ -25,24 +25,31 @@ ... }: let - baseModules = [ - home-manager.nixosModules.home-manager - { - home-manager.sharedModules = [ - stylix.homeManagerModules.stylix - nixvim.homeManagerModules.nixvim - nur.modules.homeManager.default + makeConfig = + machineConfig: userConfig: + (nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + machineConfig + home-manager.nixosModules.home-manager + { + machine.users = userConfig; + home-manager.sharedModules = [ + stylix.homeManagerModules.stylix + nixvim.homeManagerModules.nixvim + nur.modules.homeManager.default + ]; + } ]; - } - ]; + }); in { nixosConfigurations = { - "20212060" = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./machines/laptop.nix - ] ++ baseModules; + "20212060" = makeConfig ./machines/laptop.nix { + jan = { + sudo = true; + configuration = ./users/jan.nix; + }; }; }; }; diff --git a/machines/laptop.nix b/machines/laptop.nix index a68ef94..3b2d238 100644 --- a/machines/laptop.nix +++ b/machines/laptop.nix @@ -22,12 +22,6 @@ wpa_supplicant.enable = true; }; - # User accounts - machine.users.jan = { - sudo = true; - configuration = ../users/jan.nix; - }; - # Hardware configuration hardware.enableRedistributableFirmware = true; boot.initrd.availableKernelModules = [