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 { nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = [ self.nixosModule ]; modules = [ self.nixosModule ];
extraModules = [ ({ ... }: { specialArgs.hostName = name;
networking.hostName = name;
}) ];
}; };
in in
{ {

View File

@ -1,20 +1,20 @@
{ config, lib, ... }: { hostName, config, lib, pkgs, ... }:
let let
inherit (config.networking) hostName; inherit (lib) optionals;
inherit (lib) optional;
hostConfig = lib.config.site.hosts.${hostName}; hostConfig = lib.config.site.hosts.${hostName};
in { in {
site = lib.config.site;
imports = [ imports = [
{ config = self.lib.config; }
./defaults.nix ./defaults.nix
../lib/config/options.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 = { nix = {
@ -9,4 +9,6 @@
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim tcpdump iputils mtr traceroute vim tcpdump iputils mtr traceroute
]; ];
networking.hostName = hostName;
} }