podman: Improve packaging

Change the approach used to integrate runtimes, in order to:

- Better support macOS
- Make obscure OCI runtimes optional
- Work around a panic due to runtimes having no paths
(see https://github.com/containers/podman/issues/22561)

WxNzEMof 4499fcab 9282d2eb

+35 -23
+9 -8
pkgs/applications/virtualization/podman/default.nix
··· 19 19 , symlinkJoin 20 20 , substituteAll 21 21 , extraPackages ? [ ] 22 - , runc 23 22 , crun 24 - , gvisor 25 - , youki 23 + , runc 26 24 , conmon 25 + , extraRuntimes ? lib.optionals stdenv.isLinux [ runc ] # e.g.: runc, gvisor, youki 27 26 , slirp4netns 28 27 , fuse-overlayfs 29 28 , util-linux ··· 59 58 netavark 60 59 slirp4netns 61 60 passt 62 - ]; 61 + conmon 62 + crun 63 + ] ++ extraRuntimes; 63 64 }; 64 65 in 65 66 buildGoModule rec { ··· 74 75 }; 75 76 76 77 patches = [ 77 - # we intentionally don't build and install the helper so we shouldn't display messages to users about it 78 - ./rm-podman-mac-helper-msg.patch 79 - ] ++ lib.optionals stdenv.isLinux [ 80 78 (substituteAll { 81 79 src = ./hardcode-paths.patch; 82 - inherit crun runc gvisor youki conmon; 80 + bin_path = helpersBin; 83 81 }) 82 + 83 + # we intentionally don't build and install the helper so we shouldn't display messages to users about it 84 + ./rm-podman-mac-helper-msg.patch 84 85 ]; 85 86 86 87 vendorHash = null;
+26 -15
pkgs/applications/virtualization/podman/hardcode-paths.patch
··· 1 1 diff --git a/vendor/github.com/containers/common/pkg/config/default.go b/vendor/github.com/containers/common/pkg/config/default.go 2 - index 19c4bb6bf..2743de4b2 100644 2 + index 3a6d804ad..5628e2bf6 100644 3 3 --- a/vendor/github.com/containers/common/pkg/config/default.go 4 4 +++ b/vendor/github.com/containers/common/pkg/config/default.go 5 - @@ -364,75 +364,34 @@ func defaultEngineConfig() (*EngineConfig, error) { 5 + @@ -366,75 +366,34 @@ func defaultEngineConfig() (*EngineConfig, error) { 6 6 c.Retry = 3 7 7 c.OCIRuntimes = map[string][]string{ 8 8 "crun": { ··· 13 13 - "/sbin/crun", 14 14 - "/bin/crun", 15 15 - "/run/current-system/sw/bin/crun", 16 - + "@crun@/bin/crun", 16 + + "@bin_path@/bin/crun", 17 17 }, 18 18 "crun-vm": { 19 19 - "/usr/bin/crun-vm", ··· 22 22 - "/sbin/crun-vm", 23 23 - "/bin/crun-vm", 24 24 - "/run/current-system/sw/bin/crun-vm", 25 - + // TODO: "@crun-vm@/bin/crun-vm", 25 + + "@bin_path@/bin/crun-vm", 26 26 }, 27 27 "crun-wasm": { 28 28 - "/usr/bin/crun-wasm", ··· 32 32 - "/sbin/crun-wasm", 33 33 - "/bin/crun-wasm", 34 34 - "/run/current-system/sw/bin/crun-wasm", 35 - + // TODO: "@crun-wasm@/bin/crun-wasm", 35 + + "@bin_path@/bin/crun-wasm", 36 36 }, 37 37 "runc": { 38 38 - "/usr/bin/runc", ··· 43 43 - "/bin/runc", 44 44 - "/usr/lib/cri-o-runc/sbin/runc", 45 45 - "/run/current-system/sw/bin/runc", 46 - + "@runc@/bin/runc", 46 + + "@bin_path@/bin/runc", 47 47 }, 48 48 "runj": { 49 49 - "/usr/local/bin/runj", 50 - + // TODO: "@runj@/bin/runj", 50 + + "@bin_path@/bin/runj", 51 51 }, 52 52 "kata": { 53 53 - "/usr/bin/kata-runtime", ··· 58 58 - "/bin/kata-runtime", 59 59 - "/usr/bin/kata-qemu", 60 60 - "/usr/bin/kata-fc", 61 - + // TODO: "@kata@/bin/kata", 61 + + "@bin_path@/bin/kata-runtime", 62 62 }, 63 63 "runsc": { 64 64 - "/usr/bin/runsc", ··· 68 68 - "/bin/runsc", 69 69 - "/sbin/runsc", 70 70 - "/run/current-system/sw/bin/runsc", 71 - + "@gvisor@/bin/runsc", 71 + + "@bin_path@/bin/runsc", 72 72 }, 73 73 "youki": { 74 74 - "/usr/local/bin/youki", 75 75 - "/usr/bin/youki", 76 76 - "/bin/youki", 77 77 - "/run/current-system/sw/bin/youki", 78 - + "@youki@/bin/youki", 78 + + "@bin_path@/bin/youki", 79 79 }, 80 80 "krun": { 81 81 - "/usr/bin/krun", 82 82 - "/usr/local/bin/krun", 83 - + // TODO: "@krun@/bin/krun", 83 + + "@bin_path@/bin/krun", 84 84 }, 85 85 "ocijail": { 86 86 - "/usr/local/bin/ocijail", 87 - + // TODO: "@ocijail@/bin/ocijail", 87 + + "@bin_path@/bin/ocijail", 88 88 }, 89 89 } 90 90 c.PlatformToOCIRuntime = map[string]string{ 91 - @@ -443,16 +402,9 @@ func defaultEngineConfig() (*EngineConfig, error) { 91 + @@ -445,26 +404,12 @@ func defaultEngineConfig() (*EngineConfig, error) { 92 92 // Needs to be called after populating c.OCIRuntimes. 93 93 c.OCIRuntime = c.findRuntime() 94 94 ··· 103 103 - "/usr/local/bin/conmon", 104 104 - "/usr/local/sbin/conmon", 105 105 - "/run/current-system/sw/bin/conmon", 106 - + "@conmon@/bin/conmon", 106 + + "@bin_path@/bin/conmon", 107 107 }) 108 108 c.ConmonRsPath.Set([]string{ 109 - "/usr/libexec/podman/conmonrs", 109 + - "/usr/libexec/podman/conmonrs", 110 + - "/usr/local/libexec/podman/conmonrs", 111 + - "/usr/local/lib/podman/conmonrs", 112 + - "/usr/bin/conmonrs", 113 + - "/usr/sbin/conmonrs", 114 + - "/usr/local/bin/conmonrs", 115 + - "/usr/local/sbin/conmonrs", 116 + - "/run/current-system/sw/bin/conmonrs", 117 + + "@bin_path@/bin/conmonrs", 118 + }) 119 + c.PullPolicy = DefaultPullPolicy 120 + c.RuntimeSupportsJSON.Set([]string{