refactor3
This commit is contained in:
parent
b9e206af24
commit
f012a7d409
16661 changed files with 71 additions and 1480464 deletions
37
flake.nix
37
flake.nix
|
|
@ -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))
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue