about summary refs log tree commit diff
path: root/nixos/modules/services/misc/docker-registry.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/misc/docker-registry.nix')
-rw-r--r--nixos/modules/services/misc/docker-registry.nix15
1 files changed, 7 insertions, 8 deletions
diff --git a/nixos/modules/services/misc/docker-registry.nix b/nixos/modules/services/misc/docker-registry.nix
index d25fd13a77df..f472e530a70b 100644
--- a/nixos/modules/services/misc/docker-registry.nix
+++ b/nixos/modules/services/misc/docker-registry.nix
@@ -29,7 +29,7 @@ in {
 
     storagePath = mkOption {
       type = types.path;
-      default = "/var/lib/docker/registry";
+      default = "/var/lib/docker-registry";
       description = "Docker registry storage path.";
     };
 
@@ -61,14 +61,9 @@ in {
         User = "docker-registry";
         Group = "docker";
         PermissionsStartOnly = true;
+        WorkingDirectory = cfg.storagePath;
       };
 
-      preStart = ''
-        mkdir -p ${cfg.storagePath}
-        if [ "$(id -u)" = 0 ]; then
-          chown -R docker-registry:docker ${cfg.storagePath}
-        fi
-      '';
       postStart = ''
         until ${pkgs.curl}/bin/curl -s -o /dev/null 'http://${cfg.host}:${toString cfg.port}/'; do
           sleep 1;
@@ -77,6 +72,10 @@ in {
     };
 
     users.extraGroups.docker.gid = mkDefault config.ids.gids.docker;
-    users.extraUsers.docker-registry.uid = config.ids.uids.docker-registry;
+    users.extraUsers.docker-registry = {
+      createHome = true;
+      home = cfg.storagePath;
+      uid = config.ids.uids.docker-registry;
+    };
   };
 }