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 @@ +_: { }