nix-git/modules/podman.nix

43 lines
1.5 KiB
Nix
Raw Permalink Normal View History

2023-09-14 12:13:59 +02:00
{ config, pkgs, ... }:
{
# https://nixos.wiki/wiki/Podman#Install_and_configure_podman_with_NixOS_service_configuration
# https://search.nixos.org/options?channel=23.05&query=virtualisation.podman
# TODO: Run as systemd services. https://nixos.wiki/wiki/Podman#Run_Podman_containers_as_systemd_services
2023-09-14 15:54:48 +02:00
# TODO: Podman Terminal UI. https://github.com/containers/podman-tui#podman-tui
2023-09-14 12:13:59 +02:00
environment.systemPackages = with pkgs; [
podman-compose
];
virtualisation = {
podman = {
enable = true;
# Create a `docker` alias for podman, to use it as a drop-in replacement.
dockerCompat = true;
# Required for containers under podman-compose to be able to talk to each other.
defaultNetwork.settings = {
dns_enabled = true;
};
# Run `podman system prune` every week.
autoPrune.enable = true;
autoPrune.dates = "weekly";
autoPrune.flags = [
# Recursively remove all unused pods, containers, images, networks, and volume data.
# https://docs.podman.io/en/stable/markdown/podman-system-prune.1.html#all-a
"--all"
# Prune volumes currently unused by any container
# https://docs.podman.io/en/stable/markdown/podman-system-prune.1.html#volumes
"--volumes"
2023-09-14 13:19:14 +02:00
# Only remove containers and images created at least one week ago.
# https://docs.podman.io/en/stable/markdown/podman-system-prune.1.html#filter-filters
# https://pkg.go.dev/maze.io/x/duration#ParseDuration
"--filter until=7d"
2023-09-14 12:13:59 +02:00
];
};
};
}