Docker : Disable autostart by default.

This commit is contained in:
Dmitry Voronin 2024-08-24 20:25:09 +03:00
parent 4bdec48282
commit 514523e4f0
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: with lib; let { lib, config, ... }: with lib; let
cfg = config.module.docker; cfg = config.module.docker;
in { in {
options = { options = {
@ -15,27 +15,24 @@ in {
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable (mkMerge [
{
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
virtualisation.docker.rootless = mkIf cfg.rootless { systemd = {
services = {
docker-prune.enable = mkForce cfg.autostart;
docker.enable = mkForce cfg.autostart;
};
sockets.docker.enable = mkForce cfg.autostart;
};
}
(mkIf cfg.rootless {
virtualisation.docker.rootless = {
enable = true; enable = true;
setSocketVariable = true; setSocketVariable = true;
}; };
})
systemd.services.docker-prune.enable = mkForce cfg.autostart; ]);
systemd.services.docker.enable = mkForce cfg.autostart;
systemd.sockets.docker.enable = mkForce cfg.autostart;
};
# NOTE: mkMerge example.
# config = mkIf cfg.enable (mkMerge [
# { virtualisation.docker.enable = true; }
# (mkIf cfg.rootless {
# virtualisation.docker.rootless = {
# enable = true;
# setSocketVariable = true;
# };
# })
# ]);
} }