formatting and comments
This commit is contained in:
parent
abb0c320e9
commit
86ae8197b5
1 changed files with 32 additions and 11 deletions
|
|
@ -115,17 +115,38 @@
|
||||||
httpPort = 80;
|
httpPort = 80;
|
||||||
httpsPort = 443;
|
httpsPort = 443;
|
||||||
};
|
};
|
||||||
} // (builtins.foldl'(prev: name: let
|
}
|
||||||
cfg = self.nixosConfigurations.${name}.config;
|
# zusätzlich zu den oben definierten wird hier noch ein redirect für jeden nginx virtualhost in diese flake generiert
|
||||||
in prev // {
|
// (builtins.foldl'
|
||||||
"${name}" = {
|
(
|
||||||
# dest = (builtins.head cfg.networking.interfaces.eth0.ipv4.addresses).address;
|
prev: name:
|
||||||
dest = (builtins.head cfg.networking.interfaces.${builtins.head (builtins.attrNames cfg.networking.interfaces)}.ipv4.addresses).address;
|
let
|
||||||
domain = builtins.head (builtins.attrNames cfg.services.nginx.virtualHosts);
|
cfg = self.nixosConfigurations.${name}.config;
|
||||||
httpsPort = 443;
|
in
|
||||||
httpPort = 80;
|
prev
|
||||||
};
|
// {
|
||||||
}) {} (builtins.filter (name: self.nixosConfigurations.${name}.config.services.nginx.enable)(builtins.attrNames self.nixosConfigurations)));
|
"${name}" = {
|
||||||
|
dest =
|
||||||
|
(builtins.head
|
||||||
|
# dieser ausdruck ermittelt den interface namen und die ipv4 addresse als redirect ziel
|
||||||
|
cfg.networking.interfaces.${builtins.head (builtins.attrNames cfg.networking.interfaces)}.ipv4.addresses
|
||||||
|
).address;
|
||||||
|
# bisher wird ein redirect für den ersten virtualHost generiert
|
||||||
|
# TODO rediret für jeden virtualHost
|
||||||
|
domain = builtins.head (builtins.attrNames cfg.services.nginx.virtualHosts);
|
||||||
|
httpsPort = 443;
|
||||||
|
httpPort = 80;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{ }
|
||||||
|
(
|
||||||
|
# alle nixosConfigurations auswählen, die nginx enabled haben
|
||||||
|
builtins.filter (name: self.nixosConfigurations.${name}.config.services.nginx.enable) (
|
||||||
|
builtins.attrNames self.nixosConfigurations
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
indexPage = pkgs.writeTextFile {
|
indexPage = pkgs.writeTextFile {
|
||||||
name = "index.html";
|
name = "index.html";
|
||||||
text = ''
|
text = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue