1
0
Fork 0

Services: replace 'requires' with 'RequiresMountsFor' based on feedback

This commit is contained in:
Aires 2024-08-29 11:59:28 -04:00
parent 0ce77db45a
commit 9c6a51d857
6 changed files with 18 additions and 50 deletions

View file

@ -138,19 +138,16 @@ in
enable = true;
home = "${services-root}/deluge";
domain = config.secrets.networking.primaryDomain;
requires = [ "storage.mount" ];
url = config.secrets.services.deluge.url;
};
duplicacy-web = {
enable = true;
requires = [ "storage.mount" ];
environment = "/storage/backups/settings/Haven";
home = "/storage/backups/settings/Haven";
};
forgejo = {
enable = true;
home = "${services-root}/forgejo";
domain = config.secrets.networking.primaryDomain;
requires = [ "storage.mount" ];
url = config.secrets.services.forgejo.url;
actions = {
enable = true;
@ -161,7 +158,6 @@ in
enable = true;
home = "${services-root}/jellyfin";
domain = config.secrets.networking.primaryDomain;
requires = [ "storage.mount" ];
url = config.secrets.services.jellyfin.url;
};
msmtp.enable = true;

View file

@ -28,12 +28,6 @@ in
description = "The complete URL where Airsonic is hosted.";
example = "https://forgejo.example.com";
};
requires = lib.mkOption {
default = [ ];
type = lib.types.listOf lib.types.str;
description = "If this service depends on other systemd units (e.g. a *.mount unit), enter their name(s) here.";
example = [ "storage.mount" ];
};
};
};
@ -75,8 +69,9 @@ in
} // lib.optionalAttrs (cfg.home != "") { home = cfg.home; };
};
systemd.services.nginx.wants = [ config.systemd.services.airsonic.name ];
# Don't start this service until after these services
systemd.services.airsonic = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; };
systemd.services = {
airsonic = lib.mkIf (cfg.home != "") { unitConfig.RequiresMountsFor = cfg.home; };
nginx.wants = [ config.systemd.services.airsonic.name ];
};
};
}

View file

@ -25,12 +25,6 @@ in
description = "The complete URL where Deluge is hosted.";
example = "https://deluge.example.com";
};
requires = lib.mkOption {
default = [ ];
type = lib.types.listOf lib.types.str;
description = "If this service depends on other systemd units (e.g. a *.mount unit), enter their name(s) here.";
example = [ "storage.mount" ];
};
};
};
@ -58,7 +52,6 @@ in
};
};
# Don't start this service until after these services
systemd.services.deluge = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; };
systemd.services.deluge = lib.mkIf (cfg.home != "") { unitConfig.RequiresMountsFor = cfg.home; };
};
}

View file

@ -13,17 +13,11 @@ in
options = {
aux.system.services.duplicacy-web = {
enable = lib.mkEnableOption "Enables duplicacy-web";
environment = lib.mkOption {
home = lib.mkOption {
default = "";
type = lib.types.str;
description = "Environment where duplicacy-web stores its config files";
};
requires = lib.mkOption {
default = [ ];
type = lib.types.listOf lib.types.str;
description = "If this service depends on other systemd units (e.g. a *.mount unit), enter their name(s) here.";
example = [ "storage.mount" ];
};
};
};
@ -50,8 +44,8 @@ in
KillMode = "process";
};
environment = {
HOME = cfg.environment;
HOME = cfg.home;
};
} // lib.optionalAttrs (cfg.requires != [ ]) { requires = cfg.requires; };
} // lib.optionalAttrs (cfg.home != "") { unitConfig.RequiresMountsFor = cfg.home; };
};
}

View file

@ -37,12 +37,6 @@ in
description = "Where to store Forgejo's files";
example = "/home/forgejo";
};
requires = lib.mkOption {
default = [ ];
type = lib.types.listOf lib.types.str;
description = "If this service depends on other systemd units (e.g. a *.mount unit), enter their name(s) here.";
example = [ "storage.mount" ];
};
url = lib.mkOption {
default = "";
type = lib.types.str;
@ -109,8 +103,6 @@ in
};
};
systemd.services.nginx.wants = [ config.systemd.services.forgejo.name ];
# Enable Podman for running...uh, runners.
virtualisation = lib.mkIf cfg.actions.enable {
containers.enable = true;
@ -130,7 +122,10 @@ in
allowedTCPPorts = [ 53 ];
allowedUDPPorts = [ 53 ];
};
# Don't start this service until after these services
systemd.services.forgejo = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; };
systemd.services = {
forgejo = lib.mkIf (cfg.home != "") { unitConfig.RequiresMountsFor = cfg.home; };
nginx.wants = [ config.systemd.services.forgejo.name ];
};
};
}

View file

@ -26,12 +26,6 @@ in
description = "The root domain that Jellyfin will be hosted on.";
example = "example.com";
};
requires = lib.mkOption {
default = [ ];
type = lib.types.listOf lib.types.str;
description = "If this service depends on other systemd units (e.g. a *.mount unit), enter their name(s) here.";
example = [ "storage.mount" ];
};
url = lib.mkOption {
default = "";
type = lib.types.str;
@ -102,8 +96,9 @@ in
yt-dlp
];
systemd.services.nginx.wants = [ config.systemd.services.jellyfin.name ];
# Don't start this service until after these services
systemd.services.jellyfin = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; };
systemd.services = {
jellyfin = lib.mkIf (cfg.home != "") { unitConfig.RequiresMountsFor = cfg.home; };
nginx.wants = [ config.systemd.services.jellyfin.name ];
};
};
}