mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-11 07:23:40 +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" ```
65 lines
2.0 KiB
Nix
65 lines
2.0 KiB
Nix
{ lib, stdenv, fetchzip }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "vault-bin";
|
|
version = "1.17.5";
|
|
|
|
src =
|
|
let
|
|
inherit (stdenv.hostPlatform) system;
|
|
selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}");
|
|
suffix = selectSystem {
|
|
x86_64-linux = "linux_amd64";
|
|
aarch64-linux = "linux_arm64";
|
|
i686-linux = "linux_386";
|
|
x86_64-darwin = "darwin_amd64";
|
|
aarch64-darwin = "darwin_arm64";
|
|
};
|
|
hash = selectSystem {
|
|
x86_64-linux = "sha256-rh0ZVmAbiOmZFCpiiX9ClAYmQKx084VKCjxvD9bbYAk=";
|
|
aarch64-linux = "sha256-DtriOEQCuSMMjzfJJpJAf7z+wGJSbzU3V/X+glTLkv8=";
|
|
i686-linux = "sha256-EPS3Sx2l0Gv4PWeqrnIEoNYUF4Or075vdhn71vKXQEw=";
|
|
x86_64-darwin = "sha256-pi/sD88haBxUx6dSUEUv6ugQO2K/lhg4ne7xbcVzg3M=";
|
|
aarch64-darwin = "sha256-6ZESO3m5FCRwTNh3xlWjWw6c9sjiAwV09YA/hQ5Py/o=";
|
|
};
|
|
in
|
|
fetchzip {
|
|
url = "https://releases.hashicorp.com/vault/${version}/vault_${version}_${suffix}.zip";
|
|
stripRoot=false;
|
|
inherit hash;
|
|
};
|
|
|
|
dontConfigure = true;
|
|
dontBuild = true;
|
|
dontStrip = stdenv.hostPlatform.isDarwin;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
install -D vault $out/bin/vault
|
|
runHook postInstall
|
|
'';
|
|
|
|
doInstallCheck = true;
|
|
installCheckPhase = ''
|
|
runHook preInstallCheck
|
|
$out/bin/vault --help
|
|
$out/bin/vault version
|
|
runHook postInstallCheck
|
|
'';
|
|
|
|
dontPatchELF = true;
|
|
dontPatchShebangs = true;
|
|
|
|
passthru.updateScript = ./update-bin.sh;
|
|
|
|
meta = with lib; {
|
|
description = "Tool for managing secrets, this binary includes the UI";
|
|
homepage = "https://www.vaultproject.io";
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
|
license = licenses.bsl11;
|
|
maintainers = with maintainers; teams.serokell.members ++ [ offline psyanticy Chili-Man techknowlogick mkaito ];
|
|
mainProgram = "vault";
|
|
platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
|
|
};
|
|
}
|