]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/databases/redis.nix
Write peertube flake
[perso/Immae/Config/Nix.git] / modules / private / databases / redis.nix
index 4b26283ee1b928887653445b74c8721775c34ff5..bc6460ffa2405e2f94d213d3c78ece883ada78fd 100644 (file)
@@ -17,16 +17,6 @@ in {
         '';
     };
     # Output variables
-    systemdRuntimeDirectory = lib.mkOption {
-      type = lib.types.str;
-      # Use ReadWritePaths= instead if socketsDir is outside of /run
-      default = assert lib.strings.hasPrefix "/run/" cfg.socketsDir;
-        lib.strings.removePrefix "/run/" cfg.socketsDir;
-      description = ''
-      Adjusted redis sockets directory for systemd
-      '';
-      readOnly = true;
-    };
     sockets = lib.mkOption {
       type = lib.types.attrsOf lib.types.path;
       default = {
@@ -51,7 +41,7 @@ in {
         maxclients 1024
         '';
     };
-    systemd.services.redis.serviceConfig.RuntimeDirectory = cfg.systemdRuntimeDirectory;
+    systemd.services.redis.serviceConfig.Slice = "redis.slice";
 
     services.spiped = {
       enable = true;
@@ -68,8 +58,9 @@ in {
       wantedBy = [ "multi-user.target" ];
 
       serviceConfig = {
-        Restart   = "always";
-        User      = "spiped";
+        Slice = "redis.slice";
+        Restart = "always";
+        User = "spiped";
         PermissionsStartOnly = true;
         SupplementaryGroups = "keys";
       };
@@ -119,12 +110,17 @@ in {
       }
     ];
 
+    systemd.slices.redis = {
+      description = "Redis slice";
+    };
+
     systemd.services.predixy = {
       description = "Redis proxy";
       wantedBy = [ "multi-user.target" ];
       after = [ "redis.service" ];
 
       serviceConfig = {
+        Slice = "redis.slice";
         User = "redis";
         Group = "redis";
         SupplementaryGroups = "keys";