nixosConfiguration with infinite recursion
This commit is contained in:
parent
84723105f3
commit
a39bad4f85
36
flake.nix
36
flake.nix
|
@ -11,6 +11,15 @@
|
|||
system = "x86_64-linux";
|
||||
systems = [ system ];
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
|
||||
nixosConfig = name:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [ self.nixosModule ];
|
||||
extraModules = [ ({ ... }: {
|
||||
networking.hostName = name;
|
||||
}) ];
|
||||
};
|
||||
in
|
||||
rec {
|
||||
lib =
|
||||
|
@ -27,19 +36,20 @@
|
|||
imports = [ ./nix/nixos-module ];
|
||||
};
|
||||
|
||||
nixosConfigurations.test_vm =
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [ nixosModule ];
|
||||
extraModules = [ ({ ... }: {
|
||||
networking.hostName = "test_vm";
|
||||
}) ];
|
||||
};
|
||||
nixosConfigurations =
|
||||
builtins.mapAttrs (hostName: _: nixosConfig hostName) (
|
||||
nixpkgs.lib.filterAttrs (_: { role, ... }:
|
||||
builtins.elem role [ "server" "container" ]
|
||||
) lib.config.site.hosts
|
||||
);
|
||||
|
||||
nixosConfigurations.server1 =
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [];
|
||||
};
|
||||
# nixosConfigurations.test_vm =
|
||||
# nixpkgs.lib.nixosSystem {
|
||||
# inherit system;
|
||||
# modules = [ nixosModule ];
|
||||
# extraModules = [ ({ ... }: {
|
||||
# networking.hostName = "test_vm";
|
||||
# }) ];
|
||||
# };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,12 +9,15 @@ let
|
|||
inherit self pkgs;
|
||||
};
|
||||
modules = [
|
||||
./options.nix
|
||||
./legacy.nix
|
||||
(
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.warnings = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
internal = true;
|
||||
};
|
||||
options.gpgKey = mkOption {
|
||||
type = with types; nullOr path;
|
||||
};
|
||||
|
@ -23,6 +26,8 @@ let
|
|||
};
|
||||
}
|
||||
)
|
||||
./options.nix
|
||||
./legacy.nix
|
||||
];
|
||||
};
|
||||
in
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, ... }:
|
||||
{ config, options, lib, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
|
@ -48,12 +48,6 @@ let
|
|||
};
|
||||
in
|
||||
{
|
||||
options.warnings = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
internal = true;
|
||||
};
|
||||
|
||||
options.site = {
|
||||
net = mkOption {
|
||||
default = {};
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
{ config, lib, ... }:
|
||||
{ self, config, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (config.networking) hostName;
|
||||
inherit (lib) optional;
|
||||
|
||||
hostConfig = config.site.hosts.${hostName};
|
||||
hostConfig = self.lib.config.site.hosts.${hostName};
|
||||
in
|
||||
{
|
||||
builtins.trace (lib.generators.toPretty {} self.lib.config) {
|
||||
imports = [
|
||||
#{ config = self.lib.config; }
|
||||
./defaults.nix
|
||||
]
|
||||
++ optional (hostConfig.role == "server") [
|
||||
./lxc-containers.nix
|
||||
]
|
||||
++ optional (hostConfig.role == "container") [
|
||||
./container.nix
|
||||
../lib/config/options.nix
|
||||
];
|
||||
# ++ optional (hostConfig.role == "server") [
|
||||
# #./lxc-containers.nix
|
||||
# ]
|
||||
# ++ optional (hostConfig.role == "container") [
|
||||
# ./container.nix
|
||||
# ];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue