flake parts, migrated modules

This commit is contained in:
Danilo Reyes
2025-10-12 13:41:48 -06:00
parent 6497dede6f
commit 6f97b24115
41 changed files with 359 additions and 166 deletions

View File

@@ -1,22 +1,21 @@
{ lib, config, ... }:
{
lib,
config,
inputs,
...
}:
let
filterNames = file: file != "librewolf.nix";
autoImport =
dir:
builtins.readDir ./${dir}
|> builtins.attrNames
|> builtins.filter (file: builtins.match ".*\\.nix" file != null && filterNames file)
|> map (file: ./${dir}/${file});
in
{
imports =
autoImport "apps"
++ autoImport "dev"
++ autoImport "scripts"
++ autoImport "servers"
++ autoImport "services"
++ autoImport "shell"
++ autoImport "network"
inputs.self.lib.autoImport ./apps filterNames
++ inputs.self.lib.autoImport ./dev filterNames
++ inputs.self.lib.autoImport ./scripts filterNames
++ inputs.self.lib.autoImport ./servers filterNames
++ inputs.self.lib.autoImport ./services filterNames
++ inputs.self.lib.autoImport ./shell filterNames
++ inputs.self.lib.autoImport ./network filterNames
++ [
./nix/build.nix
./users/nixremote.nix

View File

@@ -1,6 +1,10 @@
{ lib, config, ... }:
{
lib,
config,
inputs,
...
}:
let
setup = import ../factories/mkserver.nix { inherit lib config; };
proxyReverseServices = [
"firefox-syncserver"
"readeck"
@@ -44,11 +48,11 @@ let
cfg = config.my.servers.${serviceName};
proxyFunc =
if serviceConfig.type == "proxyReverse" then
setup.proxyReverse
inputs.self.lib.proxyReverse
else if serviceConfig.type == "proxyReverseFix" then
setup.proxyReverseFix
inputs.self.lib.proxyReverseFix
else if serviceConfig.type == "proxyReversePrivate" then
setup.proxyReversePrivate
inputs.self.lib.proxyReversePrivate
else
throw "Unknown proxy type: ${serviceConfig.type}";
in

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,14 @@
{ lib, config, ... }:
{
lib,
config,
inputs,
...
}:
let
cfg = config.my.servers.homepage;
setup = import ../factories/mkserver.nix { inherit lib config; };
in
{
options.my.servers.homepage = setup.mkOptions "homepage" "home" 8082;
options.my.servers.homepage = inputs.self.lib.mkServerOptions "homepage" "home" 8082 lib;
config = lib.mkIf config.my.secureHost {
sops.secrets = lib.mkIf cfg.enable {
homepage.sopsFile = ../../secrets/homepage.yaml;

View File

@@ -19,10 +19,9 @@ let
pkgs.gum
sub-sync
];
setup = import ../factories/mkserver.nix { inherit lib config; };
in
{
options.my.servers.jellyfin = setup.mkOptions "jellyfin" "flix" 8096;
options.my.servers.jellyfin = inputs.self.lib.mkServerOptions "jellyfin" "flix" 8096 lib;
config = lib.mkIf (cfg.enable && config.my.secureHost) {
environment.systemPackages = [
pkgs.jellyfin-ffmpeg

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -31,12 +31,11 @@ let
pytensorflow = pkgs.python311.withPackages (ps: [ ps.tensorflow ]);
cfg = config.my.servers.nextcloud;
cfgC = config.my.servers.collabora;
setup = import ../factories/mkserver.nix { inherit lib config; };
in
{
options.my.servers = {
nextcloud = setup.mkOptions "nextcloud" "cloud" 80;
collabora = setup.mkOptions "collabora" "collabora" 9980;
nextcloud = inputs.self.lib.mkServerOptions "nextcloud" "cloud" 80 lib;
collabora = inputs.self.lib.mkServerOptions "collabora" "collabora" 9980 lib;
go-vod.enable = lib.mkEnableOption "Go-VOD video transcoding service";
};
config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable && config.my.secureHost) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
{
lib,
inputs,
config,
pkgs,
...
@@ -8,7 +9,6 @@ let
cfg = config.my.servers.synapse;
cfgE = config.my.servers.element;
domain = "wedsgk5ac2qcaf9yb.click";
setup = import ../factories/mkserver.nix { inherit lib config; };
clientConfig."m.homeserver".base_url = cfg.url;
serverConfig."m.server" = "${cfg.host}:443";
mkWellKnown = data: ''
@@ -19,8 +19,8 @@ let
in
{
options.my.servers = {
synapse = setup.mkOptions "synapse" "pYLemuAfsrzNBaH77xSu" 8008;
element = setup.mkOptions "element" "55a608953f6d64c199" 5345;
synapse = inputs.self.lib.mkServerOptions "synapse" "pYLemuAfsrzNBaH77xSu" 8008 lib;
element = inputs.self.lib.mkServerOptions "element" "55a608953f6d64c199" 5345 lib;
};
config = lib.mkIf (cfg.enable && config.my.secureHost) {
my.servers = {

View File

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

View File

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