mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 15:29:07 +01:00
Pass allHosts as a special arg to the host configs
This commit is contained in:
parent
cb4c268550
commit
f27479b861
7 changed files with 16 additions and 11 deletions
|
|
@ -8,7 +8,10 @@ let
|
||||||
mkHost =
|
mkHost =
|
||||||
hostDir:
|
hostDir:
|
||||||
inputs.nixpkgs.lib.nixosSystem {
|
inputs.nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = { inherit inputs self; };
|
specialArgs = {
|
||||||
|
inherit inputs self;
|
||||||
|
inherit (self) allHosts;
|
||||||
|
};
|
||||||
modules =
|
modules =
|
||||||
(lib.singleton {
|
(lib.singleton {
|
||||||
networking.hostName = hostDir |> lib.baseNameOf |> lib.unsafeDiscardStringContext;
|
networking.hostName = hostDir |> lib.baseNameOf |> lib.unsafeDiscardStringContext;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
self,
|
|
||||||
lib,
|
lib,
|
||||||
|
allHosts,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -18,7 +18,7 @@ in
|
||||||
nodes = lib.mkOption {
|
nodes = lib.mkOption {
|
||||||
type = lib.types.anything;
|
type = lib.types.anything;
|
||||||
default =
|
default =
|
||||||
self.allHosts
|
allHosts
|
||||||
|> lib.attrValues
|
|> lib.attrValues
|
||||||
|> lib.map (host: host.config.custom.networking)
|
|> lib.map (host: host.config.custom.networking)
|
||||||
|> lib.map (
|
|> lib.map (
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
self,
|
|
||||||
lib,
|
lib,
|
||||||
|
allHosts,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -57,7 +57,7 @@ in
|
||||||
dnsServers = lib.mkOption {
|
dnsServers = lib.mkOption {
|
||||||
type = lib.types.anything;
|
type = lib.types.anything;
|
||||||
default =
|
default =
|
||||||
self.allHosts
|
allHosts
|
||||||
|> lib.attrValues
|
|> lib.attrValues
|
||||||
|> lib.filter (host: host.config.custom.services.dns.enable)
|
|> lib.filter (host: host.config.custom.services.dns.enable)
|
||||||
|> lib.map (host: host.config.custom.networking.overlay.address);
|
|> lib.map (host: host.config.custom.networking.overlay.address);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
config,
|
config,
|
||||||
self,
|
self,
|
||||||
lib,
|
lib,
|
||||||
|
allHosts,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -27,7 +28,7 @@ in
|
||||||
netCfg.nodes
|
netCfg.nodes
|
||||||
|> lib.map (node: "\"${node.hostName}.${node.overlay.domain}. A ${node.overlay.address}\"");
|
|> lib.map (node: "\"${node.hostName}.${node.overlay.domain}. A ${node.overlay.address}\"");
|
||||||
serviceRecords =
|
serviceRecords =
|
||||||
self.allHosts
|
allHosts
|
||||||
|> lib.attrValues
|
|> lib.attrValues
|
||||||
|> lib.concatMap (
|
|> lib.concatMap (
|
||||||
host:
|
host:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
self,
|
|
||||||
lib,
|
lib,
|
||||||
|
allHosts,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -41,7 +41,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.seb.openssh.authorizedKeys.keyFiles =
|
users.users.seb.openssh.authorizedKeys.keyFiles =
|
||||||
self.allHosts
|
allHosts
|
||||||
|> lib.attrValues
|
|> lib.attrValues
|
||||||
|> lib.filter (host: host.config.networking.hostName != netCfg.hostName)
|
|> lib.filter (host: host.config.networking.hostName != netCfg.hostName)
|
||||||
|> lib.filter (host: host.config |> lib.hasAttr "home-manager")
|
|> lib.filter (host: host.config |> lib.hasAttr "home-manager")
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
config,
|
config,
|
||||||
self,
|
self,
|
||||||
lib,
|
lib,
|
||||||
|
allHosts,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -87,7 +88,7 @@ in
|
||||||
settings =
|
settings =
|
||||||
let
|
let
|
||||||
hosts =
|
hosts =
|
||||||
self.allHosts
|
allHosts
|
||||||
|> lib.filterAttrs (_: host: host.config.networking.hostName != config.networking.hostName)
|
|> lib.filterAttrs (_: host: host.config.networking.hostName != config.networking.hostName)
|
||||||
|> lib.filterAttrs (_: host: host.config.custom.services.syncthing.enable);
|
|> lib.filterAttrs (_: host: host.config.custom.services.syncthing.enable);
|
||||||
in
|
in
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
self,
|
|
||||||
lib,
|
lib,
|
||||||
|
allHosts,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -173,7 +173,7 @@ in
|
||||||
web-services.gatus.endpoints =
|
web-services.gatus.endpoints =
|
||||||
let
|
let
|
||||||
defaultEndpoints =
|
defaultEndpoints =
|
||||||
self.allHosts
|
allHosts
|
||||||
|> lib.mapAttrs (
|
|> lib.mapAttrs (
|
||||||
_: host:
|
_: host:
|
||||||
host.config.custom.services.caddy.virtualHosts |> lib.attrValues |> lib.map (vHost: vHost.domain)
|
host.config.custom.services.caddy.virtualHosts |> lib.attrValues |> lib.map (vHost: vHost.domain)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue