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" ```
61 lines
1.5 KiB
Nix
61 lines
1.5 KiB
Nix
{ rustPlatform
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, fetchurl
|
|
, pkg-config
|
|
, perl
|
|
, openssl
|
|
, lib
|
|
, darwin
|
|
}:
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "r0vm";
|
|
version = "1.0.5";
|
|
src = fetchFromGitHub {
|
|
owner = "risc0";
|
|
repo = "risc0";
|
|
rev = "v${version}";
|
|
hash = "sha256-jtROtI5/4W2pNvn1ZYR/wQAZmECTr7YxuZGu2Ns9paw=";
|
|
};
|
|
|
|
buildAndTestSubdir = "risc0/r0vm";
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
perl
|
|
];
|
|
|
|
buildInputs = [
|
|
openssl.dev
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
];
|
|
|
|
doCheck = false;
|
|
|
|
cargoHash = "sha256-WLd/cUiaIR04CIOaf9JwFmAY4fU9yH2QHDuT3Q54Gvg=";
|
|
|
|
postPatch =
|
|
let
|
|
# see https://github.com/risc0/risc0/blob/v1.0.5/risc0/circuit/recursion/build.rs
|
|
sha256Hash = "4e8496469e1efa00efb3630d261abf345e6b2905fb64b4f3a297be88ebdf83d2";
|
|
recursionZkr = fetchurl {
|
|
name = "recursion_zkr.zip";
|
|
url = "https://risc0-artifacts.s3.us-west-2.amazonaws.com/zkr/${sha256Hash}.zip";
|
|
hash = "sha256-ToSWRp4e+gDvs2MNJhq/NF5rKQX7ZLTzope+iOvfg9I=";
|
|
};
|
|
in
|
|
''
|
|
ln -sf ${recursionZkr} ./risc0/circuit/recursion/src/recursion_zkr.zip
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "RISC Zero zero-knowledge VM";
|
|
homepage = "https://github.com/risc0/risc0";
|
|
changelog = "https://github.com/risc0/risc0/blob/${src.rev}/CHANGELOG.md";
|
|
license = licenses.asl20;
|
|
maintainers = with maintainers; [ marijanp ];
|
|
mainProgram = "r0vm";
|
|
};
|
|
}
|