diff --git a/modules/containers/default.nix b/modules/containers/default.nix new file mode 100644 index 0000000..332e014 --- /dev/null +++ b/modules/containers/default.nix @@ -0,0 +1,26 @@ +{self, ...}: { + flake.nixosModules.containers = {config, ...}: let + modules = with self.nixosModules; [ + ]; + in { + imports = modules; + # Runtime + virtualisation.podman = { + enable = true; + autoPrune.enable = true; + dockerCompat = 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"; + }; +} diff --git a/modules/hosts/server02/default.nix b/modules/hosts/server02/default.nix index f1a5f55..24725ca 100644 --- a/modules/hosts/server02/default.nix +++ b/modules/hosts/server02/default.nix @@ -11,6 +11,7 @@ core server02DiskConfiguration nvidiaDrivers + containers ] ++ (with inputs.nix-config.nixosModules; [ nvim diff --git a/modules/hosts/server02/server02Configuration.nix b/modules/hosts/server02/server02Configuration.nix index 1319f75..c2337a2 100644 --- a/modules/hosts/server02/server02Configuration.nix +++ b/modules/hosts/server02/server02Configuration.nix @@ -3,7 +3,6 @@ networking = { hostName = "server02"; }; - virtualisation.docker.enable = true; swapDevices = [ { device = "/swapfile";