2024-06-25 04:04:39 +03:00
|
|
|
{ pkgs, lib, config, ... }: with lib; let
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
|
|
|
|
virtualisation.docker.rootless = mkIf cfg.rootless {
|
|
|
|
enable = 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;
|
|
|
|
# };
|
|
|
|
# })
|
|
|
|
# ]);
|
2024-03-04 00:34:39 +03:00
|
|
|
}
|