nixos/docker-registry: docker independant docker registry

This commit is contained in:
Jaka Hudoklin 2015-04-25 14:23:31 +02:00
parent fd15fe4f09
commit b7cb0420ca

View File

@ -29,7 +29,7 @@ in {
storagePath = mkOption { storagePath = mkOption {
type = types.path; type = types.path;
default = "/var/lib/docker/registry"; default = "/var/lib/docker-registry";
description = "Docker registry storage path."; description = "Docker registry storage path.";
}; };
@ -61,14 +61,9 @@ in {
User = "docker-registry"; User = "docker-registry";
Group = "docker"; Group = "docker";
PermissionsStartOnly = true; PermissionsStartOnly = true;
WorkingDirectory = cfg.storagePath;
}; };
preStart = ''
mkdir -p ${cfg.storagePath}
if [ "$(id -u)" = 0 ]; then
chown -R docker-registry:docker ${cfg.storagePath}
fi
'';
postStart = '' postStart = ''
until ${pkgs.curl}/bin/curl -s -o /dev/null 'http://${cfg.host}:${toString cfg.port}/'; do until ${pkgs.curl}/bin/curl -s -o /dev/null 'http://${cfg.host}:${toString cfg.port}/'; do
sleep 1; sleep 1;
@ -77,6 +72,10 @@ in {
}; };
users.extraGroups.docker.gid = mkDefault config.ids.gids.docker; 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;
};
}; };
} }