nixpkgs/pkgs/development/tools/buildah/wrapper.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
1.5 KiB
Nix
Raw Normal View History

2020-05-11 17:58:44 +00:00
{ buildah-unwrapped
, runCommand
, makeWrapper
, symlinkJoin
2020-05-11 17:58:44 +00:00
, lib
2022-08-16 17:10:56 +00:00
, stdenv
2020-05-11 17:58:44 +00:00
, extraPackages ? []
, runc # Default container runtime
, crun # Container runtime (default with cgroups v2 for podman/buildah)
, conmon # Container runtime monitor
, slirp4netns # User-mode networking for unprivileged namespaces
, fuse-overlayfs # CoW for images, much faster than default vfs
2020-11-24 15:29:28 +00:00
, util-linux # nsenter
2020-05-11 17:58:44 +00:00
, iptables
, aardvark-dns
, netavark
2020-05-11 17:58:44 +00:00
}:
let
binPath = lib.makeBinPath ([
2022-08-16 17:10:56 +00:00
] ++ lib.optionals stdenv.isLinux [
2020-05-11 17:58:44 +00:00
runc
crun
conmon
slirp4netns
fuse-overlayfs
2020-11-24 15:29:28 +00:00
util-linux
2020-05-11 17:58:44 +00:00
iptables
] ++ extraPackages);
helpersBin = symlinkJoin {
name = "${buildah-unwrapped.pname}-helper-binary-wrapper-${buildah-unwrapped.version}";
# this only works for some binaries, others may need to be be added to `binPath` or in the modules
paths = [
] ++ lib.optionals stdenv.isLinux [
aardvark-dns
netavark
];
};
in runCommand buildah-unwrapped.name {
name = "${buildah-unwrapped.pname}-wrapper-${buildah-unwrapped.version}";
inherit (buildah-unwrapped) pname version passthru;
preferLocalBuild = true;
2020-05-11 17:58:44 +00:00
meta = builtins.removeAttrs buildah-unwrapped.meta [ "outputsToInstall" ];
2020-05-11 17:58:44 +00:00
outputs = [
"out"
"man"
];
nativeBuildInputs = [
makeWrapper
];
} ''
ln -s ${buildah-unwrapped.man} $man
2020-05-11 17:58:44 +00:00
mkdir -p $out/bin
ln -s ${buildah-unwrapped}/share $out/share
makeWrapper ${buildah-unwrapped}/bin/buildah $out/bin/buildah \
--set CONTAINERS_HELPER_BINARY_DIR ${helpersBin}/bin \
2020-05-11 17:58:44 +00:00
--prefix PATH : ${binPath}
''