2024-08-24 20:25:09 +03:00
|
|
|
{ lib, config, ... }: with lib; let
|
2024-06-25 04:04:39 +03:00
|
|
|
cfg = config.module.docker;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
module.docker = {
|
|
|
|
enable = mkEnableOption "Enable Cocker";
|
|
|
|
rootless = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
};
|
|
|
|
autostart = mkOption {
|
2024-08-24 19:55:55 +03:00
|
|
|
default = false;
|
2024-06-25 04:04:39 +03:00
|
|
|
type = types.bool;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-24 20:25:09 +03:00
|
|
|
config = mkIf cfg.enable (mkMerge [
|
|
|
|
{
|
|
|
|
virtualisation.docker.enable = true;
|
2024-06-25 04:04:39 +03:00
|
|
|
|
2024-09-03 14:44:00 +03:00
|
|
|
systemd = if cfg.autostart then {} else {
|
2024-08-24 20:25:09 +03:00
|
|
|
services = {
|
2024-09-03 14:44:00 +03:00
|
|
|
docker-prune.wantedBy = mkForce [];
|
|
|
|
docker.wantedBy = mkForce [];
|
2024-08-24 20:25:09 +03:00
|
|
|
};
|
2024-09-03 14:44:00 +03:00
|
|
|
sockets.docker.wantedBy = mkForce [];
|
2024-08-24 20:25:09 +03:00
|
|
|
};
|
|
|
|
}
|
2024-06-25 04:04:39 +03:00
|
|
|
|
2024-08-24 20:25:09 +03:00
|
|
|
(mkIf cfg.rootless {
|
|
|
|
virtualisation.docker.rootless = {
|
|
|
|
enable = true;
|
|
|
|
setSocketVariable = true;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
]);
|
2024-03-04 00:34:39 +03:00
|
|
|
}
|