summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerstin <kerstin@erictapen.name>2022-10-26 22:21:48 +0200
committerGitHub <noreply@github.com>2022-10-26 22:21:48 +0200
commit0a773b4ddf75c41c08a46f5c979f435bbfa6f6cb (patch)
treef9c1da2ffa9fc9e2e8f9ac837799215eae35e95a
parentMerge pull request #197625 from risicle/ris--rabbitmq-server-3.9.18-r22.05 (diff)
parentnixos/mastodon: fix start services (diff)
downloadnixpkgs-0a773b4ddf75c41c08a46f5c979f435bbfa6f6cb.tar.gz
Merge pull request #197924 from NixOS/backport-197893-to-release-22.05
[Backport release-22.05] nixos/mastodon: fix start services
-rw-r--r--nixos/modules/services/web-apps/mastodon.nix40
1 files changed, 25 insertions, 15 deletions
diff --git a/nixos/modules/services/web-apps/mastodon.nix b/nixos/modules/services/web-apps/mastodon.nix
index 03adaadff93d..2f21776deddb 100644
--- a/nixos/modules/services/web-apps/mastodon.nix
+++ b/nixos/modules/services/web-apps/mastodon.nix
@@ -475,7 +475,6 @@ in {
} // cfgService;
after = [ "network.target" ];
- wantedBy = [ "multi-user.target" ];
};
systemd.services.mastodon-init-db = lib.mkIf cfg.automaticMigrations {
@@ -500,16 +499,21 @@ in {
# System Call Filtering
SystemCallFilter = [ ("~" + lib.concatStringsSep " " (systemCallsList ++ [ "@resources" ])) "@chown" "pipe" "pipe2" ];
} // cfgService;
- after = [ "mastodon-init-dirs.service" "network.target" ] ++ (if databaseActuallyCreateLocally then [ "postgresql.service" ] else []);
- wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" "mastodon-init-dirs.service" ]
+ ++ lib.optional databaseActuallyCreateLocally "postgresql.service";
+ requires = [ "mastodon-init-dirs.service" ]
+ ++ lib.optional databaseActuallyCreateLocally "postgresql.service";
};
systemd.services.mastodon-streaming = {
- after = [ "network.target" ]
- ++ (if databaseActuallyCreateLocally then [ "postgresql.service" ] else [])
- ++ (if cfg.automaticMigrations then [ "mastodon-init-db.service" ] else [ "mastodon-init-dirs.service" ]);
- description = "Mastodon streaming";
+ after = [ "network.target" "mastodon-init-dirs.service" ]
+ ++ lib.optional databaseActuallyCreateLocally "postgresql.service"
+ ++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
+ requires = [ "mastodon-init-dirs.service" ]
+ ++ lib.optional databaseActuallyCreateLocally "postgresql.service"
+ ++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
wantedBy = [ "multi-user.target" ];
+ description = "Mastodon streaming";
environment = env // (if cfg.enableUnixSocket
then { SOCKET = "/run/mastodon-streaming/streaming.socket"; }
else { PORT = toString(cfg.streamingPort); }
@@ -529,11 +533,14 @@ in {
};
systemd.services.mastodon-web = {
- after = [ "network.target" ]
- ++ (if databaseActuallyCreateLocally then [ "postgresql.service" ] else [])
- ++ (if cfg.automaticMigrations then [ "mastodon-init-db.service" ] else [ "mastodon-init-dirs.service" ]);
- description = "Mastodon web";
+ after = [ "network.target" "mastodon-init-dirs.service" ]
+ ++ lib.optional databaseActuallyCreateLocally "postgresql.service"
+ ++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
+ requires = [ "mastodon-init-dirs.service" ]
+ ++ lib.optional databaseActuallyCreateLocally "postgresql.service"
+ ++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
wantedBy = [ "multi-user.target" ];
+ description = "Mastodon web";
environment = env // (if cfg.enableUnixSocket
then { SOCKET = "/run/mastodon-web/web.socket"; }
else { PORT = toString(cfg.webPort); }
@@ -554,11 +561,14 @@ in {
};
systemd.services.mastodon-sidekiq = {
- after = [ "network.target" ]
- ++ (if databaseActuallyCreateLocally then [ "postgresql.service" ] else [])
- ++ (if cfg.automaticMigrations then [ "mastodon-init-db.service" ] else [ "mastodon-init-dirs.service" ]);
- description = "Mastodon sidekiq";
+ after = [ "network.target" "mastodon-init-dirs.service" ]
+ ++ lib.optional databaseActuallyCreateLocally "postgresql.service"
+ ++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
+ requires = [ "mastodon-init-dirs.service" ]
+ ++ lib.optional databaseActuallyCreateLocally "postgresql.service"
+ ++ lib.optional cfg.automaticMigrations "mastodon-init-db.service";
wantedBy = [ "multi-user.target" ];
+ description = "Mastodon sidekiq";
environment = env // {
PORT = toString(cfg.sidekiqPort);
DB_POOL = toString cfg.sidekiqThreads;