nix-config/system/dev/docker.nix

45 lines
1.1 KiB
Nix
Raw Normal View History

2025-05-04 02:47:36 +02:00
{
lib,
config,
pkgs,
2025-05-04 02:47:36 +02:00
...
}:
with lib; let
2025-08-15 21:33:22 +02:00
cfg = config.mySystem.dev.docker;
2025-05-04 02:47:36 +02:00
in {
2025-08-15 21:33:22 +02:00
options.mySystem.dev.docker = {
2025-05-04 02:47:36 +02:00
enable = mkEnableOption "Enable Docker";
extraDaemonSettings = mkOption {
type = types.nullOr (types.attrsOf types.str);
default = {};
example = {
data-root = "/custom/path";
};
};
2025-05-04 02:47:36 +02:00
podman.enable = mkEnableOption "Enable Podman rather than Docker";
nvidia.enable = mkEnableOption "Activate Nvidia support";
autoprune.enable = mkEnableOption "Enable autoprune";
};
config = {
environment.systemPackages = mkIf cfg.podman.enable [
pkgs.podman-desktop
pkgs.podman-compose
];
virtualisation = mkIf cfg.enable {
docker = mkIf (!cfg.podman.enable) {
2025-05-04 02:47:36 +02:00
enable = true;
enableNvidia = cfg.nvidia.enable;
autoPrune.enable = cfg.autoprune.enable;
};
podman = mkIf cfg.podman.enable {
enable = true;
dockerCompat = cfg.enable;
enableNvidia = cfg.nvidia.enable;
dockerSocket.enable = cfg.enable;
autoPrune.enable = cfg.autoprune.enable;
};
};
};
}