refactor: update all network services to pull the new configuration format
This commit is contained in:
parent
6bb617962a
commit
e31bdb4b01
25 changed files with 174 additions and 221 deletions
|
|
@ -6,27 +6,24 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption filterAttrs attrNames head mkForce;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace resolveHostIP readJsonOrEmpty getIn;
|
||||
inherit (lib) mkIf filterAttrs attrNames head mkForce;
|
||||
inherit (lib.${namespace}) getAttrByNamespace resolveHostIP readJsonOrEmpty getIn hostHasService flattenHostServices getServicePort;
|
||||
inherit (config.networking) hostName;
|
||||
base = "${namespace}.services.apps.forgejo";
|
||||
cfg = getAttrByNamespace config base;
|
||||
pgCfg = getAttrByNamespace config "${namespace}.services.storage.postgresql";
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = flattenHostServices networkCfg.network-services;
|
||||
|
||||
pgCfg = getAttrByNamespace config "${namespace}.services.storage.postgresql";
|
||||
dbHost =
|
||||
pgCfg.databases
|
||||
|> filterAttrs (host: dbs: lib.elem "forgejo" dbs)
|
||||
|> attrNames
|
||||
|> head;
|
||||
|
||||
port = 5300;
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "git";
|
||||
port = getServicePort networkServices "git" 5300;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "forgejo";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf isEnabled {
|
||||
services.forgejo = {
|
||||
enable = true;
|
||||
package = pkgs.forgejo;
|
||||
|
|
|
|||
|
|
@ -5,22 +5,21 @@
|
|||
namespace,
|
||||
...
|
||||
} @ args: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.glance";
|
||||
cfg = getAttrByNamespace config base;
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService flattenHostServices getServicePort;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
port = 5150;
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = flattenHostServices networkCfg.network-services;
|
||||
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "dash";
|
||||
port = getServicePort networkServices "dash" 5150;
|
||||
in {
|
||||
imports = [
|
||||
(import ./layout.nix args)
|
||||
];
|
||||
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "glance";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf isEnabled {
|
||||
services.glance = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
|
|
|
|||
|
|
@ -4,13 +4,15 @@
|
|||
lib,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.${namespace}; let
|
||||
base = "${namespace}.services.apps.glance";
|
||||
cfg = getAttrByNamespace config base;
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace getIn readJsonOrEmpty hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "dash";
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf isEnabled {
|
||||
services.glance.settings = {
|
||||
branding = {
|
||||
app-name = "dash";
|
||||
|
|
|
|||
|
|
@ -6,20 +6,19 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption attrNames filterAttrs elem head;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace resolveHostIP readJsonOrEmpty getIn;
|
||||
base = "${namespace}.services.apps.grafana";
|
||||
cfg = getAttrByNamespace config base;
|
||||
inherit (lib) mkIf attrNames filterAttrs elem head;
|
||||
inherit (lib.${namespace}) getAttrByNamespace resolveHostIP readJsonOrEmpty getIn hostHasService flattenHostServices getServicePort;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
pgCfg = getAttrByNamespace config "${namespace}.services.storage.postgresql";
|
||||
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = flattenHostServices networkCfg.network-services;
|
||||
|
||||
port = 5500;
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "grafana";
|
||||
port = getServicePort networkServices "grafana" 5500;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "Grafana";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf isEnabled {
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
|
|
|||
|
|
@ -7,17 +7,16 @@
|
|||
with lib;
|
||||
with lib.${namespace}; let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.ntfy";
|
||||
cfg = getAttrByNamespace config base;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService flattenHostServices getServicePort;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
port = 5201;
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = flattenHostServices networkCfg.network-services;
|
||||
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "ntfy";
|
||||
port = getServicePort networkServices "ntfy" 5201;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "ntfy";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf isEnabled {
|
||||
services.ntfy-sh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
|
|
|||
|
|
@ -7,16 +7,21 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace hostHasService flattenHostServices getServicePort;
|
||||
inherit (config.users) users groups;
|
||||
inherit (config.sops) secrets;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
base = "${namespace}.services.apps.rustypaste";
|
||||
cfg = getAttrByNamespace config base;
|
||||
|
||||
port = 5100;
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = flattenHostServices networkCfg.network-services;
|
||||
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "paste";
|
||||
port = getServicePort networkServices "paste" 5100;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "rustypaste server";
|
||||
client = {
|
||||
enable = mkEnableOption "rustypaste client";
|
||||
};
|
||||
|
|
@ -25,7 +30,7 @@ in {
|
|||
config = {
|
||||
environment.systemPackages = mkIf cfg.client.enable (with pkgs; [rustypaste-cli]);
|
||||
|
||||
systemd.services.rustypaste = mkIf cfg.enable {
|
||||
systemd.services.rustypaste = mkIf isEnabled {
|
||||
description = "rustypaste";
|
||||
|
||||
wantedBy = ["multi-user.target"];
|
||||
|
|
@ -49,15 +54,15 @@ in {
|
|||
};
|
||||
|
||||
users = {
|
||||
users.rustypaste = mkIf cfg.enable {
|
||||
users.rustypaste = mkIf isEnabled {
|
||||
isSystemUser = true;
|
||||
group = "rustypaste";
|
||||
};
|
||||
|
||||
groups.rustypaste = mkIf (cfg.enable || cfg.client.enable) {};
|
||||
groups.rustypaste = mkIf (isEnabled || cfg.client.enable) {};
|
||||
};
|
||||
|
||||
environment.etc."rustypaste/rustypaste.toml" = mkIf cfg.enable {
|
||||
environment.etc."rustypaste/rustypaste.toml" = mkIf isEnabled {
|
||||
source = let
|
||||
crypt = "${inputs.self}/secrets/crypt/";
|
||||
in "${crypt}/rustypaste/server.toml";
|
||||
|
|
@ -65,25 +70,25 @@ in {
|
|||
mode = "0755";
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = mkIf cfg.enable [
|
||||
systemd.tmpfiles.rules = mkIf isEnabled [
|
||||
"d /var/lib/rustypaste 2750 ${users.rustypaste.name} ${users.rustypaste.group} -"
|
||||
];
|
||||
|
||||
sops.secrets = mkIf (cfg.enable || cfg.client.enable) {
|
||||
sops.secrets = mkIf (isEnabled || cfg.client.enable) {
|
||||
"rustypaste/auth" = {
|
||||
owner = mkIf cfg.enable users.rustypaste.name;
|
||||
owner = mkIf isEnabled users.rustypaste.name;
|
||||
group = groups.rustypaste.name;
|
||||
mode = "0440";
|
||||
};
|
||||
"rustypaste/delete" = {
|
||||
owner = mkIf cfg.enable users.rustypaste.name;
|
||||
owner = mkIf isEnabled users.rustypaste.name;
|
||||
group = groups.rustypaste.name;
|
||||
mode = "0440";
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = mkIf cfg.enable [port];
|
||||
networking.firewall.allowedTCPPorts = mkIf isEnabled [port];
|
||||
|
||||
${namespace}.services.storage.impermanence.folders = mkIf cfg.enable ["/var/lib/rustypaste"];
|
||||
${namespace}.services.storage.impermanence.folders = mkIf isEnabled ["/var/lib/rustypaste"];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.servarr.autobrr";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "autobrr";
|
||||
};
|
||||
inherit (lib) mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "autobrr";
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
services.autobrr = {
|
||||
enable = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.servarr.bazarr";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "bazarr";
|
||||
};
|
||||
inherit (lib) mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "bazarr";
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
services.bazarr = {
|
||||
enable = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.servarr.jellyfin";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "jellyfin";
|
||||
};
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "jellyfin";
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
services.jellyfin = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.servarr.jellyseerr";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "jellyseerr";
|
||||
};
|
||||
inherit (lib) mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "jellyseerr";
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
services.jellyseerr = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.servarr.lidarr";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "lidarr";
|
||||
};
|
||||
inherit (lib) mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "lidarr";
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
services.lidarr = {
|
||||
enable = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.servarr.ombi";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "ombi";
|
||||
};
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "ombi";
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
services.ombi = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.servarr.prowlarr";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "prowlarr";
|
||||
};
|
||||
inherit (lib) mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "prowlarr";
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
services.prowlarr = {
|
||||
enable = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.servarr.radarr";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "radarr";
|
||||
};
|
||||
inherit (lib) mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "radarr";
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
services.radarr = {
|
||||
enable = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.servarr.readarr";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "readarr";
|
||||
};
|
||||
inherit (lib) mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "readarr";
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
services.readarr = {
|
||||
enable = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.apps.servarr.sonarr";
|
||||
cfg = getAttrByNamespace config base;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "sonarr";
|
||||
};
|
||||
inherit (lib) mkForce mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "sonarr";
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
services.sonarr = {
|
||||
enable = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,19 +4,18 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption mkForce;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
inherit (lib) mkIf mkForce;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService flattenHostServices getServicePort;
|
||||
inherit (config.users) users;
|
||||
base = "${namespace}.services.apps.uptime-kuma";
|
||||
cfg = getAttrByNamespace config base;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
port = 5200;
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = flattenHostServices networkCfg.network-services;
|
||||
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "monitor";
|
||||
port = getServicePort networkServices "monitor" 5200;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "uptime-kuma";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf isEnabled {
|
||||
services.uptime-kuma = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
|
|
|||
|
|
@ -6,20 +6,19 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption filterAttrs attrNames head elem;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace readJsonOrEmpty getIn resolveHostIP;
|
||||
base = "${namespace}.services.apps.vaultwarden";
|
||||
cfg = getAttrByNamespace config base;
|
||||
inherit (lib) mkIf filterAttrs attrNames head elem;
|
||||
inherit (lib.${namespace}) getAttrByNamespace readJsonOrEmpty getIn resolveHostIP hostHasService flattenHostServices getServicePort;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
pgCfg = getAttrByNamespace config "${namespace}.services.storage.postgresql";
|
||||
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = flattenHostServices networkCfg.network-services;
|
||||
|
||||
port = 5400;
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "vault";
|
||||
port = getServicePort networkServices "vault" 5400;
|
||||
in {
|
||||
options = mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "vaultwarden";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = mkIf isEnabled {
|
||||
services.vaultwarden = {
|
||||
enable = true;
|
||||
package = pkgs.vaultwarden-postgresql;
|
||||
|
|
|
|||
|
|
@ -6,17 +6,24 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkOption mkEnableOption types mapAttrs' mkMerge filterAttrs listToAttrs;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace resolveHostIP;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace resolveHostIP hostHasService flattenHostServices getServicePort;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
base = "${namespace}.services.ci.woodpecker";
|
||||
cfg = getAttrByNamespace config base;
|
||||
networkingCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
|
||||
port = 5301;
|
||||
gprcPort = 5302;
|
||||
networkingCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = networkingCfg.network-services;
|
||||
networkServicesFlat = flattenHostServices networkServices;
|
||||
|
||||
woodpeckerHost = networkServicesFlat.woodpecker.host;
|
||||
|
||||
isEnabled = hostHasService networkServices hostName "woodpecker";
|
||||
port = getServicePort networkServicesFlat "woodpecker" 5301;
|
||||
gprcPort = port + 1;
|
||||
in {
|
||||
options = with types;
|
||||
mkOptionsWithNamespace base {
|
||||
enable = mkEnableOption "woodpecker";
|
||||
runners = mkOption {
|
||||
description = "Definition of runners to enable to the device";
|
||||
type = attrsOf (submodule {
|
||||
|
|
@ -42,7 +49,7 @@ in {
|
|||
services = let
|
||||
inherit (config.sops) secrets;
|
||||
in {
|
||||
woodpecker-server = mkIf cfg.enable {
|
||||
woodpecker-server = mkIf isEnabled {
|
||||
enable = true;
|
||||
environment = {
|
||||
WOODPECKER_HOST = "https://woodpecker.yumeami.sh";
|
||||
|
|
@ -71,7 +78,7 @@ in {
|
|||
environment = {
|
||||
WOODPECKER_SERVER = let
|
||||
woodpeckerIP =
|
||||
networkingCfg.network-services.woodpecker.host
|
||||
woodpeckerHost
|
||||
|> resolveHostIP networkingCfg.devices;
|
||||
in "${woodpeckerIP}:${toString gprcPort}";
|
||||
WOODPECKER_AGENT_SECRET_FILE =
|
||||
|
|
@ -97,7 +104,8 @@ in {
|
|||
};
|
||||
};
|
||||
in
|
||||
cfg.runners |> mapAttrs' mkRunnerCfg;
|
||||
cfg.runners
|
||||
|> mapAttrs' mkRunnerCfg;
|
||||
};
|
||||
|
||||
users = {
|
||||
|
|
@ -131,10 +139,9 @@ in {
|
|||
User = config.users.users.woodpecker.name;
|
||||
Group = config.users.users.woodpecker.group;
|
||||
inherit (config.networking) hostName;
|
||||
woodpeckerHost = networkingCfg.network-services.woodpecker.host;
|
||||
in
|
||||
mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
(mkIf isEnabled {
|
||||
woodpecker-server = {
|
||||
serviceConfig = {inherit User Group;};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mapAttrsToList listToAttrs;
|
||||
inherit (lib.${namespace}) getAttrByNamespace resolveHostIP flattenHostServices hostHasServices getServicePort;
|
||||
inherit (lib.${namespace}) getAttrByNamespace resolveHostIP flattenHostServices hostHasService getServicePort;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = flattenHostServices networkCfg.network-services;
|
||||
|
||||
isEnabled = hostHasServices networkCfg.network-services hostName;
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "blocky";
|
||||
port = getServicePort networkServices "blocky" 53;
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkOption types;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace hostHasServices flattenHostServices getServicePort;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace hostHasService flattenHostServices getServicePort;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
base = "${namespace}.services.networking.miasma";
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = flattenHostServices networkCfg.network-services;
|
||||
|
||||
isEnabled = hostHasServices networkCfg.network-services hostName;
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "miasma";
|
||||
port = getServicePort networkServices "miasma" 9999;
|
||||
in {
|
||||
options = with types;
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasServices flattenHostServices getServicePort;
|
||||
inherit (lib.${namespace}) getAttrByNamespace hostHasService flattenHostServices getServicePort;
|
||||
inherit (config.networking) hostName;
|
||||
|
||||
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
|
||||
networkServices = flattenHostServices networkCfg.network-services;
|
||||
|
||||
isEnabled = hostHasServices networkCfg.network-services hostName;
|
||||
isEnabled = hostHasService networkCfg.network-services hostName "unbound";
|
||||
port = getServicePort networkServices "unbound" 54;
|
||||
in {
|
||||
config = mkIf isEnabled {
|
||||
|
|
|
|||
|
|
@ -19,16 +19,8 @@ in {
|
|||
common = enabled;
|
||||
};
|
||||
services = {
|
||||
apps = {
|
||||
ntfy = enabled;
|
||||
uptime-kuma = enabled;
|
||||
};
|
||||
|
||||
networking = {
|
||||
# blocky = enabled;
|
||||
# cloudflared = enabled;
|
||||
httpd = enabled;
|
||||
# unbound = enabled;
|
||||
};
|
||||
|
||||
storage = {
|
||||
|
|
|
|||
|
|
@ -39,17 +39,6 @@ in {
|
|||
apps = {
|
||||
rustypaste.client = enabled;
|
||||
|
||||
servarr = {
|
||||
jellyfin = enabled;
|
||||
ombi = enabled;
|
||||
|
||||
prowlarr = enabled;
|
||||
radarr = enabled;
|
||||
sonarr = enabled;
|
||||
lidarr = enabled;
|
||||
bazarr = enabled;
|
||||
};
|
||||
|
||||
qbittorrent = enabled;
|
||||
};
|
||||
|
||||
|
|
@ -70,14 +59,13 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
woodpecker.runners = {
|
||||
primary.enable = true;
|
||||
woodpecker.runners.primary = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
httpd = enabled;
|
||||
miasma = enabled;
|
||||
};
|
||||
|
||||
storage = {
|
||||
|
|
|
|||
|
|
@ -19,14 +19,6 @@ in {
|
|||
};
|
||||
|
||||
services = {
|
||||
apps = {
|
||||
forgejo = enabled;
|
||||
glance = enabled;
|
||||
grafana = enabled;
|
||||
rustypaste = enabled;
|
||||
vaultwarden = enabled;
|
||||
};
|
||||
|
||||
ci = {
|
||||
gitea-runner = {
|
||||
enable = true;
|
||||
|
|
@ -34,20 +26,15 @@ in {
|
|||
capacity = 4;
|
||||
};
|
||||
};
|
||||
woodpecker = {
|
||||
woodpecker.runners.primary = {
|
||||
enable = true;
|
||||
runners.primary = {
|
||||
enable = true;
|
||||
capacity = 4;
|
||||
};
|
||||
capacity = 4;
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
blocky = enabled;
|
||||
cloudflared = enabled;
|
||||
httpd = enabled;
|
||||
unbound = enabled;
|
||||
};
|
||||
|
||||
storage = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue