about summary refs log tree commit diff
path: root/nixos/modules/services/misc/docker-registry.nix
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-03-12 17:32:29 -0400
committerRobin Gloster <mail@glob.in>2019-03-23 10:32:56 +0000
commit2036550a460d046adbb0364fb3da3a987a00caba (patch)
treefcde4ebba717ab5e4ac8c24e485fb8e084bcd667 /nixos/modules/services/misc/docker-registry.nix
parentd828bf7a1078f04b56b6fcde9e5949db4b7aaf9a (diff)
downloadnixlib-2036550a460d046adbb0364fb3da3a987a00caba.tar
nixlib-2036550a460d046adbb0364fb3da3a987a00caba.tar.gz
nixlib-2036550a460d046adbb0364fb3da3a987a00caba.tar.bz2
nixlib-2036550a460d046adbb0364fb3da3a987a00caba.tar.lz
nixlib-2036550a460d046adbb0364fb3da3a987a00caba.tar.xz
nixlib-2036550a460d046adbb0364fb3da3a987a00caba.tar.zst
nixlib-2036550a460d046adbb0364fb3da3a987a00caba.zip
nixos/docker-registry: Allow use of non-filesystem storage
Previously this module precluded use of storage backends other than
`filesystem`. It is now possible to configure another storage backend
manually by setting `services.dockerRegistry.storagePath` to `null` and
configuring the other backend via `extraConfig`.
Diffstat (limited to 'nixos/modules/services/misc/docker-registry.nix')
-rw-r--r--nixos/modules/services/misc/docker-registry.nix23
1 files changed, 15 insertions, 8 deletions
diff --git a/nixos/modules/services/misc/docker-registry.nix b/nixos/modules/services/misc/docker-registry.nix
index f3d90e532c88..c87607d2666a 100644
--- a/nixos/modules/services/misc/docker-registry.nix
+++ b/nixos/modules/services/misc/docker-registry.nix
@@ -14,9 +14,10 @@ let
     log.fields.service = "registry";
     storage = {
       cache.blobdescriptor = blobCache;
-      filesystem.rootdirectory = cfg.storagePath;
       delete.enabled = cfg.enableDelete;
-    };
+    } // (if cfg.storagePath != null
+          then { filesystem.rootdirectory = cfg.storagePath; }
+          else {});
     http = {
       addr = "${cfg.listenAddress}:${builtins.toString cfg.port}";
       headers.X-Content-Type-Options = ["nosniff"];
@@ -61,9 +62,12 @@ in {
     };
 
     storagePath = mkOption {
-      type = types.path;
+      type = types.nullOr types.path;
       default = "/var/lib/docker-registry";
-      description = "Docker registry storage path.";
+      description = ''
+        Docker registry storage path for the filesystem storage backend. Set to
+        null to configure another backend via extraConfig.
+      '';
     };
 
     enableDelete = mkOption {
@@ -140,9 +144,12 @@ in {
       startAt = optional cfg.enableGarbageCollect cfg.garbageCollectDates;
     };
 
-    users.users.docker-registry = {
-      createHome = true;
-      home = cfg.storagePath;
-    };
+    users.users.docker-registry =
+      if cfg.storagePath != null
+      then {
+        createHome = true;
+        home = cfg.storagePath;
+      }
+      else {};
   };
 }