nix: fix infinite recursion by passing hostName as module arg

This commit is contained in:
Astro 2021-03-22 22:38:15 +01:00
parent 0a5ebd7f49
commit c04ca49755
3 changed files with 14 additions and 14 deletions

View File

@ -16,9 +16,7 @@
nixpkgs.lib.nixosSystem {
inherit system;
modules = [ self.nixosModule ];
extraModules = [ ({ ... }: {
networking.hostName = name;
}) ];
specialArgs.hostName = name;
};
in
{

View File

@ -1,20 +1,20 @@
{ config, lib, ... }:
{ hostName, config, lib, pkgs, ... }:
let
inherit (config.networking) hostName;
inherit (lib) optional;
inherit (lib) optionals;
hostConfig = lib.config.site.hosts.${hostName};
in {
site = lib.config.site;
imports = [
{ config = self.lib.config; }
./defaults.nix
../lib/config/options.nix
]
++ optionals (hostConfig.role == "server") [
#./lxc-containers.nix
]
++ optionals (hostConfig.role == "container") [
./container.nix
];
# ++ optional (hostConfig.role == "server") [
# #./lxc-containers.nix
# ]
# ++ optional (hostConfig.role == "container") [
# ./container.nix
# ];
}

View File

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ hostName, pkgs, ... }:
{
nix = {
@ -9,4 +9,6 @@
environment.systemPackages = with pkgs; [
vim tcpdump iputils mtr traceroute
];
networking.hostName = hostName;
}