diff --git a/hosts/Dimaga/default.nix b/hosts/Dimaga/default.nix index 40e6896..5684e12 100644 --- a/hosts/Dimaga/default.nix +++ b/hosts/Dimaga/default.nix @@ -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; diff --git a/modules/services/airsonic.nix b/modules/services/airsonic.nix index 040675a..cb0513d 100644 --- a/modules/services/airsonic.nix +++ b/modules/services/airsonic.nix @@ -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 ]; + }; }; } diff --git a/modules/services/deluge.nix b/modules/services/deluge.nix index 38999c3..6b1b8da 100644 --- a/modules/services/deluge.nix +++ b/modules/services/deluge.nix @@ -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; }; }; } diff --git a/modules/services/duplicacy-web.nix b/modules/services/duplicacy-web.nix index 9caa48a..41ae6c1 100644 --- a/modules/services/duplicacy-web.nix +++ b/modules/services/duplicacy-web.nix @@ -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; }; }; } diff --git a/modules/services/forgejo.nix b/modules/services/forgejo.nix index 43212b3..71de71f 100644 --- a/modules/services/forgejo.nix +++ b/modules/services/forgejo.nix @@ -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 ]; + }; }; } diff --git a/modules/services/jellyfin.nix b/modules/services/jellyfin.nix index 65cbae9..059c55c 100644 --- a/modules/services/jellyfin.nix +++ b/modules/services/jellyfin.nix @@ -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 ]; + }; }; }