mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-27 06:10:53 +01:00
Refactored subdomains creation
This commit is contained in:
parent
f6b29709c5
commit
be4fce11f4
11 changed files with 28 additions and 103 deletions
|
@ -10,6 +10,7 @@ in
|
|||
{
|
||||
|
||||
mkMachine = host: host-config: modules: nixpkgs.lib.nixosSystem {
|
||||
lib = final;
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
|
@ -36,5 +37,16 @@ in
|
|||
|
||||
importConfig = path: (mapAttrs (name: value: import (path + "/${name}/default.nix")) (readDir path));
|
||||
|
||||
mkSubdomain = name: port: {
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${name}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,13 +32,5 @@ with lib;
|
|||
port = port;
|
||||
};
|
||||
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${cfg.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
};
|
||||
} // mkSubdomain cfg.subdomain port;
|
||||
}
|
||||
|
|
|
@ -93,13 +93,5 @@ in
|
|||
path = [ pkgs.nixUnstable pkgs.git pkgs.openssh ];
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."${cfg.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
} // mkSubdomain cfg.subdomain port;
|
||||
}
|
||||
|
|
|
@ -4,10 +4,14 @@ let
|
|||
cfg = config.luj.filerun;
|
||||
mysql_root_pw = [ (builtins.readFile /run/secrets/filerun-root-passwd) ];
|
||||
mysql_pw = [ (builtins.readFile /run/secrets/filerun-passwd) ];
|
||||
port = 2000;
|
||||
in
|
||||
{
|
||||
options.luj.filerun = {
|
||||
enable = mkEnableOption "enable filerun service";
|
||||
subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
@ -79,26 +83,6 @@ in
|
|||
extraOptions = [ "--network=filerun-br" ];
|
||||
};
|
||||
|
||||
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.recommendedProxySettings = true;
|
||||
services.nginx.virtualHosts."cloud.julienmalka.me" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:2000";
|
||||
extraConfig = ''
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Forwarded-Port 443;
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
};
|
||||
} // mkSubdomain cfg.subdomain port;
|
||||
|
||||
}
|
||||
|
|
|
@ -29,17 +29,8 @@ in
|
|||
}
|
||||
|
||||
(mkIf cfg.nginx.enable {
|
||||
luj.nginx.enable = true;
|
||||
services.hydra.hydraURL = "${cfg.nginx.subdomain}.julienmalka.me";
|
||||
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
|
||||
})]);
|
||||
} // mkSubdomain cfg.nginx.subdomain port )]);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -37,17 +37,7 @@ in
|
|||
};
|
||||
}
|
||||
|
||||
(mkIf cfg.nginx.enable {
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
|
||||
})]);
|
||||
(mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port) )]);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -37,17 +37,7 @@ in
|
|||
};
|
||||
}
|
||||
|
||||
(mkIf cfg.nginx.enable {
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
|
||||
})]);
|
||||
(mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port) )]);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ in {
|
|||
enable = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedTlsSettings = true;
|
||||
recommendedProxySettings = true;
|
||||
clientMaxBodySize = "128m";
|
||||
|
||||
commonHttpConfig = ''
|
||||
|
|
|
@ -38,17 +38,10 @@ in
|
|||
};
|
||||
}
|
||||
|
||||
(mkIf cfg.nginx.enable {
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
(mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port))
|
||||
|
||||
]);
|
||||
|
||||
})]);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -38,17 +38,7 @@ in
|
|||
};
|
||||
}
|
||||
|
||||
(mkIf cfg.nginx.enable {
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
|
||||
})]);
|
||||
(mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port) )]);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -52,17 +52,7 @@ in
|
|||
};
|
||||
}
|
||||
|
||||
(mkIf cfg.nginx.enable {
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
|
||||
})]);
|
||||
(mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port) )]);
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue