Refactor homelab ports
This commit is contained in:
parent
518bfe9cd4
commit
f42833545b
10 changed files with 61 additions and 61 deletions
hosts/nixedo
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
imports = [ ./ports.nix ];
|
||||
|
||||
services = {
|
||||
postgresqlBackup.enable = true;
|
||||
};
|
||||
|
@ -19,13 +21,7 @@
|
|||
|
||||
gitea-actions-runner.enable = true;
|
||||
home-assistant.enable = true;
|
||||
|
||||
homepage-dashboard = {
|
||||
enable = true;
|
||||
|
||||
port = 8097;
|
||||
};
|
||||
|
||||
homepage-dashboard.enable = true;
|
||||
immich.enable = true;
|
||||
jellyfin.enable = true;
|
||||
paperless.enable = true;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
{ lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
port = 8082;
|
||||
service = "pihole";
|
||||
port = config.homelab.ports.${service};
|
||||
in
|
||||
{
|
||||
virtualisation.oci-containers.containers."pihole" = {
|
||||
virtualisation.oci-containers.containers.${service} = {
|
||||
image = "pihole/pihole:latest";
|
||||
|
||||
environment = {
|
||||
|
@ -22,7 +23,7 @@ in
|
|||
"53:53/tcp"
|
||||
"53:53/udp"
|
||||
"67:67/udp"
|
||||
"${toString port}:80/tcp"
|
||||
"${port}:80/tcp"
|
||||
];
|
||||
|
||||
log-driver = "journald";
|
||||
|
|
|
@ -11,16 +11,13 @@ let
|
|||
cfg = homelab.services.${service};
|
||||
service = "tubearchivist";
|
||||
homelab = config.homelab;
|
||||
|
||||
port = homelab.ports.${service};
|
||||
in
|
||||
{
|
||||
options.homelab.services.${service} = {
|
||||
enable = mkEnableOption "Enable ${service}";
|
||||
|
||||
port = mkOption {
|
||||
default = 8099;
|
||||
type = types.port;
|
||||
};
|
||||
|
||||
url = mkOption {
|
||||
default = "${service}.${homelab.domain}";
|
||||
type = types.str;
|
||||
|
@ -177,7 +174,7 @@ in
|
|||
];
|
||||
|
||||
ports = [
|
||||
"${toString cfg.port}:8000/tcp"
|
||||
"${toString port}:8000/tcp"
|
||||
];
|
||||
|
||||
dependsOn = [
|
||||
|
@ -321,7 +318,7 @@ in
|
|||
useACMEHost = homelab.domain;
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString cfg.port}";
|
||||
proxyPass = "http://localhost:${toString port}";
|
||||
recommendedProxySettings = true;
|
||||
proxyWebsockets = true;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ config, ... }:
|
||||
|
||||
let
|
||||
sites = import ./sites.nix;
|
||||
sites = import ./sites.nix { ports = config.homelab.ports; };
|
||||
in
|
||||
{
|
||||
services = {
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
bootstrap-with-tailwind = 8081;
|
||||
eric = 8084;
|
||||
florida-drupalcamp-tailwind-css = 8083;
|
||||
luke = 8094;
|
||||
phpsw-sculpin-demo = 8085;
|
||||
rebuilding-acquia = 8086;
|
||||
rebuilding-bartik = 8087;
|
||||
rebuilding-bristol-js = 8088;
|
||||
rebuilding-symfony = 8089;
|
||||
tailwindcss-demo = 8090;
|
||||
talking-drupal-tailwindcss = 8093;
|
||||
wp-tailwind = 8091;
|
||||
zet = 8092;
|
||||
}
|
|
@ -1,20 +1,14 @@
|
|||
{ ports }:
|
||||
|
||||
let
|
||||
domain = "oliverdavies.uk";
|
||||
|
||||
ports = import ./ports.nix;
|
||||
|
||||
mkSite =
|
||||
name: overrides:
|
||||
let
|
||||
root = "/var/www/vhosts/${name}" + (overrides.rootSuffix or "");
|
||||
port = ports."nginx-${name}";
|
||||
url = "${name}.oliverdavies.uk";
|
||||
in
|
||||
{
|
||||
inherit root;
|
||||
|
||||
port = ports.${name};
|
||||
url = "${name}.${domain}";
|
||||
}
|
||||
// overrides;
|
||||
{ inherit port root url; } // overrides;
|
||||
|
||||
sites = [
|
||||
(mkSite "eric" {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
{ config, ... }:
|
||||
|
||||
let
|
||||
port = 8095;
|
||||
ports = config.homelab.ports;
|
||||
port = ports.nginx-website-sculpin;
|
||||
|
||||
redirects = import ./www.oliverdavies.uk-redirects.nix;
|
||||
|
||||
|
@ -18,7 +21,7 @@ let
|
|||
"tome-test"
|
||||
];
|
||||
|
||||
port = 8098;
|
||||
port = ports.nginx-website-tome;
|
||||
};
|
||||
|
||||
tomeLocations = builtins.listToAttrs (
|
||||
|
|
35
hosts/nixedo/ports.nix
Normal file
35
hosts/nixedo/ports.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
options.homelab.ports = mkOption {
|
||||
internal = true;
|
||||
type = types.attrsOf types.port;
|
||||
};
|
||||
|
||||
config.homelab.ports = {
|
||||
homepage-dashboard = 8097;
|
||||
pihole = 8082;
|
||||
tubearchivist = 8099;
|
||||
vaultwarden = 8022;
|
||||
|
||||
nginx-website-sculpin = 8095;
|
||||
nginx-website-tome = 8098;
|
||||
|
||||
nginx-bootstrap-with-tailwind = 8081;
|
||||
nginx-eric = 8084;
|
||||
nginx-florida-drupalcamp-tailwind-css = 8083;
|
||||
nginx-luke = 8094;
|
||||
nginx-phpsw-sculpin-demo = 8085;
|
||||
nginx-rebuilding-acquia = 8086;
|
||||
nginx-rebuilding-bartik = 8087;
|
||||
nginx-rebuilding-bristol-js = 8088;
|
||||
nginx-rebuilding-symfony = 8089;
|
||||
nginx-tailwindcss-demo = 8090;
|
||||
nginx-talking-drupal-tailwindcss = 8093;
|
||||
nginx-wp-tailwind = 8091;
|
||||
nginx-zet = 8092;
|
||||
};
|
||||
}
|
|
@ -1,27 +1,16 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = homelab.services.${service};
|
||||
homelab = config.homelab;
|
||||
opts = options.services.${service};
|
||||
service = "homepage-dashboard";
|
||||
in
|
||||
{
|
||||
options.homelab.services.${service} = {
|
||||
enable = mkEnableOption "Enable ${service}";
|
||||
|
||||
port = mkOption {
|
||||
default = opts.listenPort.default;
|
||||
type = types.port;
|
||||
};
|
||||
|
||||
url = mkOption {
|
||||
default = "${config.networking.hostName}.${homelab.domain}";
|
||||
type = types.str;
|
||||
|
@ -32,7 +21,7 @@ in
|
|||
services = {
|
||||
${service} = {
|
||||
enable = true;
|
||||
listenPort = cfg.port;
|
||||
listenPort = homelab.ports.${service};
|
||||
openFirewall = true;
|
||||
|
||||
customCSS = ''
|
||||
|
|
|
@ -55,7 +55,7 @@ in
|
|||
config = {
|
||||
DOMAIN = "https://${cfg.url}";
|
||||
ROCKET_ADDRESS = "127.0.0.1";
|
||||
ROCKET_PORT = 8222;
|
||||
ROCKET_PORT = homelab.ports.${service};
|
||||
SIGNUPS_ALLOWED = false;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue