From 5570be9c9c64e0ba2474d73c2b6b23508b916fd6 Mon Sep 17 00:00:00 2001 From: Rosa Date: Sat, 10 Jan 2026 17:59:55 -0500 Subject: custom function for system creation --- flake.nix | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index f447b71..5e151b0 100644 --- a/flake.nix +++ b/flake.nix @@ -24,17 +24,37 @@ }: let pkgs = nixpkgs.legacyPackages.x86_64-linux; + mkSystem = + { + hostName, + system, + # Whether to create the default user account. This account will be + # in the wheel group, and has an empty default password! + makeDefaultUser ? true, + useHomeManager ? true, + additionalModules ? [ ], + }: + nixpkgs.lib.nixosSystem { + modules = [ + ./common/core.nix + ./hosts/${hostName} + ./modules # include custom system modules + { networking.hostName = hostName; } + ] + ++ nixpkgs.lib.optional makeDefaultUser ./user + ++ nixpkgs.lib.optional useHomeManager home-manager.nixosModules.home-manager + ++ nixpkgs.lib.optional useHomeManager ./user/home + ++ additionalModules; + + inherit system; + }; in { formatter.x86_64-linux = pkgs.nixfmt; nixosConfigurations = { - limbo = nixpkgs.lib.nixosSystem { - modules = [ - disko.nixosModules.disko - home-manager.nixosModules.home-manager - ./hosts/limbo - ]; - + limbo = mkSystem { + additionalModules = [ disko.nixosModules.disko ]; + hostName = "limbo"; system = "x86_64-linux"; }; }; -- cgit v1.3.1