Compare commits
2 commits
05973b93ff
...
e50b259a70
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | e50b259a70 | ||
Bruno BELANYI | b3d90be8b1 |
|
@ -50,7 +50,7 @@ in
|
||||||
services.gitea =
|
services.gitea =
|
||||||
let
|
let
|
||||||
inherit (config.networking) domain;
|
inherit (config.networking) domain;
|
||||||
giteaDomain = "gitea.${domain}";
|
giteaDomain = "git.${domain}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -112,11 +112,16 @@ in
|
||||||
};
|
};
|
||||||
users.groups.git = { };
|
users.groups.git = { };
|
||||||
|
|
||||||
# Proxy to Gitea
|
|
||||||
my.services.nginx.virtualHosts = [
|
my.services.nginx.virtualHosts = [
|
||||||
|
# Proxy to Gitea
|
||||||
|
{
|
||||||
|
subdomain = "git";
|
||||||
|
inherit (cfg) port;
|
||||||
|
}
|
||||||
|
# Redirect `gitea.` to actual forge subdomain
|
||||||
{
|
{
|
||||||
subdomain = "gitea";
|
subdomain = "gitea";
|
||||||
inherit (cfg) port;
|
redirect = config.services.gitea.rootUrl;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,15 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
redirect = mkOption {
|
||||||
|
type = with types; nullOr str;
|
||||||
|
default = null;
|
||||||
|
example = "https://example.com";
|
||||||
|
description = ''
|
||||||
|
Which domain to redirect to (301 response), for this virtual host.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
root = mkOption {
|
root = mkOption {
|
||||||
type = with types; nullOr path;
|
type = with types; nullOr path;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -176,7 +185,7 @@ in
|
||||||
assertions = [ ]
|
assertions = [ ]
|
||||||
++ (lib.flip builtins.map cfg.virtualHosts ({ subdomain, ... } @ args:
|
++ (lib.flip builtins.map cfg.virtualHosts ({ subdomain, ... } @ args:
|
||||||
let
|
let
|
||||||
conflicts = [ "port" "root" ];
|
conflicts = [ "port" "root" "redirect" ];
|
||||||
optionsNotNull = builtins.map (v: args.${v} != null) conflicts;
|
optionsNotNull = builtins.map (v: args.${v} != null) conflicts;
|
||||||
optionsSet = lib.filter lib.id optionsNotNull;
|
optionsSet = lib.filter lib.id optionsNotNull;
|
||||||
in
|
in
|
||||||
|
@ -249,6 +258,10 @@ in
|
||||||
(lib.optionalAttrs (args.root != null) {
|
(lib.optionalAttrs (args.root != null) {
|
||||||
inherit (args) root;
|
inherit (args) root;
|
||||||
})
|
})
|
||||||
|
# Redirect to a different domain
|
||||||
|
(lib.optionalAttrs (args.redirect != null) {
|
||||||
|
locations."/".return = "301 ${args.redirect}$request_uri";
|
||||||
|
})
|
||||||
# VHost specific configuration
|
# VHost specific configuration
|
||||||
args.extraConfig
|
args.extraConfig
|
||||||
# SSO configuration
|
# SSO configuration
|
||||||
|
|
Loading…
Reference in a new issue