mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 20:39:18 -08:00
Using ./home.nix and ./nixos.nix as entrypoints for hosts. Using hardware profiles. Using new entrypoints (profiles/base/profiles.nix + profiles/base/home.nix). New modules (for DNS handling, for themeing, ...). Split up deploy-tf.nix into several modules. Renamed common profile to base profile.
67 lines
1.6 KiB
Nix
67 lines
1.6 KiB
Nix
{ pkgs, sources, users, profiles, hardware, lib, config, ... }:
|
|
|
|
/*
|
|
This module:
|
|
* Makes hosts nixosModules.
|
|
* Manages module imports and specialArgs.
|
|
* Builds network.nodes.
|
|
*/
|
|
|
|
with lib;
|
|
|
|
{
|
|
options.network = {
|
|
nixos = {
|
|
extraModules = mkOption {
|
|
type = types.listOf types.unspecified;
|
|
default = [ ];
|
|
};
|
|
specialArgs = mkOption {
|
|
type = types.attrsOf types.unspecified;
|
|
default = { };
|
|
};
|
|
modulesPath = mkOption {
|
|
type = types.path;
|
|
default = toString (pkgs.path + "/nixos/modules");
|
|
};
|
|
};
|
|
nodes = let
|
|
nixosModule = { name, config, meta, modulesPath, lib, ... }: with lib; {
|
|
config = {
|
|
nixpkgs = {
|
|
system = mkDefault pkgs.system;
|
|
pkgs = mkDefault pkgs;
|
|
};
|
|
};
|
|
};
|
|
nixosType = let
|
|
baseModules = import (config.network.nixos.modulesPath + "/module-list.nix");
|
|
in types.submoduleWith {
|
|
modules = baseModules
|
|
++ singleton nixosModule
|
|
++ config.network.nixos.extraModules;
|
|
|
|
specialArgs = {
|
|
inherit baseModules;
|
|
inherit (config.network.nixos) modulesPath;
|
|
} // config.network.nixos.specialArgs;
|
|
};
|
|
in mkOption {
|
|
type = types.attrsOf nixosType;
|
|
default = { };
|
|
};
|
|
};
|
|
config.network = {
|
|
nixos = {
|
|
extraModules = [
|
|
"${toString sources.home-manager}/nixos"
|
|
../../modules/nixos
|
|
];
|
|
specialArgs = {
|
|
inherit (config.network) nodes;
|
|
inherit sources profiles users;
|
|
meta = config;
|
|
};
|
|
};
|
|
};
|
|
}
|