mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-17 02:14:08 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
70 lines
1.6 KiB
Nix
70 lines
1.6 KiB
Nix
{ buildah-unwrapped
|
|
, runCommand
|
|
, makeWrapper
|
|
, symlinkJoin
|
|
, lib
|
|
, stdenv
|
|
, 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
|
|
, util-linux # nsenter
|
|
, iptables
|
|
, aardvark-dns
|
|
, netavark
|
|
, passt
|
|
}:
|
|
|
|
let
|
|
binPath = lib.makeBinPath ([
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
runc
|
|
crun
|
|
conmon
|
|
slirp4netns
|
|
fuse-overlayfs
|
|
util-linux
|
|
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 added to `binPath` or in the modules
|
|
paths = [
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
aardvark-dns
|
|
netavark
|
|
passt
|
|
];
|
|
};
|
|
|
|
in runCommand buildah-unwrapped.name {
|
|
name = "${buildah-unwrapped.pname}-wrapper-${buildah-unwrapped.version}";
|
|
inherit (buildah-unwrapped) pname version passthru;
|
|
|
|
preferLocalBuild = true;
|
|
|
|
meta = builtins.removeAttrs buildah-unwrapped.meta [ "outputsToInstall" ];
|
|
|
|
outputs = [
|
|
"out"
|
|
"man"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
];
|
|
|
|
} ''
|
|
ln -s ${buildah-unwrapped.man} $man
|
|
|
|
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 \
|
|
--prefix PATH : ${binPath}
|
|
''
|