generate redirects for nginx virtualhosts automatically
This commit is contained in:
parent
99b1a87ad9
commit
abb0c320e9
1 changed files with 12 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
self,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
|
|
@ -114,7 +115,17 @@
|
|||
httpPort = 80;
|
||||
httpsPort = 443;
|
||||
};
|
||||
} // (builtins.foldl'(prev: name: let
|
||||
cfg = self.nixosConfigurations.${name}.config;
|
||||
in prev // {
|
||||
"${name}" = {
|
||||
# dest = (builtins.head cfg.networking.interfaces.eth0.ipv4.addresses).address;
|
||||
dest = (builtins.head cfg.networking.interfaces.${builtins.head (builtins.attrNames cfg.networking.interfaces)}.ipv4.addresses).address;
|
||||
domain = builtins.head (builtins.attrNames cfg.services.nginx.virtualHosts);
|
||||
httpsPort = 443;
|
||||
httpPort = 80;
|
||||
};
|
||||
}) {} (builtins.filter (name: self.nixosConfigurations.${name}.config.services.nginx.enable)(builtins.attrNames self.nixosConfigurations)));
|
||||
indexPage = pkgs.writeTextFile {
|
||||
name = "index.html";
|
||||
text = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue