diff --git a/flake.nix b/flake.nix index 756c28a..c09a0ac 100644 --- a/flake.nix +++ b/flake.nix @@ -17,11 +17,6 @@ lazyvim-nixvim.url = "github:azuwis/lazyvim-nixvim"; }; outputs = inputs@{ self, nixpkgs, home-manager, disko, nixos-generators, lazyvim-nixvim, ... }: { - nixosConfigurations = { - "nix-laptop1" = import ./hosts { - inherit inputs; - hostName = "nix-laptop1"; - }; - }; + nixosConfigurations = import ./hosts { inherit inputs; }; }; } diff --git a/hosts/default.nix b/hosts/default.nix index 419b55f..6e333a8 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,11 +1,10 @@ -{ inputs, hostName, system ? "x86_64-linux" }: +{ inputs }: let nixpkgs = inputs.nixpkgs; home-manager = inputs.home-manager; disko = inputs.disko; - - lib = nixpkgs.lib; + lib = nixpkgs.lib; commonModules = [ ../boot.nix @@ -20,9 +19,7 @@ let disko.devices = { disk.main = { type = "disk"; - device = lib.mkDefault "/dev/nvme0n1"; - content = { type = "gpt"; partitions = { @@ -44,9 +41,7 @@ let name = "swap"; label = "swap"; size = "34G"; - content = { - type = "swap"; - }; + content = { type = "swap"; }; }; root = { @@ -67,20 +62,33 @@ let }) ]; - # Map hostnames to their per-host module - hostModules = { - nix-laptop1 = ./nix-laptop1.nix; - }; + mkHost = { hostName, system ? "x86_64-linux", extraModules ? [ ] }: + lib.nixosSystem { + inherit system; + + specialArgs = { inherit inputs; }; + + modules = + commonModules + ++ extraModules + ++ [ + { networking.hostName = hostName; } + ]; + }; in -lib.nixosSystem { - inherit system; - - specialArgs = { inherit inputs; }; - - modules = - commonModules - ++ [ (hostModules.${hostName} or (throw "Unknown host '${hostName}' in hosts/default.nix")) ] - ++ [ - { networking.hostName = hostName; } +{ + nix-laptop1 = mkHost { + hostName = "nix-laptop1"; + system = "x86_64-linux"; + extraModules = [ + ./nix-laptop1.nix ]; + }; + + # future you: + # atlas = mkHost { + # hostName = "atlas"; + # system = "x86_64-linux"; + # extraModules = [ ./atlas-hardware.nix ./atlas-role-server.nix ]; + # }; } diff --git a/net.nix b/net.nix index bcd3e01..8831bf5 100644 --- a/net.nix +++ b/net.nix @@ -7,7 +7,4 @@ { # Enable networking networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "America/New_York"; }