From 57c4ac099e63b2735999fbabc8b641b95de01247 Mon Sep 17 00:00:00 2001 From: moons-14 Date: Thu, 28 May 2026 12:34:05 +0900 Subject: [PATCH] feat: add hosts and overlays module structure --- .gitignore | 2 ++ flake.nix | 4 +++- hosts/default.nix | 39 +++++++++++++++++++++++++++++++++++++++ overlays/default.nix | 1 + 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 hosts/default.nix create mode 100644 overlays/default.nix diff --git a/.gitignore b/.gitignore index 55c1d18..a9f0508 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,7 @@ !/flake.lock !shells/ +!hosts/ +!overlays/ !/flake/ diff --git a/flake.nix b/flake.nix index ec31423..9d2d8a4 100644 --- a/flake.nix +++ b/flake.nix @@ -95,9 +95,11 @@ systems = import systems; imports = [ + ./overlays + ./hosts + ./shells ./flake/formatter.nix ./flake/git-hooks.nix - ./shells ]; }; } diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..f2bcbc0 --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,39 @@ +{ + inputs, + config, + lib, + ... +}: +let + inherit (inputs.nixpkgs.lib) nixosSystem; + + mkSystem = + { + host, + system, + extraModules ? [ ], + ... + }: + assert lib.assertMsg (lib.elem system config.systems) + "mkSystem: system '${system}' not in valid systems: ${lib.generators.toPretty { } config.systems}"; + nixosSystem { + inherit system; + modules = [ + { + networking.hostName = lib.mkDefault host; + } + ] + ++ extraModules; + specialArgs = { inherit inputs; }; + }; +in +{ + flake.nixosConfigurations = { + nix-example = mkSystem { + host = "nix-example"; + system = "x86_64-linux"; + profile = "laptop"; + extraModules = [ ]; + }; + }; +} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..958608a --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1 @@ +_: { }