]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/webapps/mastodon.nix
Adjust load warnings for monitoring
[perso/Immae/Config/Nix.git] / modules / webapps / mastodon.nix
index eed9e3f60d46760286adddace29cb791e4850f77..2f5a8e392027016791d7d3544b27d1ccbbb174a6 100644 (file)
@@ -27,7 +27,7 @@ in
       '';
     };
     socketsPrefix = lib.mkOption {
-      type = lib.types.string;
+      type = lib.types.str;
       default = "live";
       description = ''
         The prefix to use for Mastodon sockets.
@@ -96,18 +96,24 @@ in
   };
 
   config = lib.mkIf cfg.enable {
-    users.users = lib.optionalAttrs (cfg.user == name) (lib.singleton {
-      inherit name;
-      inherit uid;
-      group = cfg.group;
-      description = "Mastodon user";
-      home = cfg.dataDir;
-      useDefaultShell = true;
-    });
-    users.groups = lib.optionalAttrs (cfg.group == name) (lib.singleton {
-      inherit name;
-      inherit gid;
-    });
+    users.users = lib.optionalAttrs (cfg.user == name) {
+      "${name}" = {
+        inherit uid;
+        group = cfg.group;
+        description = "Mastodon user";
+        home = cfg.dataDir;
+        useDefaultShell = true;
+      };
+    };
+    users.groups = lib.optionalAttrs (cfg.group == name) {
+      "${name}" = {
+        inherit gid;
+      };
+    };
+
+    systemd.slices.mastodon = {
+      description = "Mastodon slice";
+    };
 
     systemd.services.mastodon-streaming = {
       description = "Mastodon Streaming";
@@ -135,6 +141,7 @@ in
       '';
 
       serviceConfig = {
+        Slice = "mastodon.slice";
         User = cfg.user;
         EnvironmentFile = cfg.configFile;
         PrivateTmp = true;
@@ -175,6 +182,7 @@ in
         exec ./bin/tootctl cache clear
         '';
       serviceConfig = {
+        Slice = "mastodon.slice";
         User = cfg.user;
         EnvironmentFile = cfg.configFile;
         PrivateTmp = true;
@@ -237,6 +245,7 @@ in
       '';
 
       serviceConfig = {
+        Slice = "mastodon.slice";
         User = cfg.user;
         EnvironmentFile = cfg.configFile;
         PrivateTmp = true;