docker: Allow package selection in module

This commit is contained in:
Tim Steinbach 2017-09-04 19:02:05 -04:00
parent 11cd027b30
commit 2bb57ef776
No known key found for this signature in database
GPG Key ID: 472BFCCA96BD0EDA

View File

@ -126,14 +126,23 @@ in
'';
};
};
package = mkOption {
default = pkgs.docker;
type = types.package;
example = pkgs.docker-edge;
description = ''
Docker package to be used in the module.
'';
};
};
###### implementation
config = mkIf cfg.enable (mkMerge [{
environment.systemPackages = [ pkgs.docker ];
environment.systemPackages = [ cfg.package ];
users.extraGroups.docker.gid = config.ids.gids.docker;
systemd.packages = [ pkgs.docker ];
systemd.packages = [ cfg.package ];
systemd.services.docker = {
wantedBy = optional cfg.enableOnBoot "multi-user.target";
@ -142,7 +151,7 @@ in
ExecStart = [
""
''
${pkgs.docker}/bin/dockerd \
${cfg.package}/bin/dockerd \
--group=docker \
--host=fd:// \
--log-driver=${cfg.logDriver} \
@ -180,7 +189,7 @@ in
serviceConfig.Type = "oneshot";
script = ''
${pkgs.docker}/bin/docker system prune -f ${toString cfg.autoPrune.flags}
${cfg.package}/bin/docker system prune -f ${toString cfg.autoPrune.flags}
'';
startAt = optional cfg.autoPrune.enable cfg.autoPrune.dates;