Compare commits
1 Commits
8556b18828
...
45c6d01b1f
| Author | SHA1 | Date | |
|---|---|---|---|
| 45c6d01b1f |
22
flake.nix
22
flake.nix
@@ -392,10 +392,20 @@
|
||||
};
|
||||
};
|
||||
testConfig =
|
||||
(self.nixosConfigurations.pikachu.extendModules {
|
||||
specialArgs.registry = registry;
|
||||
(lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
my = self.lib;
|
||||
inherit registry;
|
||||
};
|
||||
modules = [
|
||||
./modules/reverse-proxy.nix
|
||||
{
|
||||
modules.reverse-proxy.enable = true;
|
||||
}
|
||||
];
|
||||
}).config;
|
||||
vhosts = testConfig.containers.reverse-proxy.config.services.nginx.virtualHosts;
|
||||
vhosts = testConfig.services.nginx.virtualHosts;
|
||||
in
|
||||
pkgs.runCommand "reverse-proxy-fleet-routes-check" { } ''
|
||||
${
|
||||
@@ -449,8 +459,10 @@
|
||||
address = "10.23.20.126";
|
||||
reverseProxy = {
|
||||
enable = true;
|
||||
host = "files.alexion.dev";
|
||||
port = 3923;
|
||||
route = {
|
||||
domain = "files.alexion.dev";
|
||||
port = 3923;
|
||||
};
|
||||
};
|
||||
};
|
||||
system.stateVersion = "26.11";
|
||||
|
||||
@@ -87,8 +87,10 @@
|
||||
address = "10.23.20.42";
|
||||
reverseProxy = {
|
||||
enable = true;
|
||||
host = "budget.alexion.dev";
|
||||
port = 5006;
|
||||
route = {
|
||||
domain = "budget.alexion.dev";
|
||||
port = 5006;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -107,8 +109,10 @@
|
||||
address = "10.23.20.126";
|
||||
reverseProxy = {
|
||||
enable = true;
|
||||
host = "files.alexion.dev";
|
||||
port = 3923;
|
||||
route = {
|
||||
domain = "files.alexion.dev";
|
||||
port = 3923;
|
||||
};
|
||||
trustedSources = [ "${registry.address.${config.networking.hostName}."reverse-proxy"}/32" ];
|
||||
};
|
||||
volumes = {
|
||||
|
||||
@@ -20,7 +20,7 @@ let
|
||||
name,
|
||||
interior ? { },
|
||||
}:
|
||||
{ config, lib, ... }@args:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
optionPath = [ "guests" ] ++ lib.splitString "." name;
|
||||
cfg = lib.getAttrFromPath optionPath config;
|
||||
@@ -132,15 +132,9 @@ let
|
||||
reverseProxy = {
|
||||
enable = lib.mkEnableOption "a reverse-proxy route for this guest";
|
||||
|
||||
host = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Primary hostname served by this guest's reverse-proxy route.";
|
||||
};
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.ints.between 1 65535;
|
||||
example = 3923;
|
||||
description = "Backend TCP port served by this guest.";
|
||||
route = lib.mkOption {
|
||||
type = self.lib.registry.definitions.route.type;
|
||||
description = "Route registry entry published for this guest.";
|
||||
};
|
||||
};
|
||||
mounts = lib.mkOption {
|
||||
@@ -288,10 +282,7 @@ let
|
||||
|
||||
registry.address.${config.networking.hostName}.${machineName} = lib.mkIf (cfg.address != null) cfg.address;
|
||||
|
||||
registry.route.${config.networking.hostName}.${machineName} = lib.mkIf cfg.reverseProxy.enable {
|
||||
domain = cfg.reverseProxy.host;
|
||||
inherit (cfg.reverseProxy) port;
|
||||
};
|
||||
registry.route.${config.networking.hostName}.${machineName} = lib.mkIf cfg.reverseProxy.enable cfg.reverseProxy.route;
|
||||
|
||||
assertions = [
|
||||
{
|
||||
@@ -351,7 +342,7 @@ let
|
||||
|
||||
bindMounts = userMounts // secretMounts;
|
||||
|
||||
specialArgs = specialArgs // lib.optionalAttrs (args ? registry) { inherit (args) registry; };
|
||||
inherit specialArgs;
|
||||
|
||||
config = {
|
||||
imports = [
|
||||
|
||||
Reference in New Issue
Block a user