From 0c49512ebc00fa53a07fa79dd38d853a8d9c074f Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Thu, 14 Sep 2023 12:13:59 +0200 Subject: [PATCH] add podman --- hosts/yodaTab/configuration.nix | 1 + hosts/yodaTux/configuration.nix | 1 + hosts/yodaYoga/configuration.nix | 1 + modules/podman.nix | 39 ++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 modules/podman.nix diff --git a/hosts/yodaTab/configuration.nix b/hosts/yodaTab/configuration.nix index 5a00151..f3c9380 100644 --- a/hosts/yodaTab/configuration.nix +++ b/hosts/yodaTab/configuration.nix @@ -42,6 +42,7 @@ in ../../modules/thunderbird.nix #../../modules/digikam.nix #../../modules/android.nix + #../../modules/podman.nix ]; networking.hostName = "yodaTab"; diff --git a/hosts/yodaTux/configuration.nix b/hosts/yodaTux/configuration.nix index 8e948a9..9b0cfdd 100644 --- a/hosts/yodaTux/configuration.nix +++ b/hosts/yodaTux/configuration.nix @@ -42,6 +42,7 @@ in ../../modules/thunderbird.nix ../../modules/digikam.nix ../../modules/android.nix + ../../modules/podman.nix ]; networking.hostName = "yodaTux"; diff --git a/hosts/yodaYoga/configuration.nix b/hosts/yodaYoga/configuration.nix index 8be1602..8e5278b 100644 --- a/hosts/yodaYoga/configuration.nix +++ b/hosts/yodaYoga/configuration.nix @@ -44,6 +44,7 @@ in #../../modules/thunderbird.nix #../../modules/digikam.nix #../../modules/android.nix + ../../modules/podman.nix ]; networking.hostName = "yodaYoga"; diff --git a/modules/podman.nix b/modules/podman.nix new file mode 100644 index 0000000..3bd6131 --- /dev/null +++ b/modules/podman.nix @@ -0,0 +1,39 @@ +{ 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 + # TODO: Podman Terminal UI: https://github.com/containers/podman-tui#podman-tui + + 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" + ]; + }; + }; +}