reverted server factory

This commit is contained in:
Danilo Reyes 2025-10-12 19:59:46 -06:00
parent 8664061145
commit e393a4481b
35 changed files with 74 additions and 126 deletions

View File

@ -107,4 +107,5 @@ in
proxyReverseFix proxyReverseFix
proxyReversePrivate proxyReversePrivate
; ;
mkServerOptions = mkOptions;
} }

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.atticd; cfg = config.my.servers.atticd;
in in
{ {
options.my.servers.atticd = inputs.self.lib.mkServerOptions "atticd" "cache" 2343 lib; options.my.servers.atticd = setup.mkOptions "atticd" "cache" 2343;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
sops.secrets."private_cache_keys/atticd".sopsFile = ../../secrets/keys.yaml; sops.secrets."private_cache_keys/atticd".sopsFile = ../../secrets/keys.yaml;
services.atticd = { services.atticd = {

View File

@ -1,16 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.audiobookshelf; cfg = config.my.servers.audiobookshelf;
in in
{ {
options.my.servers.audiobookshelf = options.my.servers.audiobookshelf = setup.mkOptions "audiobookshelf" "audiobooks" 5687;
inputs.self.lib.mkServerOptions "audiobookshelf" "audiobooks" 5687
lib;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
my.servers.audiobookshelf.enableSocket = true; my.servers.audiobookshelf.enableSocket = true;
services.audiobookshelf = { services.audiobookshelf = {

View File

@ -1,16 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.bazarr; cfg = config.my.servers.bazarr;
in in
{ {
options.my.servers.bazarr = options.my.servers.bazarr = setup.mkOptions "bazarr" "subs" config.services.bazarr.listenPort;
inputs.self.lib.mkServerOptions "bazarr" "subs" config.services.bazarr.listenPort
lib;
config.services.bazarr = lib.mkIf cfg.enable { config.services.bazarr = lib.mkIf cfg.enable {
inherit (cfg) enable; inherit (cfg) enable;
group = "piracy"; group = "piracy";

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.drpp; cfg = config.my.servers.drpp;
in in
{ {
options.my.servers.drpp = inputs.self.lib.mkServerOptions "drpp" "drpp" 0 lib; options.my.servers.drpp = setup.mkOptions "drpp" "drpp" 0;
config.virtualisation.oci-containers.containers.drpp = lib.mkIf cfg.enable { config.virtualisation.oci-containers.containers.drpp = lib.mkIf cfg.enable {
image = "ghcr.io/phin05/discord-rich-presence-plex:latest"; image = "ghcr.io/phin05/discord-rich-presence-plex:latest";
environment = { environment = {

View File

@ -1,16 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.firefox-syncserver; cfg = config.my.servers.firefox-syncserver;
in in
{ {
options.my.servers.firefox-syncserver = options.my.servers.firefox-syncserver = setup.mkOptions "firefox-syncserver" "sync" 4233;
inputs.self.lib.mkServerOptions "firefox-syncserver" "sync" 4233
lib;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
# sops.secrets.firefox-syncserver.sopsFile = ../../secrets/env.yaml; # sops.secrets.firefox-syncserver.sopsFile = ../../secrets/env.yaml;
services.firefox-syncserver = { services.firefox-syncserver = {

View File

@ -1,18 +1,18 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
cfg = config.my.servers.flame; cfg = config.my.servers.flame;
cfgS = config.my.servers.flameSecret; cfgS = config.my.servers.flameSecret;
enable = (cfg.enable || cfgS.enable) && config.my.secureHost; enable = (cfg.enable || cfgS.enable) && config.my.secureHost;
setup = import ../factories/mkserver.nix { inherit lib config; };
in in
{ {
options.my.servers = { options.my.servers = {
flame = inputs.self.lib.mkServerOptions "flame" "start" 5005 lib; flame = setup.mkOptions "flame" "start" 5005;
flameSecret = inputs.self.lib.mkServerOptions "flameSecret" "qampqwn4wprhqny8h8zj" 5007 lib; flameSecret = setup.mkOptions "flameSecret" "qampqwn4wprhqny8h8zj" 5007;
}; };
config = lib.mkIf enable { config = lib.mkIf enable {
sops.secrets = { sops.secrets = {

View File

@ -1,11 +1,11 @@
{ {
lib, lib,
config, config,
inputs,
pkgs, pkgs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.gitea; cfg = config.my.servers.gitea;
in in
{ {
@ -13,7 +13,7 @@ in
../nix/gitea-actions-runners/ryujinx.nix ../nix/gitea-actions-runners/ryujinx.nix
../nix/gitea-actions-runners/nixos.nix ../nix/gitea-actions-runners/nixos.nix
]; ];
options.my.servers.gitea = inputs.self.lib.mkServerOptions "gitea" "git" 9083 lib; options.my.servers.gitea = setup.mkOptions "gitea" "git" 9083;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
sops.secrets.gitea.sopsFile = ../../secrets/env.yaml; sops.secrets.gitea.sopsFile = ../../secrets/env.yaml;
services.gitea = { services.gitea = {

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.homepage; cfg = config.my.servers.homepage;
in in
{ {
options.my.servers.homepage = inputs.self.lib.mkServerOptions "homepage" "home" 8082 lib; options.my.servers.homepage = setup.mkOptions "homepage" "home" 8082;
config = lib.mkIf config.my.secureHost { config = lib.mkIf config.my.secureHost {
sops.secrets = lib.mkIf cfg.enable { sops.secrets = lib.mkIf cfg.enable {
homepage.sopsFile = ../../secrets/homepage.yaml; homepage.sopsFile = ../../secrets/homepage.yaml;
@ -29,7 +29,11 @@ in
}; };
widgets = import ./homepage/widgets.nix; widgets = import ./homepage/widgets.nix;
services = import ./homepage/services.nix { inherit lib config; }; services = import ./homepage/services.nix { inherit lib config; };
bookmarks = inputs.self.lib.autoImport ./homepage/bookmarks (_: true) |> map import; bookmarks =
builtins.readDir ./homepage/bookmarks
|> builtins.attrNames
|> builtins.filter (file: builtins.match ".*\\.nix" file != null)
|> map (file: import ./homepage/bookmarks/${file});
}; };
}; };
} }

View File

@ -8,6 +8,7 @@
let let
cfg = config.my.servers.jellyfin; cfg = config.my.servers.jellyfin;
inherit (inputs.jawz-scripts.packages.x86_64-linux) sub-sync; inherit (inputs.jawz-scripts.packages.x86_64-linux) sub-sync;
setup = import ../factories/mkserver.nix { inherit lib config; };
sub-sync-path = [ sub-sync-path = [
pkgs.nix pkgs.nix
pkgs.bash pkgs.bash
@ -21,7 +22,7 @@ let
]; ];
in in
{ {
options.my.servers.jellyfin = inputs.self.lib.mkServerOptions "jellyfin" "flix" 8096 lib; options.my.servers.jellyfin = setup.mkOptions "jellyfin" "flix" 8096;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
environment.systemPackages = [ environment.systemPackages = [
pkgs.jellyfin-ffmpeg pkgs.jellyfin-ffmpeg

View File

@ -1,16 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.kavita; cfg = config.my.servers.kavita;
in in
{ {
options.my.servers.kavita = options.my.servers.kavita = setup.mkOptions "kavita" "library" config.services.kavita.settings.Port;
inputs.self.lib.mkServerOptions "kavita" "library" config.services.kavita.settings.Port
lib;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
sops.secrets.kavita-token = { sops.secrets.kavita-token = {
owner = config.users.users.kavita.name; owner = config.users.users.kavita.name;

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.lidarr; cfg = config.my.servers.lidarr;
in in
{ {
options.my.servers.lidarr = inputs.self.lib.mkServerOptions "lidarr" "music" 8686 lib; options.my.servers.lidarr = setup.mkOptions "lidarr" "music" 8686;
config.virtualisation.oci-containers.containers.lidarr = lib.mkIf cfg.enable { config.virtualisation.oci-containers.containers.lidarr = lib.mkIf cfg.enable {
autoStart = true; autoStart = true;
image = "linuxserver/lidarr:version-2.13.3.4711"; image = "linuxserver/lidarr:version-2.13.3.4711";

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.maloja; cfg = config.my.servers.maloja;
in in
{ {
options.my.servers.maloja = inputs.self.lib.mkServerOptions "maloja" "maloja" 42010 lib; options.my.servers.maloja = setup.mkOptions "maloja" "maloja" 42010;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
sops.secrets.maloja.sopsFile = ../../secrets/env.yaml; sops.secrets.maloja.sopsFile = ../../secrets/env.yaml;
virtualisation.oci-containers.containers.maloja = { virtualisation.oci-containers.containers.maloja = {

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.mealie; cfg = config.my.servers.mealie;
in in
{ {
options.my.servers.mealie = inputs.self.lib.mkServerOptions "mealie" "mealie" 9925 lib; options.my.servers.mealie = setup.mkOptions "mealie" "mealie" 9925;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
sops.secrets.mealie.sopsFile = ../../secrets/env.yaml; sops.secrets.mealie.sopsFile = ../../secrets/env.yaml;
services.mealie = { services.mealie = {

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.metube; cfg = config.my.servers.metube;
in in
{ {
options.my.servers.metube = inputs.self.lib.mkServerOptions "metube" "bajameesta" 8881 lib; options.my.servers.metube = setup.mkOptions "metube" "bajameesta" 8881;
config.virtualisation.oci-containers.containers.metube = lib.mkIf cfg.enable { config.virtualisation.oci-containers.containers.metube = lib.mkIf cfg.enable {
image = "ghcr.io/alexta69/metube:latest"; image = "ghcr.io/alexta69/metube:latest";
ports = [ "${toString cfg.port}:8081" ]; ports = [ "${toString cfg.port}:8081" ];

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.microbin; cfg = config.my.servers.microbin;
in in
{ {
options.my.servers.microbin = inputs.self.lib.mkServerOptions "microbin" "copy" 8086 lib; options.my.servers.microbin = setup.mkOptions "microbin" "copy" 8086;
config.services.microbin = lib.mkIf (cfg.enable && config.my.secureHost) { config.services.microbin = lib.mkIf (cfg.enable && config.my.secureHost) {
inherit (cfg) enable; inherit (cfg) enable;
settings = { settings = {

View File

@ -1,16 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.multi-scrobbler; cfg = config.my.servers.multi-scrobbler;
in in
{ {
options.my.servers.multi-scrobbler = options.my.servers.multi-scrobbler = setup.mkOptions "multi-scrobbler" "scrobble" 9078;
inputs.self.lib.mkServerOptions "multi-scrobbler" "scrobble" 9078
lib;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
sops.secrets.multi-scrobbler.sopsFile = ../../secrets/env.yaml; sops.secrets.multi-scrobbler.sopsFile = ../../secrets/env.yaml;
virtualisation.oci-containers.containers.multi-scrobbler = { virtualisation.oci-containers.containers.multi-scrobbler = {

View File

@ -6,6 +6,7 @@
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
commonProxyConfig = '' commonProxyConfig = ''
proxy_set_header Host $host; proxy_set_header Host $host;
''; '';
@ -34,8 +35,8 @@ let
in in
{ {
options.my.servers = { options.my.servers = {
nextcloud = inputs.self.lib.mkServerOptions "nextcloud" "cloud" 80 lib; nextcloud = setup.mkOptions "nextcloud" "cloud" 80;
collabora = inputs.self.lib.mkServerOptions "collabora" "collabora" 9980 lib; collabora = setup.mkOptions "collabora" "collabora" 9980;
go-vod.enable = lib.mkEnableOption "Go-VOD video transcoding service"; go-vod.enable = lib.mkEnableOption "Go-VOD video transcoding service";
}; };
config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable && config.my.secureHost) {

View File

@ -1,15 +1,15 @@
{ {
lib, lib,
inputs,
config, config,
pkgs, pkgs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.nix-serve; cfg = config.my.servers.nix-serve;
in in
{ {
options.my.servers.nix-serve = inputs.self.lib.mkServerOptions "nix-serve" "cache" 5000 lib; options.my.servers.nix-serve = setup.mkOptions "nix-serve" "cache" 5000;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
sops.secrets."private_cache_keys/miniserver".sopsFile = ../../secrets/keys.yaml; sops.secrets."private_cache_keys/miniserver".sopsFile = ../../secrets/keys.yaml;
services.nix-serve = { services.nix-serve = {

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.ombi; cfg = config.my.servers.ombi;
in in
{ {
options.my.servers.ombi = inputs.self.lib.mkServerOptions "ombi" "requests" 3425 lib; options.my.servers.ombi = setup.mkOptions "ombi" "requests" 3425;
config.services.ombi = lib.mkIf cfg.enable { config.services.ombi = lib.mkIf cfg.enable {
inherit (cfg) enable port; inherit (cfg) enable port;
}; };

View File

@ -1,15 +1,15 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.plex-discord-bot; cfg = config.my.servers.plex-discord-bot;
name = "plex-discord-bot"; name = "plex-discord-bot";
in in
{ {
options.my.servers.plex-discord-bot = inputs.self.lib.mkServerOptions name name 0 lib; options.my.servers.plex-discord-bot = setup.mkOptions name name 0;
config.virtualisation.oci-containers.containers.plex-discord-bot = lib.mkIf cfg.enable { config.virtualisation.oci-containers.containers.plex-discord-bot = lib.mkIf cfg.enable {
image = "ghcr.io/phin05/discord-rich-presence-plex:latest"; image = "ghcr.io/phin05/discord-rich-presence-plex:latest";
environment = { environment = {

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
inputs,
config, config,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.plex; cfg = config.my.servers.plex;
in in
{ {
options.my.servers.plex = inputs.self.lib.mkServerOptions "plex" "plex" 32400 lib; options.my.servers.plex = setup.mkOptions "plex" "plex" 32400;
config.services = lib.mkIf (cfg.enable && config.my.secureHost) { config.services = lib.mkIf (cfg.enable && config.my.secureHost) {
plex = { plex = {
inherit (cfg) enable; inherit (cfg) enable;

View File

@ -1,14 +1,14 @@
{ {
config, config,
lib, lib,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.websites.portfolio; cfg = config.my.websites.portfolio;
in in
{ {
options.my.websites.portfolio = inputs.self.lib.mkServerOptions "portfolio" "portfolio" 0 lib; options.my.websites.portfolio = setup.mkOptions "portfolio" "portfolio" 0;
config.services.nginx.virtualHosts."danilo-reyes.com" = lib.mkIf cfg.enableProxy { config.services.nginx.virtualHosts."danilo-reyes.com" = lib.mkIf cfg.enableProxy {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
inputs,
config, config,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.prowlarr; cfg = config.my.servers.prowlarr;
in in
{ {
options.my.servers.prowlarr = inputs.self.lib.mkServerOptions "prowlarr" "indexer" 9696 lib; options.my.servers.prowlarr = setup.mkOptions "prowlarr" "indexer" 9696;
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
users.users.prowlarr = { users.users.prowlarr = {
group = "piracy"; group = "piracy";

View File

@ -1,8 +1,8 @@
{ {
inputs,
lib, lib,
config, config,
pkgs, pkgs,
inputs,
... ...
}: }:
let let

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.radarr; cfg = config.my.servers.radarr;
in in
{ {
options.my.servers.radarr = inputs.self.lib.mkServerOptions "radarr" "movies" 7878 lib; options.my.servers.radarr = setup.mkOptions "radarr" "movies" 7878;
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.radarr = { services.radarr = {
inherit (cfg) enable; inherit (cfg) enable;

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.readeck; cfg = config.my.servers.readeck;
in in
{ {
options.my.servers.readeck = inputs.self.lib.mkServerOptions "readeck" "laters" 9546 lib; options.my.servers.readeck = setup.mkOptions "readeck" "laters" 9546;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
sops.secrets.readeck.sopsFile = ../../secrets/env.yaml; sops.secrets.readeck.sopsFile = ../../secrets/env.yaml;
services.readeck = { services.readeck = {

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.ryot; cfg = config.my.servers.ryot;
in in
{ {
options.my.servers.ryot = inputs.self.lib.mkServerOptions "ryot" "tracker" 8765 lib; options.my.servers.ryot = setup.mkOptions "ryot" "tracker" 8765;
config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable && config.my.secureHost) {
sops.secrets.ryot.sopsFile = ../../secrets/env.yaml; sops.secrets.ryot.sopsFile = ../../secrets/env.yaml;
virtualisation.oci-containers.containers.ryot = { virtualisation.oci-containers.containers.ryot = {

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.shiori; cfg = config.my.servers.shiori;
in in
{ {
options.my.servers.shiori = inputs.self.lib.mkServerOptions "shiori" "bookmarks" 4368 lib; options.my.servers.shiori = setup.mkOptions "shiori" "bookmarks" 4368;
config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable && config.my.secureHost) {
sops.secrets.shiori.sopsFile = ../../secrets/env.yaml; sops.secrets.shiori.sopsFile = ../../secrets/env.yaml;
services.shiori = { services.shiori = {

View File

@ -1,14 +1,14 @@
{ {
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.sonarr; cfg = config.my.servers.sonarr;
in in
{ {
options.my.servers.sonarr = inputs.self.lib.mkServerOptions "sonarr" "series" 8989 lib; options.my.servers.sonarr = setup.mkOptions "sonarr" "series" 8989;
config.services.sonarr = lib.mkIf cfg.enable { config.services.sonarr = lib.mkIf cfg.enable {
inherit (cfg) enable; inherit (cfg) enable;
group = "piracy"; group = "piracy";

View File

@ -1,11 +1,11 @@
{ {
lib, lib,
inputs,
config, config,
pkgs, pkgs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.stash; cfg = config.my.servers.stash;
cfgS = config.services.stash; cfgS = config.services.stash;
stashPythonFHS = pkgs.buildFHSEnv { stashPythonFHS = pkgs.buildFHSEnv {
@ -28,7 +28,7 @@ let
}; };
in in
{ {
options.my.servers.stash = inputs.self.lib.mkServerOptions "stash" "xxx" 9999 lib; options.my.servers.stash = setup.mkOptions "stash" "xxx" 9999;
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
sops.secrets = { sops.secrets = {
"stash/password".sopsFile = ../../secrets/secrets.yaml; "stash/password".sopsFile = ../../secrets/secrets.yaml;

View File

@ -1,11 +1,11 @@
{ {
lib, lib,
inputs,
config, config,
pkgs, pkgs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.synapse; cfg = config.my.servers.synapse;
cfgE = config.my.servers.element; cfgE = config.my.servers.element;
domain = "wedsgk5ac2qcaf9yb.click"; domain = "wedsgk5ac2qcaf9yb.click";
@ -19,8 +19,8 @@ let
in in
{ {
options.my.servers = { options.my.servers = {
synapse = inputs.self.lib.mkServerOptions "synapse" "pYLemuAfsrzNBaH77xSu" 8008 lib; synapse = setup.mkOptions "synapse" "pYLemuAfsrzNBaH77xSu" 8008;
element = inputs.self.lib.mkServerOptions "element" "55a608953f6d64c199" 5345 lib; element = setup.mkOptions "element" "55a608953f6d64c199" 5345;
}; };
config = lib.mkIf (cfg.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.secureHost) {
my.servers = { my.servers = {

View File

@ -1,14 +1,14 @@
{ {
config, config,
lib, lib,
inputs,
... ...
}: }:
let let
setup = import ../factories/mkserver.nix { inherit lib config; };
cfg = config.my.servers.tranga; cfg = config.my.servers.tranga;
in in
{ {
options.my.servers.tranga = inputs.self.lib.mkServerOptions "tranga" "tranga" 9555 lib; options.my.servers.tranga = setup.mkOptions "tranga" "tranga" 9555;
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
tranga-api = { tranga-api = {

View File

@ -1,15 +1,15 @@
{ {
lib, lib,
inputs,
config, config,
pkgs, pkgs,
... ...
}: }:
let let
cfg = config.my.servers.vaultwarden; cfg = config.my.servers.vaultwarden;
setup = import ../factories/mkserver.nix { inherit lib config; };
in in
{ {
options.my.servers.vaultwarden = inputs.self.lib.mkServerOptions "vaultwarden" "vault" 8222 lib; options.my.servers.vaultwarden = setup.mkOptions "vaultwarden" "vault" 8222;
config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable && config.my.secureHost) { config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable && config.my.secureHost) {
sops.secrets.vaultwarden.sopsFile = ../../secrets/env.yaml; sops.secrets.vaultwarden.sopsFile = ../../secrets/env.yaml;
services.vaultwarden = { services.vaultwarden = {

View File

@ -55,55 +55,6 @@ in
|> builtins.attrNames |> builtins.attrNames
|> builtins.filter (file: builtins.match ".*\\.nix" file != null && filterFn file) |> builtins.filter (file: builtins.match ".*\\.nix" file != null && filterFn file)
|> map (file: dir + "/${file}"); |> map (file: dir + "/${file}");
mkServerOptions = name: subdomain: port: lib: {
enable = lib.mkEnableOption "this server service";
enableCron = lib.mkEnableOption "enable cronjob";
enableProxy = lib.mkEnableOption "enable reverse proxy";
port = lib.mkOption {
type = lib.types.int;
default = port;
};
name = lib.mkOption {
type = lib.types.str;
default = name;
};
domain = lib.mkOption {
type = lib.types.str;
default = "servidos.lat";
};
host = lib.mkOption {
type = lib.types.str;
default = "${subdomain}.servidos.lat";
};
hostName = lib.mkOption {
type = lib.types.str;
default = "miniserver";
};
url = lib.mkOption {
type = lib.types.str;
default = "https://${subdomain}.servidos.lat";
};
ip = lib.mkOption {
type = lib.types.str;
default = "127.0.0.1";
};
local = lib.mkOption {
type = lib.types.str;
default = "http://127.0.0.1:${toString port}";
};
isLocal = lib.mkOption {
type = lib.types.bool;
default = true;
};
enableSocket = lib.mkOption {
type = lib.types.bool;
default = false;
};
certPath = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
};
};
proxy = locations: { proxy = locations: {
inherit locations; inherit locations;
forceSSL = true; forceSSL = true;