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

View file

@ -28,12 +28,6 @@ in
description = "The complete URL where Airsonic is hosted."; description = "The complete URL where Airsonic is hosted.";
example = "https://forgejo.example.com"; 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; }; } // lib.optionalAttrs (cfg.home != "") { home = cfg.home; };
}; };
systemd.services.nginx.wants = [ config.systemd.services.airsonic.name ]; systemd.services = {
# Don't start this service until after these services airsonic = lib.mkIf (cfg.home != "") { unitConfig.RequiresMountsFor = cfg.home; };
systemd.services.airsonic = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; }; nginx.wants = [ config.systemd.services.airsonic.name ];
};
}; };
} }

View file

@ -25,12 +25,6 @@ in
description = "The complete URL where Deluge is hosted."; description = "The complete URL where Deluge is hosted.";
example = "https://deluge.example.com"; 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.home != "") { unitConfig.RequiresMountsFor = cfg.home; };
systemd.services.deluge = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; };
}; };
} }

View file

@ -13,17 +13,11 @@ in
options = { options = {
aux.system.services.duplicacy-web = { aux.system.services.duplicacy-web = {
enable = lib.mkEnableOption "Enables duplicacy-web"; enable = lib.mkEnableOption "Enables duplicacy-web";
environment = lib.mkOption { home = lib.mkOption {
default = ""; default = "";
type = lib.types.str; type = lib.types.str;
description = "Environment where duplicacy-web stores its config files"; 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"; KillMode = "process";
}; };
environment = { 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"; description = "Where to store Forgejo's files";
example = "/home/forgejo"; 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 { url = lib.mkOption {
default = ""; default = "";
type = lib.types.str; type = lib.types.str;
@ -109,8 +103,6 @@ in
}; };
}; };
systemd.services.nginx.wants = [ config.systemd.services.forgejo.name ];
# Enable Podman for running...uh, runners. # Enable Podman for running...uh, runners.
virtualisation = lib.mkIf cfg.actions.enable { virtualisation = lib.mkIf cfg.actions.enable {
containers.enable = true; containers.enable = true;
@ -130,7 +122,10 @@ in
allowedTCPPorts = [ 53 ]; allowedTCPPorts = [ 53 ];
allowedUDPPorts = [ 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."; description = "The root domain that Jellyfin will be hosted on.";
example = "example.com"; 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 { url = lib.mkOption {
default = ""; default = "";
type = lib.types.str; type = lib.types.str;
@ -102,8 +96,9 @@ in
yt-dlp yt-dlp
]; ];
systemd.services.nginx.wants = [ config.systemd.services.jellyfin.name ]; systemd.services = {
# Don't start this service until after these services jellyfin = lib.mkIf (cfg.home != "") { unitConfig.RequiresMountsFor = cfg.home; };
systemd.services.jellyfin = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; }; nginx.wants = [ config.systemd.services.jellyfin.name ];
};
}; };
} }