feat(nixos/nginx): add pages option to nginx module
This commit is contained in:
parent
b3a5441e8b
commit
5f7cfd5d24
3 changed files with 49 additions and 1 deletions
|
@ -8,7 +8,7 @@ let
|
||||||
singleton
|
singleton
|
||||||
;
|
;
|
||||||
inherit (lib.types) listOf submodule attrs;
|
inherit (lib.types) listOf submodule attrs;
|
||||||
inherit (lib.pantheon) mkStrOption mkRootDomain;
|
inherit (lib.pantheon) mkStrOption mkPathOption mkRootDomain;
|
||||||
inherit (builtins) listToAttrs map;
|
inherit (builtins) listToAttrs map;
|
||||||
cfg = config.server.web-servers.nginx;
|
cfg = config.server.web-servers.nginx;
|
||||||
sslCheck = good: bad: if config.server.web-servers.enableSSL then good else bad;
|
sslCheck = good: bad: if config.server.web-servers.enableSSL then good else bad;
|
||||||
|
@ -21,6 +21,21 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
pages = listToAttrs (
|
||||||
|
map (page: {
|
||||||
|
name = page.domain;
|
||||||
|
value = {
|
||||||
|
addSSL = sslCheck true false;
|
||||||
|
useACMEHost = sslCheck (mkRootDomain page.domain) null;
|
||||||
|
acmeRoot = null; # needed for DNS validation
|
||||||
|
locations = {
|
||||||
|
"/" = {
|
||||||
|
inherit (page) root;
|
||||||
|
} // page.extraConfig;
|
||||||
|
} // page.locations;
|
||||||
|
};
|
||||||
|
}) cfg.pages
|
||||||
|
);
|
||||||
proxyPasses = listToAttrs (
|
proxyPasses = listToAttrs (
|
||||||
map (proxy: {
|
map (proxy: {
|
||||||
name = proxy.source;
|
name = proxy.source;
|
||||||
|
@ -46,6 +61,23 @@ in
|
||||||
enableDefaultSink = mkEnableOption "" // {
|
enableDefaultSink = mkEnableOption "" // {
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
pages = mkOption {
|
||||||
|
default = [ ];
|
||||||
|
type = listOf (submodule {
|
||||||
|
options = {
|
||||||
|
domain = mkStrOption;
|
||||||
|
root = mkPathOption "";
|
||||||
|
extraConfig = lib.mkOption {
|
||||||
|
type = attrs;
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
locations = lib.mkOption {
|
||||||
|
type = attrs;
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
proxies = mkOption {
|
proxies = mkOption {
|
||||||
default = [ ];
|
default = [ ];
|
||||||
type = listOf (submodule {
|
type = listOf (submodule {
|
||||||
|
@ -80,6 +112,7 @@ in
|
||||||
virtualHosts = mkMerge [
|
virtualHosts = mkMerge [
|
||||||
defaultSink
|
defaultSink
|
||||||
proxyPasses
|
proxyPasses
|
||||||
|
pages
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,6 +42,12 @@
|
||||||
enableSSL = true;
|
enableSSL = true;
|
||||||
nginx = {
|
nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
pages = [
|
||||||
|
{
|
||||||
|
domain = "rrv.sh";
|
||||||
|
root = ./root;
|
||||||
|
}
|
||||||
|
];
|
||||||
proxies = [
|
proxies = [
|
||||||
{
|
{
|
||||||
source = "aenyrathia.wiki";
|
source = "aenyrathia.wiki";
|
||||||
|
|
9
systems/x86_64-linux/apollo/root/index.html
Normal file
9
systems/x86_64-linux/apollo/root/index.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>rrv.sh</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>TEST</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue