Services: replace 'autostart' with a more useful 'requires' option
This commit is contained in:
parent
86e3cb01cc
commit
0ce77db45a
|
@ -136,21 +136,21 @@ in
|
||||||
boinc.enable = true;
|
boinc.enable = true;
|
||||||
deluge = {
|
deluge = {
|
||||||
enable = true;
|
enable = true;
|
||||||
autostart = false;
|
|
||||||
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;
|
||||||
autostart = false;
|
requires = [ "storage.mount" ];
|
||||||
environment = "/storage/backups/settings/Haven";
|
environment = "/storage/backups/settings/Haven";
|
||||||
};
|
};
|
||||||
forgejo = {
|
forgejo = {
|
||||||
enable = true;
|
enable = true;
|
||||||
autostart = false;
|
|
||||||
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;
|
||||||
|
@ -159,9 +159,9 @@ in
|
||||||
};
|
};
|
||||||
jellyfin = {
|
jellyfin = {
|
||||||
enable = true;
|
enable = true;
|
||||||
autostart = false;
|
|
||||||
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;
|
||||||
|
|
|
@ -10,7 +10,6 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
aux.system.services.airsonic = {
|
aux.system.services.airsonic = {
|
||||||
autostart = lib.mkEnableOption (lib.mdDoc "Automatically starts Airsonic at boot.");
|
|
||||||
enable = lib.mkEnableOption (lib.mdDoc "Enables Airsonic Advanced media streaming service.");
|
enable = lib.mkEnableOption (lib.mdDoc "Enables Airsonic Advanced media streaming service.");
|
||||||
home = lib.mkOption {
|
home = lib.mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -29,6 +28,12 @@ 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" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,7 +76,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.nginx.wants = [ config.systemd.services.airsonic.name ];
|
systemd.services.nginx.wants = [ config.systemd.services.airsonic.name ];
|
||||||
# Disable autostart if configured
|
# Don't start this service until after these services
|
||||||
systemd.services.airsonic = lib.mkIf (!cfg.autostart) { wantedBy = lib.mkForce [ ]; };
|
systemd.services.airsonic = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
aux.system.services.deluge = {
|
aux.system.services.deluge = {
|
||||||
autostart = lib.mkEnableOption "Automatically starts Deluge at boot.";
|
|
||||||
enable = lib.mkEnableOption "Enables Deluge.";
|
enable = lib.mkEnableOption "Enables Deluge.";
|
||||||
home = lib.mkOption {
|
home = lib.mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -26,6 +25,12 @@ 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" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -52,5 +57,8 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Don't start this service until after these services
|
||||||
|
systemd.services.deluge = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,17 +13,17 @@ 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";
|
||||||
autostart = lib.mkOption {
|
|
||||||
default = true;
|
|
||||||
type = lib.types.bool;
|
|
||||||
description = "Whether to auto-start duplicacy-web on boot";
|
|
||||||
};
|
|
||||||
|
|
||||||
environment = lib.mkOption {
|
environment = 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" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,6 +52,6 @@ in
|
||||||
environment = {
|
environment = {
|
||||||
HOME = cfg.environment;
|
HOME = cfg.environment;
|
||||||
};
|
};
|
||||||
} // lib.optionalAttrs (!cfg.autostart) { wantedBy = lib.mkForce [ ]; };
|
} // lib.optionalAttrs (cfg.requires != [ ]) { requires = cfg.requires; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
aux.system.services.forgejo = {
|
aux.system.services.forgejo = {
|
||||||
autostart = lib.mkEnableOption (lib.mdDoc "Automatically starts Forgejo at boot.");
|
|
||||||
enable = lib.mkEnableOption (lib.mdDoc "Enables Forgejo Git hosting service.");
|
enable = lib.mkEnableOption (lib.mdDoc "Enables Forgejo Git hosting service.");
|
||||||
domain = lib.mkOption {
|
domain = lib.mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -38,6 +37,12 @@ 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;
|
||||||
|
@ -125,7 +130,7 @@ in
|
||||||
allowedTCPPorts = [ 53 ];
|
allowedTCPPorts = [ 53 ];
|
||||||
allowedUDPPorts = [ 53 ];
|
allowedUDPPorts = [ 53 ];
|
||||||
};
|
};
|
||||||
# Disable autostart if configured
|
# Don't start this service until after these services
|
||||||
systemd.services.forgejo = lib.mkIf (!cfg.autostart) { wantedBy = lib.mkForce [ ]; };
|
systemd.services.forgejo = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
aux.system.services.jellyfin = {
|
aux.system.services.jellyfin = {
|
||||||
autostart = lib.mkEnableOption (lib.mdDoc "Automatically starts Jellyfin at boot.");
|
|
||||||
enable = lib.mkEnableOption (lib.mdDoc "Enables the Jellyfin media streaming service.");
|
enable = lib.mkEnableOption (lib.mdDoc "Enables the Jellyfin media streaming service.");
|
||||||
home = lib.mkOption {
|
home = lib.mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -27,6 +26,12 @@ 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;
|
||||||
|
@ -98,7 +103,7 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services.nginx.wants = [ config.systemd.services.jellyfin.name ];
|
systemd.services.nginx.wants = [ config.systemd.services.jellyfin.name ];
|
||||||
# Disable autostart if configured
|
# Don't start this service until after these services
|
||||||
systemd.services.jellyfin = lib.mkIf (!cfg.autostart) { wantedBy = lib.mkForce [ ]; };
|
systemd.services.jellyfin = lib.mkIf (cfg.requires != [ ]) { requires = cfg.requires; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue