about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/misc/docker-registry.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/services/misc/docker-registry.nix')
-rw-r--r--nixpkgs/nixos/modules/services/misc/docker-registry.nix38
1 files changed, 24 insertions, 14 deletions
diff --git a/nixpkgs/nixos/modules/services/misc/docker-registry.nix b/nixpkgs/nixos/modules/services/misc/docker-registry.nix
index 78d1d6339ed6..93bf71ea3ecc 100644
--- a/nixpkgs/nixos/modules/services/misc/docker-registry.nix
+++ b/nixpkgs/nixos/modules/services/misc/docker-registry.nix
@@ -41,24 +41,23 @@ let
     };
   };
 
-  configFile = pkgs.writeText "docker-registry-config.yml" (builtins.toJSON (recursiveUpdate registryConfig cfg.extraConfig));
-
+  configFile = cfg.configFile;
 in {
   options.services.dockerRegistry = {
-    enable = mkEnableOption (lib.mdDoc "Docker Registry");
+    enable = mkEnableOption "Docker Registry";
 
     package = mkPackageOption pkgs "docker-distribution" {
       example = "gitlab-container-registry";
     };
 
     listenAddress = mkOption {
-      description = lib.mdDoc "Docker registry host or ip to bind to.";
+      description = "Docker registry host or ip to bind to.";
       default = "127.0.0.1";
       type = types.str;
     };
 
     port = mkOption {
-      description = lib.mdDoc "Docker registry port to bind to.";
+      description = "Docker registry port to bind to.";
       default = 5000;
       type = types.port;
     };
@@ -66,13 +65,13 @@ in {
     openFirewall = mkOption {
       type = types.bool;
       default = false;
-      description = lib.mdDoc "Opens the port used by the firewall.";
+      description = "Opens the port used by the firewall.";
     };
 
     storagePath = mkOption {
       type = types.nullOr types.path;
       default = "/var/lib/docker-registry";
-      description = lib.mdDoc ''
+      description = ''
         Docker registry storage path for the filesystem storage backend. Set to
         null to configure another backend via extraConfig.
       '';
@@ -81,37 +80,48 @@ in {
     enableDelete = mkOption {
       type = types.bool;
       default = false;
-      description = lib.mdDoc "Enable delete for manifests and blobs.";
+      description = "Enable delete for manifests and blobs.";
     };
 
-    enableRedisCache = mkEnableOption (lib.mdDoc "redis as blob cache");
+    enableRedisCache = mkEnableOption "redis as blob cache";
 
     redisUrl = mkOption {
       type = types.str;
       default = "localhost:6379";
-      description = lib.mdDoc "Set redis host and port.";
+      description = "Set redis host and port.";
     };
 
     redisPassword = mkOption {
       type = types.str;
       default = "";
-      description = lib.mdDoc "Set redis password.";
+      description = "Set redis password.";
     };
 
     extraConfig = mkOption {
-      description = lib.mdDoc ''
+      description = ''
         Docker extra registry configuration via environment variables.
       '';
       default = {};
       type = types.attrs;
     };
 
-    enableGarbageCollect = mkEnableOption (lib.mdDoc "garbage collect");
+    configFile = lib.mkOption {
+      default = pkgs.writeText "docker-registry-config.yml" (builtins.toJSON (recursiveUpdate registryConfig cfg.extraConfig));
+      defaultText = literalExpression ''pkgs.writeText "docker-registry-config.yml" "# my custom docker-registry-config.yml ..."'';
+      description = ''
+       Path to CNCF distribution config file.
+
+       Setting this option will override any configuration applied by the extraConfig option.
+      '';
+      type =  types.path;
+    };
+
+    enableGarbageCollect = mkEnableOption "garbage collect";
 
     garbageCollectDates = mkOption {
       default = "daily";
       type = types.str;
-      description = lib.mdDoc ''
+      description = ''
         Specification (in the format described by
         {manpage}`systemd.time(7)`) of the time at
         which the garbage collect will occur.