refactor3

This commit is contained in:
Lilith 2025-03-12 16:43:45 +01:00
parent b9e206af24
commit f012a7d409
Signed by: lilith
GPG key ID: 8712A0F317C37175
16661 changed files with 71 additions and 1480464 deletions

View file

@ -52,31 +52,34 @@
} @ inputs: let
inherit (nixpkgs) lib;
defaultConfig = {
desktop = true;
unfree = [
"steam"
"steam-unwrapped"
];
systemFromHardwareConf = {
hostname:
let
hardware = import ./hosts/${hostname}/hardware-configuration.nix;
args = builtins.functionArgs hardware // { lib.mkdefault = lib.id; };
in
(hardware args).nixpkgs.hostPlatform;
};
makeHost = host: let
conf = defaultConfig // import ./hosts/${host}/config.nix;
in
importNixpks = system: nixpkgs:
let
config.allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) (import ./unfree.nix).allowed;
in
import nixpkgs { inherit system config; };
makeHost = host: system:
lib.nixosSystem {
system = conf.system;
pkgs = import nixpkgs {
system = conf.system;
config.allowUnfreePredicate = ( pkg: builtins.elem (lib.getName pkg) conf.unfree );
};
system = system;
pkgs = importNixpkgs system nixpkgs;
specialArgs = inputs;
modules = [
./hosts/${host}/default.nix
./hosts/${host}/hardware-configuration.nix
./system
{networking.hostName = host;}
]
++ lib.optionals conf.desktop [
./home
];
};
@ -85,7 +88,7 @@
builtins.readDir
(lib.filterAttrs (_: type: type == "directory"))
# (lib.filterAttrs (name: _: builtins.pathExists ./hosts/${name}/default.nix && builtins.pathExists ./hosts/${name}/hardware.nix && builtins.pathExists ./hosts/${name}/config.nix))
(lib.mapAttrs (name: _: makeHost name))
(builtins.mapAttrs (name: _: makeHost name (systemFromHardwareConf name))
];
};
}