Commit 6651794

HPCesia <me@hpcesia.com>
2026-06-11 05:35:12
Add Podman service
1 parent 34a5283
Changed files (2)
modules
roles
services
modules/roles/develop.nix
@@ -3,6 +3,8 @@
     includes = with den.aspects; [
       develop.binfmt
       develop.direnv
+
+      services.podman
     ];
   };
 }
modules/services/podman.nix
@@ -0,0 +1,28 @@
+{lib, ...}: {
+  den.aspects.services.podman = {
+    nixos = {config, ...}: {
+      virtualisation.podman = {
+        enable = true;
+        dockerCompat = true;
+        dockerSocket.enable = true;
+        autoPrune.enable = true;
+      };
+
+      # Enable container name DNS for all Podman networks.
+      networking.firewall.interfaces = let
+        matchAll =
+          if !config.networking.nftables.enable
+          then "podman+"
+          else "podman*";
+      in {
+        "${matchAll}".allowedUDPPorts = [53];
+      };
+
+      virtualisation.oci-containers.backend = "podman";
+    };
+
+    user = {user, ...}: {
+      extraGroups = lib.optional (lib.elem "admins" user.groups) "podman";
+    };
+  };
+}