Simplify host imports

This commit is contained in:
SebastianStork 2025-10-11 21:40:42 +02:00
parent 7a250a2ea8
commit de18f587c7
11 changed files with 50 additions and 50 deletions

View file

@ -9,28 +9,13 @@ let
hostName: hostName:
inputs.nixpkgs.lib.nixosSystem { inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs self; }; specialArgs = { inherit inputs self; };
modules = modules = [
let
hostFiles =
"${self}/hosts/${hostName}"
|> lib.filesystem.listFilesRecursive
|> lib.filter (lib.hasSuffix ".nix");
userFiles =
"${self}/users"
|> builtins.readDir
|> lib.filterAttrs (_: type: type == "directory")
|> lib.attrNames
|> map (user: "${self}/users/${user}/@${hostName}/default.nix")
|> lib.filter (path: lib.pathExists path);
in
[
{ networking = { inherit hostName; }; } { networking = { inherit hostName; }; }
"${self}/hosts/common.nix" "${self}/hosts/common.nix"
"${self}/users/seb/default.nix" "${self}/hosts/${hostName}"
"${self}/users/seb"
] ]
++ hostFiles ++ lib.optional (lib.pathExists "${self}/users/seb/@${hostName}") "${self}/users/seb/@${hostName}";
++ userFiles;
}; };
mkDeployNode = hostname: { mkDeployNode = hostname: {

View file

@ -1,5 +1,11 @@
{ pkgs, ... }: { inputs, pkgs, ... }:
{ {
imports = [
./hardware.nix
./disko.nix
inputs.disko.nixosModules.default
];
system.stateVersion = "23.11"; system.stateVersion = "23.11";
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;

View file

@ -1,7 +1,4 @@
{ inputs, ... }: _: {
{
imports = [ inputs.disko.nixosModules.default ];
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
hardware = { hardware = {

View file

@ -1,5 +1,11 @@
{ pkgs, ... }: { inputs, pkgs, ... }:
{ {
imports = [
./hardware.nix
./disko.nix
inputs.disko.nixosModules.default
];
system.stateVersion = "24.11"; system.stateVersion = "24.11";
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;

View file

@ -1,9 +1,6 @@
{ inputs, ... }: { inputs, ... }:
{ {
imports = [ imports = [ inputs.nixos-hardware.nixosModules.framework-13-7040-amd ];
inputs.disko.nixosModules.default
inputs.nixos-hardware.nixosModules.framework-13-7040-amd
];
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";

View file

@ -1,5 +1,11 @@
{ config, ... }: { config, inputs, ... }:
{ {
imports = [
./hardware.nix
./disko.nix
inputs.disko.nixosModules.default
];
system.stateVersion = "25.05"; system.stateVersion = "25.05";
meta = { meta = {

View file

@ -1,9 +1,6 @@
{ modulesPath, inputs, ... }: { modulesPath, ... }:
{ {
imports = [ imports = [ "${modulesPath}/profiles/qemu-guest.nix" ];
inputs.disko.nixosModules.default
"${modulesPath}/profiles/qemu-guest.nix"
];
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";

View file

@ -1,5 +1,11 @@
{ config, ... }: { config, inputs, ... }:
{ {
imports = [
./hardware.nix
./disko.nix
inputs.disko.nixosModules.default
];
system.stateVersion = "25.05"; system.stateVersion = "25.05";
meta = { meta = {

View file

@ -1,9 +1,6 @@
{ modulesPath, inputs, ... }: { modulesPath, ... }:
{ {
imports = [ imports = [ "${modulesPath}/profiles/qemu-guest.nix" ];
inputs.disko.nixosModules.default
"${modulesPath}/profiles/qemu-guest.nix"
];
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";

View file

@ -1,5 +1,11 @@
{ config, ... }: { config, inputs, ... }:
{ {
imports = [
./hardware.nix
./disko.nix
inputs.disko.nixosModules.default
];
system.stateVersion = "25.05"; system.stateVersion = "25.05";
meta = { meta = {

View file

@ -1,9 +1,6 @@
{ modulesPath, inputs, ... }: { modulesPath, ... }:
{ {
imports = [ imports = [ "${modulesPath}/profiles/qemu-guest.nix" ];
inputs.disko.nixosModules.default
"${modulesPath}/profiles/qemu-guest.nix"
];
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";