nix/config/Docker.nix

33 lines
662 B
Nix
Raw Normal View History

{ lib, config, ... }:
let
cfg = config.module.docker;
in
{
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
virtualisation.docker.enable = true;
2024-06-25 04:04:39 +03:00
systemd =
if cfg.autostart then
{ }
else
{
sockets.docker.wantedBy = lib.mkForce [ ];
services = {
docker-prune.wantedBy = lib.mkForce [ ];
docker.wantedBy = lib.mkForce [ ];
};
};
}
2024-06-25 04:04:39 +03:00
(lib.mkIf cfg.rootless {
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
})
]
);
}