about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2019-03-26 07:10:18 +0100
committeraszlig <aszlig@nix.build>2019-03-26 07:10:18 +0100
commit68efd790b8403795c7e51ac99b6534ad96b6b5a3 (patch)
tree97b3e2490e10dc01d09281d31717dbe3265bf5d1 /nixos
parentd5e9e5fcf2bd242fcf721fd1f0825751fad7f03b (diff)
downloadnixlib-68efd790b8403795c7e51ac99b6534ad96b6b5a3.tar
nixlib-68efd790b8403795c7e51ac99b6534ad96b6b5a3.tar.gz
nixlib-68efd790b8403795c7e51ac99b6534ad96b6b5a3.tar.bz2
nixlib-68efd790b8403795c7e51ac99b6534ad96b6b5a3.tar.lz
nixlib-68efd790b8403795c7e51ac99b6534ad96b6b5a3.tar.xz
nixlib-68efd790b8403795c7e51ac99b6534ad96b6b5a3.tar.zst
nixlib-68efd790b8403795c7e51ac99b6534ad96b6b5a3.zip
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 <aszlig@nix.build>
Cc: @benley, @danbst, @Infinisil, @nlewo
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/virtualisation/docker-containers.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/docker-containers.nix b/nixos/modules/virtualisation/docker-containers.nix
index 7cf871cc3bac..c4e47bfa477c 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;