nixos/dockerRegistry: add package option

This allows the module user to select an alternative container registry
package such as `pkgs.gitlab-container-registry` for GitLab users.
This commit is contained in:
Yaya 2023-05-31 15:10:17 +00:00 committed by Yureka
parent 82d9c2e91f
commit 049d680510

View File

@ -49,6 +49,14 @@ in {
options.services.dockerRegistry = {
enable = mkEnableOption (lib.mdDoc "Docker Registry");
package = mkOption {
type = types.package;
description = mdDoc "Which Docker registry package to use.";
default = pkgs.docker-distribution;
defaultText = literalExpression "pkgs.docker-distribution";
example = literalExpression "pkgs.gitlab-container-registry";
};
listenAddress = mkOption {
description = lib.mdDoc "Docker registry host or ip to bind to.";
default = "127.0.0.1";
@ -117,7 +125,7 @@ in {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
script = ''
${pkgs.docker-distribution}/bin/registry serve ${configFile}
${cfg.package}/bin/registry serve ${configFile}
'';
serviceConfig = {
@ -136,7 +144,7 @@ in {
serviceConfig.Type = "oneshot";
script = ''
${pkgs.docker-distribution}/bin/registry garbage-collect ${configFile}
${cfg.package}/bin/registry garbage-collect ${configFile}
/run/current-system/systemd/bin/systemctl restart docker-registry.service
'';