Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 buildah-unwrapped, 3 runCommand, 4 makeWrapper, 5 symlinkJoin, 6 lib, 7 stdenv, 8 extraPackages ? [ ], 9 runc, # Default container runtime 10 crun, # Container runtime (default with cgroups v2 for podman/buildah) 11 conmon, # Container runtime monitor 12 slirp4netns, # User-mode networking for unprivileged namespaces 13 fuse-overlayfs, # CoW for images, much faster than default vfs 14 util-linux, # nsenter 15 iptables, 16 aardvark-dns, 17 netavark, 18 passt, 19}: 20 21let 22 binPath = lib.makeBinPath ( 23 [ 24 ] 25 ++ lib.optionals stdenv.hostPlatform.isLinux [ 26 runc 27 crun 28 conmon 29 slirp4netns 30 fuse-overlayfs 31 util-linux 32 iptables 33 ] 34 ++ extraPackages 35 ); 36 37 helpersBin = symlinkJoin { 38 name = "${buildah-unwrapped.pname}-helper-binary-wrapper-${buildah-unwrapped.version}"; 39 40 # this only works for some binaries, others may need to be added to `binPath` or in the modules 41 paths = [ 42 ] 43 ++ lib.optionals stdenv.hostPlatform.isLinux [ 44 aardvark-dns 45 netavark 46 passt 47 ]; 48 }; 49 50in 51runCommand buildah-unwrapped.name 52 { 53 name = "${buildah-unwrapped.pname}-wrapper-${buildah-unwrapped.version}"; 54 inherit (buildah-unwrapped) pname version passthru; 55 56 preferLocalBuild = true; 57 58 meta = builtins.removeAttrs buildah-unwrapped.meta [ "outputsToInstall" ]; 59 60 outputs = [ 61 "out" 62 "man" 63 ]; 64 65 nativeBuildInputs = [ 66 makeWrapper 67 ]; 68 69 } 70 '' 71 ln -s ${buildah-unwrapped.man} $man 72 73 mkdir -p $out/bin 74 ln -s ${buildah-unwrapped}/share $out/share 75 makeWrapper ${buildah-unwrapped}/bin/buildah $out/bin/buildah \ 76 --set CONTAINERS_HELPER_BINARY_DIR ${helpersBin}/bin \ 77 --prefix PATH : ${binPath} 78 ''