nix-git/modules/docker.nix
2023-09-14 15:55:10 +02:00

30 lines
871 B
Nix

{ config, pkgs, ... }:
{
# https://nixos.wiki/wiki/Docker#Installation
# TODO: rootless Docker. https://nixos.wiki/wiki/Docker#Rootless_docker
# TODO: run as systemd services. https://nixos.wiki/wiki/Docker#docker_containers_as_systemd_services
virtualisation = {
docker = {
enable = true;
# As we use btrfs, we enable the according storageDriver option.
storageDriver = "btrfs";
# Run `docker system prune -f` every week.
autoPrune.enable = true;
autoPrune.dates = "weekly";
# https://docs.docker.com/engine/reference/commandline/system_prune/#options
autoPrune.flags = [
"--all"
"--volumes"
# https://docs.docker.com/engine/reference/commandline/system_prune/#filter
# https://pkg.go.dev/maze.io/x/duration#ParseDuration
"--filter until=7d"
];
};
};
}