From c26558c5cc1adaca32a99968e125d3e2fad1e804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Neumann?= Date: Tue, 16 Sep 2025 11:33:27 +0200 Subject: [PATCH] nixos/podman: Introduce new option `extraRuntimes` This disables the hard, not overridable, dependency on `runc`. It also sharpens the description of `extraPackages` to highlight the difference between those options. Fixes #443274. --- .../modules/virtualisation/podman/default.nix | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/nixos/modules/virtualisation/podman/default.nix b/nixos/modules/virtualisation/podman/default.nix index 962e5f494d15..f82fb5a99aee 100644 --- a/nixos/modules/virtualisation/podman/default.nix +++ b/nixos/modules/virtualisation/podman/default.nix @@ -103,13 +103,24 @@ in extraPackages = mkOption { type = with types; listOf package; default = [ ]; + description = '' + Extra dependencies for podman to be placed on $PATH in the wrapper. + ''; + }; + + extraRuntimes = mkOption { + type = with types; listOf package; + # keep the default in sync with the podman package + default = lib.optionals pkgs.stdenv.hostPlatform.isLinux [ pkgs.runc ]; + defaultText = lib.literalExpression ''lib.optionals pkgs.stdenv.hostPlatform.isLinux [ pkgs.runc ]''; example = lib.literalExpression '' [ pkgs.gvisor ] ''; description = '' - Extra packages to be installed in the Podman wrapper. + Extra runtime packages to be installed in the Podman wrapper. + Those are then placed in libexec/podman, i.e. are seen as podman internal commands. ''; }; @@ -161,21 +172,20 @@ in config.systemd.package # To allow systemd-based container healthchecks ] ++ lib.optional (config.boot.supportedFilesystems.zfs or false) config.boot.zfs.package; - extraRuntimes = [ - pkgs.runc - ] - ++ - lib.optionals - ( - config.virtualisation.containers.containersConf.settings.network.default_rootless_network_cmd or "" - == "slirp4netns" - ) - ( - with pkgs; - [ - slirp4netns - ] - ); + extraRuntimes = + cfg.extraRuntimes + ++ + lib.optionals + ( + config.virtualisation.containers.containersConf.settings.network.default_rootless_network_cmd or "" + == "slirp4netns" + ) + ( + with pkgs; + [ + slirp4netns + ] + ); }; };