mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 15:44:20 +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" ```
41 lines
1.3 KiB
Nix
41 lines
1.3 KiB
Nix
{ stdenv
|
|
, lib
|
|
, fetchzip
|
|
}:
|
|
|
|
let
|
|
os = if stdenv.hostPlatform.isDarwin then "macos" else "linux";
|
|
arch = if stdenv.hostPlatform.isAarch64 then "aarch64" else "x86_64";
|
|
platform = "${os}-${arch}";
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
pname = "urbit";
|
|
version = "3.1";
|
|
|
|
src = fetchzip {
|
|
url = "https://github.com/urbit/vere/releases/download/vere-v${version}/${platform}.tgz";
|
|
sha256 = {
|
|
x86_64-linux = "sha256-51Zgv9QANQVMk/dc7/heYmCNfeu4k7mrYNke1/oz/94=";
|
|
aarch64-linux = "sha256-Tdn/ve9iCjsY/b39TZ7ErHV14mIAHdtmycgUPIzRihQ=";
|
|
x86_64-darwin = "sha256-y/FQIVcEn6dLWXPztC34+7+5eDMO7Xcx25D2+0p7Mxk=";
|
|
aarch64-darwin = "sha256-YJGRZlpTdm1x4P+GnZiKC1411tcEX+Jdnm+iyxUlsU0=";
|
|
}.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}");
|
|
};
|
|
|
|
postInstall = ''
|
|
install -m755 -D vere-v${version}-${platform} $out/bin/urbit
|
|
'';
|
|
|
|
passthru.updateScript = ./update-bin.sh;
|
|
|
|
meta = with lib; {
|
|
homepage = "https://urbit.org";
|
|
description = "Operating function";
|
|
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
|
|
maintainers = [ maintainers.matthew-levan ];
|
|
license = licenses.mit;
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
|
mainProgram = "urbit";
|
|
};
|
|
}
|