2024-02-02 02:44:51 +01:00
|
|
|
{ inputs, config, ... }:
|
2024-02-02 02:42:03 +01:00
|
|
|
let
|
|
|
|
username = "prescientmoon";
|
|
|
|
apiHost = "api.intray.moonythm.dev";
|
|
|
|
apiPort = 8402;
|
|
|
|
webHost = "intray.moonythm.dev";
|
|
|
|
webPort = 8403;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
# {{{ Import intray module
|
|
|
|
imports = [
|
2024-02-02 02:44:22 +01:00
|
|
|
../../common/optional/services/nginx.nix
|
2024-02-02 02:42:03 +01:00
|
|
|
# We patch out the `intray` module to allow manual configuration for nginx
|
2024-02-02 02:46:27 +01:00
|
|
|
({ lib, pkgs, config, ... }:
|
2024-02-02 02:43:40 +01:00
|
|
|
# NOTE: using `pkgs.system` before `module.options` is evaluated
|
|
|
|
# leads to infinite recursion!
|
2024-02-02 02:46:27 +01:00
|
|
|
let m = inputs.intray.nixosModules.x86_64-linux.default { inherit lib pkgs config; };
|
2024-02-02 02:43:40 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit (m) options;
|
2024-02-02 02:48:45 +01:00
|
|
|
config.systemd = lib.mkIf config.services.intray.production.enable m.config.systemd;
|
2024-02-02 02:43:40 +01:00
|
|
|
})
|
2024-02-02 02:42:03 +01:00
|
|
|
];
|
|
|
|
# }}}
|
|
|
|
# {{{ Configure intray
|
|
|
|
services.intray.production = {
|
|
|
|
enable = true;
|
|
|
|
api-server = {
|
|
|
|
enable = true;
|
|
|
|
hosts = [ apiHost ];
|
|
|
|
port = apiPort;
|
|
|
|
admins = [ username ];
|
|
|
|
};
|
|
|
|
web-server = {
|
|
|
|
enable = true;
|
|
|
|
hosts = [ webHost ];
|
|
|
|
port = webPort;
|
|
|
|
api-url = "https://${apiHost}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
# }}}
|
|
|
|
# {{{ Networking & storage
|
|
|
|
services.nginx.virtualHosts.${apiHost} = config.satellite.proxy apiPort;
|
|
|
|
services.nginx.virtualHosts.${webHost} = config.satellite.proxy webPort;
|
|
|
|
|
|
|
|
environment.persistence."/persist/state".directories = [
|
|
|
|
"/www/intray/production/data"
|
|
|
|
];
|
|
|
|
# }}}
|
|
|
|
}
|