From 68efd790b8403795c7e51ac99b6534ad96b6b5a3 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 26 Mar 2019 07:10:18 +0100 Subject: [PATCH] nixos: Don't enable Docker by default Regression introduced by c94005358c185d8262814a5b59b2b4185183bd95. The commit introduced declarative docker containers and subsequently enables docker whenever any declarative docker containers are defined. This is done via an option with type "attrsOf somesubmodule" and a check on whether the attribute set is empty. Unfortunately, the check was whether a *list* is empty rather than wether an attribute set is empty, so "mkIf (cfg != [])" *always* evaluates to true and thus subsequently enables docker by default: $ nix-instantiate --eval nixos --arg configuration {} \ -A config.virtualisation.docker.enable true Fixing this is simply done by changing the check to "mkIf (cfg != {})". Tested this by running the "docker-containers" NixOS test and it still passes. Signed-off-by: aszlig Cc: @benley, @danbst, @Infinisil, @nlewo --- nixos/modules/virtualisation/docker-containers.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/virtualisation/docker-containers.nix b/nixos/modules/virtualisation/docker-containers.nix index 7cf871cc3ba..c4e47bfa477 100644 --- a/nixos/modules/virtualisation/docker-containers.nix +++ b/nixos/modules/virtualisation/docker-containers.nix @@ -222,7 +222,7 @@ in { description = "Docker containers to run as systemd services."; }; - config = mkIf (cfg != []) { + config = mkIf (cfg != {}) { systemd.services = mapAttrs' (n: v: nameValuePair "docker-${n}" (mkService n v)) cfg;