diff options
Diffstat (limited to 'nixpkgs/pkgs/build-support/rust')
72 files changed, 8866 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/build-crate.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/build-crate.nix new file mode 100644 index 000000000000..7484b3ad0290 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/build-crate.nix @@ -0,0 +1,129 @@ +{ lib, stdenv +, mkRustcDepArgs, mkRustcFeatureArgs, needUnstableCLI +}: + +{ crateName, + dependencies, + crateFeatures, crateRenames, libName, release, libPath, + crateType, metadata, crateBin, hasCrateBin, + extraRustcOpts, verbose, colors, + buildTests, + codegenUnits +}: + + let + baseRustcOpts = + [ + (if release then "-C opt-level=3" else "-C debuginfo=2") + "-C codegen-units=${toString codegenUnits}" + "--remap-path-prefix=$NIX_BUILD_TOP=/" + (mkRustcDepArgs dependencies crateRenames) + (mkRustcFeatureArgs crateFeatures) + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "--target" stdenv.hostPlatform.rust.rustcTargetSpec + ] ++ lib.optionals (needUnstableCLI dependencies) [ + "-Z" "unstable-options" + ] ++ extraRustcOpts + # since rustc 1.42 the "proc_macro" crate is part of the default crate prelude + # https://github.com/rust-lang/cargo/commit/4d64eb99a4#diff-7f98585dbf9d30aa100c8318e2c77e79R1021-R1022 + ++ lib.optional (lib.elem "proc-macro" crateType) "--extern proc_macro" + ; + rustcMeta = "-C metadata=${metadata} -C extra-filename=-${metadata}"; + + + # build the final rustc arguments that can be different between different + # crates + libRustcOpts = lib.concatStringsSep " " ( + baseRustcOpts + ++ [rustcMeta] + ++ (map (x: "--crate-type ${x}") crateType) + ); + + binRustcOpts = lib.concatStringsSep " " ( + [ "-C linker=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" ] ++ + baseRustcOpts + ); + + build_bin = if buildTests then "build_bin_test" else "build_bin"; + in '' + runHook preBuild + + # configure & source common build functions + LIB_RUSTC_OPTS="${libRustcOpts}" + BIN_RUSTC_OPTS="${binRustcOpts}" + LIB_EXT="${stdenv.hostPlatform.extensions.library}" + LIB_PATH="${libPath}" + LIB_NAME="${libName}" + + CRATE_NAME='${lib.replaceStrings ["-"] ["_"] libName}' + + setup_link_paths + + if [[ -e "$LIB_PATH" ]]; then + build_lib "$LIB_PATH" + ${lib.optionalString buildTests ''build_lib_test "$LIB_PATH"''} + elif [[ -e src/lib.rs ]]; then + build_lib src/lib.rs + ${lib.optionalString buildTests "build_lib_test src/lib.rs"} + fi + + + + ${lib.optionalString (lib.length crateBin > 0) (lib.concatMapStringsSep "\n" (bin: + let + haveRequiredFeature = if bin ? requiredFeatures then + # Check that all element in requiredFeatures are also present in crateFeatures + lib.intersectLists bin.requiredFeatures crateFeatures == bin.requiredFeatures + else + true; + in + if haveRequiredFeature then '' + mkdir -p target/bin + BIN_NAME='${bin.name or crateName}' + ${if !bin ? path then '' + BIN_PATH="" + search_for_bin_path "$BIN_NAME" + '' else '' + BIN_PATH='${bin.path}' + ''} + ${build_bin} "$BIN_NAME" "$BIN_PATH" + '' else '' + echo Binary ${bin.name or crateName} not compiled due to not having all of the required features -- ${lib.escapeShellArg (builtins.toJSON bin.requiredFeatures)} -- enabled. + '') crateBin)} + + ${lib.optionalString buildTests '' + # When tests are enabled build all the files in the `tests` directory as + # test binaries. + if [ -d tests ]; then + # find all the .rs files (or symlinks to those) in the tests directory, no subdirectories + find tests -maxdepth 1 \( -type f -o -type l \) -a -name '*.rs' -print0 | while IFS= read -r -d ''' file; do + mkdir -p target/bin + build_bin_test_file "$file" + done + + # find all the subdirectories of tests/ that contain a main.rs file as + # that is also a test according to cargo + find tests/ -mindepth 1 -maxdepth 2 \( -type f -o -type l \) -a -name 'main.rs' -print0 | while IFS= read -r -d ''' file; do + mkdir -p target/bin + build_bin_test_file "$file" + done + + fi + ''} + + # If crateBin is empty and hasCrateBin is not set then we must try to + # detect some kind of bin target based on some files that might exist. + ${lib.optionalString (lib.length crateBin == 0 && !hasCrateBin) '' + if [[ -e src/main.rs ]]; then + mkdir -p target/bin + ${build_bin} ${crateName} src/main.rs + fi + for i in src/bin/*.rs; do #*/ + mkdir -p target/bin + ${build_bin} "$(basename $i .rs)" "$i" + done + ''} + # Remove object files to avoid "wrong ELF type" + find target -type f -name "*.o" -print0 | xargs -0 rm -f + runHook postBuild + '' diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/configure-crate.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/configure-crate.nix new file mode 100644 index 000000000000..4077ee5ced8e --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/configure-crate.nix @@ -0,0 +1,231 @@ +{ lib, stdenv, echo_colored, noisily, mkRustcDepArgs, mkRustcFeatureArgs }: +{ + build +, buildDependencies +, codegenUnits +, colors +, completeBuildDeps +, completeDeps +, crateAuthors +, crateDescription +, crateFeatures +, crateHomepage +, crateLicense +, crateLicenseFile +, crateLinks +, crateName +, crateReadme +, crateRenames +, crateRepository +, crateRustVersion +, crateVersion +, extraLinkFlags +, extraRustcOptsForBuildRs +, libName +, libPath +, release +, verbose +, workspace_member }: +let version_ = lib.splitString "-" crateVersion; + versionPre = lib.optionalString (lib.tail version_ != []) (lib.elemAt version_ 1); + version = lib.splitVersion (lib.head version_); + rustcOpts = lib.foldl' (opts: opt: opts + " " + opt) + (if release then "-C opt-level=3" else "-C debuginfo=2") + (["-C codegen-units=${toString codegenUnits}"] ++ extraRustcOptsForBuildRs); + buildDeps = mkRustcDepArgs buildDependencies crateRenames; + authors = lib.concatStringsSep ":" crateAuthors; + optLevel = if release then 3 else 0; + completeDepsDir = lib.concatStringsSep " " completeDeps; + completeBuildDepsDir = lib.concatStringsSep " " completeBuildDeps; + envFeatures = lib.concatStringsSep " " ( + map (f: lib.replaceStrings ["-"] ["_"] (lib.toUpper f)) crateFeatures + ); +in '' + ${echo_colored colors} + ${noisily colors verbose} + source ${./lib.sh} + + ${lib.optionalString (workspace_member != null) '' + noisily cd "${workspace_member}" +''} + ${lib.optionalString (workspace_member == null) '' + echo_colored "Searching for matching Cargo.toml (${crateName})" + local cargo_toml_dir=$(matching_cargo_toml_dir "${crateName}") + if [ -z "$cargo_toml_dir" ]; then + echo_error "ERROR configuring ${crateName}: No matching Cargo.toml in $(pwd) found." >&2 + exit 23 + fi + noisily cd "$cargo_toml_dir" +''} + + runHook preConfigure + + symlink_dependency() { + # $1 is the nix-store path of a dependency + # $2 is the target path + i=$1 + ln -s -f $i/lib/*.rlib $2 #*/ + ln -s -f $i/lib/*.so $i/lib/*.dylib $2 #*/ + if [ -e $i/env ]; then + source $i/env + fi + } + + # The following steps set up the dependencies of the crate. Two + # kinds of dependencies are distinguished: build dependencies + # (used by the build script) and crate dependencies. For each + # dependency we have to: + # + # - Make its Rust library available to rustc. This is done by + # symlinking all library dependencies into a directory that + # can be provided to rustc. + # - Accumulate linking flags. These flags are largely used for + # linking native libraries. + # + # The crate link flags are added to the `link` and `link.final` + # files. The `link` file is used for linkage in the current + # crate. The `link.final` file will be copied to the output and can + # be used by downstream crates to get the linker flags of this + # crate. + + mkdir -p target/{deps,lib,build,buildDeps} + chmod uga+w target -R + echo ${extraLinkFlags} > target/link + echo ${extraLinkFlags} > target/link.final + + # Prepare crate dependencies + for i in ${completeDepsDir}; do + symlink_dependency $i target/deps + if [ -e "$i/lib/link" ]; then + cat $i/lib/link >> target/link + cat $i/lib/link >> target/link.final + fi + done + + # Prepare crate build dependencies that are used for the build script. + for i in ${completeBuildDepsDir}; do + symlink_dependency $i target/buildDeps + if [ -e "$i/lib/link" ]; then + cat $i/lib/link >> target/link.build + fi + done + + # Remove duplicate linker flags from the build dependencies. + if [[ -e target/link.build ]]; then + sort -uo target/link.build target/link.build + fi + + # Remove duplicate linker flags from the dependencies. + sort -uo target/link target/link + tr '\n' ' ' < target/link > target/link_ + + # Remove duplicate linker flags from the that are written + # to the derivation's output. + sort -uo target/link.final target/link.final + + EXTRA_BUILD="" + BUILD_OUT_DIR="" + + # Set up Cargo Environment variables: https://doc.rust-lang.org/cargo/reference/environment-variables.html + export CARGO_PKG_NAME=${crateName} + export CARGO_PKG_VERSION=${crateVersion} + export CARGO_PKG_AUTHORS="${authors}" + export CARGO_PKG_DESCRIPTION="${crateDescription}" + + export CARGO_CFG_TARGET_ARCH=${stdenv.hostPlatform.rust.platform.arch} + export CARGO_CFG_TARGET_OS=${stdenv.hostPlatform.rust.platform.os} + export CARGO_CFG_TARGET_FAMILY="unix" + export CARGO_CFG_UNIX=1 + export CARGO_CFG_TARGET_ENV="gnu" + export CARGO_CFG_TARGET_ENDIAN=${if stdenv.hostPlatform.parsed.cpu.significantByte.name == "littleEndian" then "little" else "big"} + export CARGO_CFG_TARGET_POINTER_WIDTH=${with stdenv.hostPlatform; toString (if isILP32 then 32 else parsed.cpu.bits)} + export CARGO_CFG_TARGET_VENDOR=${stdenv.hostPlatform.parsed.vendor.name} + + export CARGO_MANIFEST_DIR=$(pwd) + export CARGO_MANIFEST_LINKS=${crateLinks} + export DEBUG="${toString (!release)}" + export OPT_LEVEL="${toString optLevel}" + export TARGET="${stdenv.hostPlatform.rust.rustcTargetSpec}" + export HOST="${stdenv.buildPlatform.rust.rustcTargetSpec}" + export PROFILE=${if release then "release" else "debug"} + export OUT_DIR=$(pwd)/target/build/${crateName}.out + export CARGO_PKG_VERSION_MAJOR=${lib.elemAt version 0} + export CARGO_PKG_VERSION_MINOR=${lib.elemAt version 1} + export CARGO_PKG_VERSION_PATCH=${lib.elemAt version 2} + export CARGO_PKG_VERSION_PRE="${versionPre}" + export CARGO_PKG_HOMEPAGE="${crateHomepage}" + export CARGO_PKG_LICENSE="${crateLicense}" + export CARGO_PKG_LICENSE_FILE="${crateLicenseFile}" + export CARGO_PKG_README="${crateReadme}" + export CARGO_PKG_REPOSITORY="${crateRepository}" + export CARGO_PKG_RUST_VERSION="${crateRustVersion}" + export NUM_JOBS=$NIX_BUILD_CORES + export RUSTC="rustc" + export RUSTDOC="rustdoc" + + BUILD="" + if [[ ! -z "${build}" ]] ; then + BUILD=${build} + elif [[ -e "build.rs" ]]; then + BUILD="build.rs" + fi + + # Compile and run the build script, when available. + if [[ ! -z "$BUILD" ]] ; then + echo_build_heading "$BUILD" ${libName} + mkdir -p target/build/${crateName} + EXTRA_BUILD_FLAGS="" + if [ -e target/link.build ]; then + EXTRA_BUILD_FLAGS="$EXTRA_BUILD_FLAGS $(tr '\n' ' ' < target/link.build)" + fi + noisily rustc --crate-name build_script_build $BUILD --crate-type bin ${rustcOpts} \ + ${mkRustcFeatureArgs crateFeatures} --out-dir target/build/${crateName} --emit=dep-info,link \ + -L dependency=target/buildDeps ${buildDeps} --cap-lints allow $EXTRA_BUILD_FLAGS --color ${colors} + + mkdir -p target/build/${crateName}.out + export RUST_BACKTRACE=1 + BUILD_OUT_DIR="-L $OUT_DIR" + mkdir -p $OUT_DIR + + ( + # Features should be set as environment variable for build scripts: + # https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts + for feature in ${envFeatures}; do + export CARGO_FEATURE_$feature=1 + done + + target/build/${crateName}/build_script_build > target/build/${crateName}.opt + ) + + set +e + EXTRA_BUILD=$(sed -n "s/^cargo:rustc-flags=\(.*\)/\1/p" target/build/${crateName}.opt | tr '\n' ' ' | sort -u) + EXTRA_FEATURES=$(sed -n "s/^cargo:rustc-cfg=\(.*\)/--cfg \1/p" target/build/${crateName}.opt | tr '\n' ' ') + EXTRA_LINK_ARGS=$(sed -n "s/^cargo:rustc-link-arg=\(.*\)/-C link-arg=\1/p" target/build/${crateName}.opt | tr '\n' ' ') + EXTRA_LINK_ARGS_BINS=$(sed -n "s/^cargo:rustc-link-arg-bins=\(.*\)/-C link-arg=\1/p" target/build/${crateName}.opt | tr '\n' ' ') + EXTRA_LINK_ARGS_LIB=$(sed -n "s/^cargo:rustc-link-arg-lib=\(.*\)/-C link-arg=\1/p" target/build/${crateName}.opt | tr '\n' ' ') + EXTRA_LINK_LIBS=$(sed -n "s/^cargo:rustc-link-lib=\(.*\)/\1/p" target/build/${crateName}.opt | tr '\n' ' ') + EXTRA_LINK_SEARCH=$(sed -n "s/^cargo:rustc-link-search=\(.*\)/\1/p" target/build/${crateName}.opt | tr '\n' ' ' | sort -u) + + # We want to read part of every line that has cargo:rustc-env= prefix and + # export it as environment variables. This turns out tricky if the lines + # have spaces: we can't wrap the command in double quotes as that captures + # all the lines in single output. We can't use while read loop because + # exporting from inside of it doesn't make it to the outside scope. We + # can't use xargs as export is a built-in and does not work from it. As a + # last resort then, we change the IFS so that the for loop does not split + # on spaces and reset it after we are done. See ticket #199298. + # + _OLDIFS="$IFS" + IFS=$'\n' + for env in $(sed -n "s/^cargo:rustc-env=\(.*\)/\1/p" target/build/${crateName}.opt); do + export "$env" + done + IFS="$_OLDIFS" + + CRATENAME=$(echo ${crateName} | sed -e "s/\(.*\)-sys$/\U\1/" -e "s/-/_/g") + grep -P "^cargo:(?!(rustc-|warning=|rerun-if-changed=|rerun-if-env-changed))" target/build/${crateName}.opt \ + | awk -F= "/^cargo:/ { sub(/^cargo:/, \"\", \$1); gsub(/-/, \"_\", \$1); print \"export \" toupper(\"DEP_$(echo $CRATENAME)_\" \$1) \"=\" \"\\\"\"\$2\"\\\"\" }" > target/env + set -e + fi + runHook postConfigure +'' diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix new file mode 100644 index 000000000000..dfe28cc334b5 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix @@ -0,0 +1,407 @@ +# Code for buildRustCrate, a Nix function that builds Rust code, just +# like Cargo, but using Nix instead. +# +# This can be useful for deploying packages with NixOps, and to share +# binary dependencies between projects. + +{ lib +, stdenv +, defaultCrateOverrides +, fetchCrate +, pkgsBuildBuild +, rustc +, cargo +, jq +, libiconv +}: + +let + # Create rustc arguments to link against the given list of dependencies + # and renames. + # + # See docs for crateRenames below. + mkRustcDepArgs = dependencies: crateRenames: + lib.concatMapStringsSep " " + (dep: + let + normalizeName = lib.replaceStrings [ "-" ] [ "_" ]; + extern = normalizeName dep.libName; + # Find a choice that matches in name and optionally version. + findMatchOrUseExtern = choices: + lib.findFirst + (choice: + (!(choice ? version) + || choice.version == dep.version or "")) + { rename = extern; } + choices; + name = + if lib.hasAttr dep.crateName crateRenames then + let choices = crateRenames.${dep.crateName}; + in + normalizeName ( + if builtins.isList choices + then (findMatchOrUseExtern choices).rename + else choices + ) + else + extern; + opts = lib.optionalString (dep.stdlib or false) "noprelude:"; + filename = + if lib.any (x: x == "lib" || x == "rlib") dep.crateType + then "${dep.metadata}.rlib" + # Adjust lib filename for crates of type proc-macro. Proc macros are compiled/run on the build platform architecture. + else if (lib.attrByPath [ "procMacro" ] false dep) then "${dep.metadata}${stdenv.buildPlatform.extensions.library}" + else "${dep.metadata}${stdenv.hostPlatform.extensions.library}"; + in + " --extern ${opts}${name}=${dep.lib}/lib/lib${extern}-${filename}" + ) + dependencies; + + # Create feature arguments for rustc. + mkRustcFeatureArgs = lib.concatMapStringsSep " " (f: ''--cfg feature=\"${f}\"''); + + # Whether we need to use unstable command line flags + # + # Currently just needed for standard library dependencies, which have a + # special "noprelude:" modifier. If in later versions of Rust this is + # stabilized we can account for that here, too, so we don't opt into + # instability unnecessarily. + needUnstableCLI = dependencies: + lib.any (dep: dep.stdlib or false) dependencies; + + inherit (import ./log.nix { inherit lib; }) noisily echo_colored; + + configureCrate = import ./configure-crate.nix { + inherit lib stdenv echo_colored noisily mkRustcDepArgs mkRustcFeatureArgs; + }; + + buildCrate = import ./build-crate.nix { + inherit lib stdenv mkRustcDepArgs mkRustcFeatureArgs needUnstableCLI; + }; + + installCrate = import ./install-crate.nix { inherit stdenv; }; +in + + /* The overridable pkgs.buildRustCrate function. + * + * Any unrecognized parameters will be passed as to + * the underlying stdenv.mkDerivation. + */ +crate_: lib.makeOverridable + ( + # The rust compiler to use. + # + # Default: pkgs.rustc + { rust + # Whether to build a release version (`true`) or a debug + # version (`false`). Debug versions are faster to build + # but might be much slower at runtime. + , release + # Whether to print rustc invocations etc. + # + # Example: false + # Default: true + , verbose + # A list of rust/cargo features to enable while building the crate. + # Example: [ "std" "async" ] + , features + # Additional native build inputs for building this crate. + , nativeBuildInputs + # Additional build inputs for building this crate. + # + # Example: [ pkgs.openssl ] + , buildInputs + # Allows to override the parameters to buildRustCrate + # for any rust dependency in the transitive build tree. + # + # Default: pkgs.defaultCrateOverrides + # + # Example: + # + # pkgs.defaultCrateOverrides // { + # hello = attrs: { buildInputs = [ openssl ]; }; + # } + , crateOverrides + # Rust library dependencies, i.e. other libraries that were built + # with buildRustCrate. + , dependencies + # Rust build dependencies, i.e. other libraries that were built + # with buildRustCrate and are used by a build script. + , buildDependencies + # Specify the "extern" name of a library if it differs from the library target. + # See above for an extended explanation. + # + # Default: no renames. + # + # Example: + # + # `crateRenames` supports two formats. + # + # The simple version is an attrset that maps the + # `crateName`s of the dependencies to their alternative + # names. + # + # ```nix + # { + # my_crate_name = "my_alternative_name"; + # # ... + # } + # ``` + # + # The extended version is also keyed by the `crateName`s but allows + # different names for different crate versions: + # + # ```nix + # { + # my_crate_name = [ + # { version = "1.2.3"; rename = "my_alternative_name01"; } + # { version = "3.2.3"; rename = "my_alternative_name03"; } + # ] + # # ... + # } + # ``` + # + # This roughly corresponds to the following snippet in Cargo.toml: + # + # ```toml + # [dependencies] + # my_alternative_name01 = { package = "my_crate_name", version = "0.1" } + # my_alternative_name03 = { package = "my_crate_name", version = "0.3" } + # ``` + # + # Dependencies which use the lib target name as extern name, do not need + # to be specified in the crateRenames, even if their crate name differs. + # + # Including multiple versions of a crate is very popular during + # ecosystem transitions, e.g. from futures 0.1 to futures 0.3. + , crateRenames + # A list of extra options to pass to rustc. + # + # Example: [ "-Z debuginfo=2" ] + # Default: [] + , extraRustcOpts + # A list of extra options to pass to rustc when building a build.rs. + # + # Example: [ "-Z debuginfo=2" ] + # Default: [] + , extraRustcOptsForBuildRs + # Whether to enable building tests. + # Use true to enable. + # Default: false + , buildTests + # Passed to stdenv.mkDerivation. + , preUnpack + # Passed to stdenv.mkDerivation. + , postUnpack + # Passed to stdenv.mkDerivation. + , prePatch + # Passed to stdenv.mkDerivation. + , patches + # Passed to stdenv.mkDerivation. + , postPatch + # Passed to stdenv.mkDerivation. + , preConfigure + # Passed to stdenv.mkDerivation. + , postConfigure + # Passed to stdenv.mkDerivation. + , preBuild + # Passed to stdenv.mkDerivation. + , postBuild + # Passed to stdenv.mkDerivation. + , preInstall + # Passed to stdenv.mkDerivation. + , postInstall + }: + + let + crate = crate_ // (lib.attrByPath [ crate_.crateName ] (attr: { }) crateOverrides crate_); + dependencies_ = dependencies; + buildDependencies_ = buildDependencies; + processedAttrs = [ + "src" + "nativeBuildInputs" + "buildInputs" + "crateBin" + "crateLib" + "libName" + "libPath" + "buildDependencies" + "dependencies" + "features" + "crateRenames" + "crateName" + "version" + "build" + "authors" + "colors" + "edition" + "buildTests" + "codegenUnits" + "links" + ]; + extraDerivationAttrs = builtins.removeAttrs crate processedAttrs; + nativeBuildInputs_ = nativeBuildInputs; + buildInputs_ = buildInputs; + extraRustcOpts_ = extraRustcOpts; + extraRustcOptsForBuildRs_ = extraRustcOptsForBuildRs; + buildTests_ = buildTests; + + # crate2nix has a hack for the old bash based build script that did split + # entries at `,`. No we have to work around that hack. + # https://github.com/kolloch/crate2nix/blame/5b19c1b14e1b0e5522c3e44e300d0b332dc939e7/crate2nix/templates/build.nix.tera#L89 + crateBin = lib.filter (bin: !(bin ? name && bin.name == ",")) (crate.crateBin or [ ]); + hasCrateBin = crate ? crateBin; + in + stdenv.mkDerivation (rec { + + inherit (crate) crateName; + inherit + preUnpack + postUnpack + prePatch + patches + postPatch + preConfigure + postConfigure + preBuild + postBuild + preInstall + postInstall + buildTests + ; + + src = crate.src or (fetchCrate { inherit (crate) crateName version sha256; }); + name = "rust_${crate.crateName}-${crate.version}${lib.optionalString buildTests_ "-test"}"; + version = crate.version; + depsBuildBuild = [ pkgsBuildBuild.stdenv.cc ]; + nativeBuildInputs = [ rust stdenv.cc cargo jq ] + ++ lib.optionals stdenv.buildPlatform.isDarwin [ libiconv ] + ++ (crate.nativeBuildInputs or [ ]) ++ nativeBuildInputs_; + buildInputs = lib.optionals stdenv.isDarwin [ libiconv ] ++ (crate.buildInputs or [ ]) ++ buildInputs_; + dependencies = map lib.getLib dependencies_; + buildDependencies = map lib.getLib buildDependencies_; + + completeDeps = lib.unique (dependencies ++ lib.concatMap (dep: dep.completeDeps) dependencies); + completeBuildDeps = lib.unique ( + buildDependencies + ++ lib.concatMap (dep: dep.completeBuildDeps ++ dep.completeDeps) buildDependencies + ); + + # Create a list of features that are enabled by the crate itself and + # through the features argument of buildRustCrate. Exclude features + # with a forward slash, since they are passed through to dependencies, + # and dep: features, since they're internal-only and do nothing except + # enable optional dependencies. + crateFeatures = lib.optionals (crate ? features) + (builtins.filter + (f: !(lib.hasInfix "/" f || lib.hasPrefix "dep:" f)) + (crate.features ++ features) + ); + + libName = if crate ? libName then crate.libName else crate.crateName; + libPath = lib.optionalString (crate ? libPath) crate.libPath; + + # Seed the symbol hashes with something unique every time. + # https://doc.rust-lang.org/1.0.0/rustc/metadata/loader/index.html#frobbing-symbols + metadata = + let + depsMetadata = lib.foldl' (str: dep: str + dep.metadata) "" (dependencies ++ buildDependencies); + hashedMetadata = builtins.hashString "sha256" + (crateName + "-" + crateVersion + "___" + toString (mkRustcFeatureArgs crateFeatures) + + "___" + depsMetadata + "___" + stdenv.hostPlatform.rust.rustcTarget); + in + lib.substring 0 10 hashedMetadata; + + build = crate.build or ""; + # Either set to a concrete sub path to the crate root + # or use `null` for auto-detect. + workspace_member = crate.workspace_member or "."; + crateAuthors = if crate ? authors && lib.isList crate.authors then crate.authors else [ ]; + crateDescription = crate.description or ""; + crateHomepage = crate.homepage or ""; + crateLicense = crate.license or ""; + crateLicenseFile = crate.license-file or ""; + crateLinks = crate.links or ""; + crateReadme = crate.readme or ""; + crateRepository = crate.repository or ""; + crateRustVersion = crate.rust-version or ""; + crateVersion = crate.version; + crateType = + if lib.attrByPath [ "procMacro" ] false crate then [ "proc-macro" ] else + if lib.attrByPath [ "plugin" ] false crate then [ "dylib" ] else + (crate.type or [ "lib" ]); + colors = lib.attrByPath [ "colors" ] "always" crate; + extraLinkFlags = lib.concatStringsSep " " (crate.extraLinkFlags or [ ]); + edition = crate.edition or null; + codegenUnits = if crate ? codegenUnits then crate.codegenUnits else 1; + extraRustcOpts = + lib.optionals (crate ? extraRustcOpts) crate.extraRustcOpts + ++ extraRustcOpts_ + ++ (lib.optional (edition != null) "--edition ${edition}"); + extraRustcOptsForBuildRs = + lib.optionals (crate ? extraRustcOptsForBuildRs) crate.extraRustcOptsForBuildRs + ++ extraRustcOptsForBuildRs_ + ++ (lib.optional (edition != null) "--edition ${edition}"); + + + configurePhase = configureCrate { + inherit crateName buildDependencies completeDeps completeBuildDeps crateDescription + crateFeatures crateRenames libName build workspace_member release libPath crateVersion crateLinks + extraLinkFlags extraRustcOptsForBuildRs + crateLicense crateLicenseFile crateReadme crateRepository crateRustVersion + crateAuthors crateHomepage verbose colors codegenUnits; + }; + buildPhase = buildCrate { + inherit crateName dependencies + crateFeatures crateRenames libName release libPath crateType + metadata hasCrateBin crateBin verbose colors + extraRustcOpts buildTests codegenUnits; + }; + dontStrip = !release; + + # We need to preserve metadata in .rlib, which might get stripped on macOS. See https://github.com/NixOS/nixpkgs/issues/218712 + stripExclude = [ "*.rlib" ]; + + installPhase = installCrate crateName metadata buildTests; + + # depending on the test setting we are either producing something with bins + # and libs or just test binaries + outputs = if buildTests then [ "out" ] else [ "out" "lib" ]; + outputDev = if buildTests then [ "out" ] else [ "lib" ]; + + meta = { + mainProgram = crateName; + badPlatforms = [ + # Rust is currently unable to target the n32 ABI + lib.systems.inspect.patterns.isMips64n32 + ]; + }; + } // extraDerivationAttrs + ) + ) +{ + rust = rustc; + release = crate_.release or true; + verbose = crate_.verbose or true; + extraRustcOpts = [ ]; + extraRustcOptsForBuildRs = [ ]; + features = [ ]; + nativeBuildInputs = [ ]; + buildInputs = [ ]; + crateOverrides = defaultCrateOverrides; + preUnpack = crate_.preUnpack or ""; + postUnpack = crate_.postUnpack or ""; + prePatch = crate_.prePatch or ""; + patches = crate_.patches or [ ]; + postPatch = crate_.postPatch or ""; + preConfigure = crate_.preConfigure or ""; + postConfigure = crate_.postConfigure or ""; + preBuild = crate_.preBuild or ""; + postBuild = crate_.postBuild or ""; + preInstall = crate_.preInstall or ""; + postInstall = crate_.postInstall or ""; + dependencies = crate_.dependencies or [ ]; + buildDependencies = crate_.buildDependencies or [ ]; + crateRenames = crate_.crateRenames or { }; + buildTests = crate_.buildTests or false; +} diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/helpers.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/helpers.nix new file mode 100644 index 000000000000..386d0ce7084f --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/helpers.nix @@ -0,0 +1,26 @@ +{stdenv, lib}: +{ + kernel = stdenv.hostPlatform.parsed.kernel.name; + abi = stdenv.hostPlatform.parsed.abi.name; + cpu = stdenv.hostPlatform.parsed.cpu.name; + updateFeatures = f: up: functions: lib.deepSeq f (lib.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions); + mapFeatures = features: map (fun: fun { features = features; }); + mkFeatures = feat: lib.foldl (features: featureName: + if feat.${featureName} or false then + [ featureName ] ++ features + else + features + ) [] (lib.attrNames feat); + include = includedFiles: src: builtins.filterSource (path: type: + lib.any (f: + let p = toString (src + ("/" + f)); + in + p == path || (lib.strings.hasPrefix (p + "/") path) + ) includedFiles + ) src; + exclude = excludedFiles: src: builtins.filterSource (path: type: + lib.all (f: + !lib.strings.hasPrefix (toString (src + ("/" + f))) path + ) excludedFiles + ) src; +} diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/install-crate.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/install-crate.nix new file mode 100644 index 000000000000..7c7c102833d8 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/install-crate.nix @@ -0,0 +1,51 @@ +{ stdenv }: +crateName: metadata: buildTests: +if !buildTests then '' + runHook preInstall + # always create $out even if we do not have binaries. We are detecting binary targets during compilation, if those are missing there is no way to only have $lib + mkdir $out + if [[ -s target/env ]]; then + mkdir -p $lib + cp target/env $lib/env + fi + if [[ -s target/link.final ]]; then + mkdir -p $lib/lib + cp target/link.final $lib/lib/link + fi + if [[ "$(ls -A target/lib)" ]]; then + mkdir -p $lib/lib + cp -r target/lib/* $lib/lib #*/ + for library in $lib/lib/*.so $lib/lib/*.dylib; do #*/ + ln -s $library $(echo $library | sed -e "s/-${metadata}//") + done + fi + if [[ "$(ls -A target/build)" ]]; then # */ + mkdir -p $lib/lib + cp -r target/build/* $lib/lib # */ + fi + if [[ -d target/bin ]]; then + if [[ "$(ls -A target/bin)" ]]; then + mkdir -p $out/bin + cp -rP target/bin/* $out/bin # */ + fi + fi + runHook postInstall +'' else +# for tests we just put them all in the output. No execution. +'' + runHook preInstall + + mkdir -p $out/tests + if [ -e target/bin ]; then + find target/bin/ -type f -executable -exec cp {} $out/tests \; + fi + if [ -e target/lib ]; then + find target/lib/ -type f \! -name '*.rlib' \ + -a \! -name '*${stdenv.hostPlatform.extensions.library}' \ + -a \! -name '*.d' \ + -executable \ + -print0 | xargs --no-run-if-empty --null install --target $out/tests; + fi + + runHook postInstall +'' diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/lib.sh b/nixpkgs/pkgs/build-support/rust/build-rust-crate/lib.sh new file mode 100644 index 000000000000..0181ae432c85 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/lib.sh @@ -0,0 +1,182 @@ +echo_build_heading() { + if (( $# == 1 )); then + echo_colored "Building $1" + else + echo_colored "Building $1 ($2)" + fi +} + +build_lib() { + lib_src=$1 + echo_build_heading $lib_src ${libName} + + noisily rustc \ + --crate-name $CRATE_NAME \ + $lib_src \ + --out-dir target/lib \ + -L dependency=target/deps \ + --cap-lints allow \ + $LINK \ + $EXTRA_LINK_ARGS \ + $EXTRA_LINK_ARGS_LIB \ + $LIB_RUSTC_OPTS \ + $BUILD_OUT_DIR \ + $EXTRA_BUILD \ + $EXTRA_FEATURES \ + $EXTRA_RUSTC_FLAGS \ + --color $colors + + EXTRA_LIB=" --extern $CRATE_NAME=target/lib/lib$CRATE_NAME-$metadata.rlib" + if [ -e target/deps/lib$CRATE_NAME-$metadata$LIB_EXT ]; then + EXTRA_LIB="$EXTRA_LIB --extern $CRATE_NAME=target/lib/lib$CRATE_NAME-$metadata$LIB_EXT" + fi +} + +build_bin() { + local crate_name=$1 + local crate_name_=$(echo $crate_name | tr '-' '_') + local main_file="" + + if [[ ! -z $2 ]]; then + main_file=$2 + fi + echo_build_heading $@ + noisily rustc \ + --crate-name $crate_name_ \ + $main_file \ + --crate-type bin \ + $BIN_RUSTC_OPTS \ + --out-dir target/bin \ + -L dependency=target/deps \ + $LINK \ + $EXTRA_LINK_ARGS \ + $EXTRA_LINK_ARGS_BINS \ + $EXTRA_LIB \ + --cap-lints allow \ + $BUILD_OUT_DIR \ + $EXTRA_BUILD \ + $EXTRA_FEATURES \ + $EXTRA_RUSTC_FLAGS \ + --color ${colors} \ + + if [ "$crate_name_" != "$crate_name" ]; then + mv target/bin/$crate_name_ target/bin/$crate_name + fi +} + +build_lib_test() { + local file="$1" + EXTRA_RUSTC_FLAGS="--test $EXTRA_RUSTC_FLAGS" build_lib "$1" "$2" +} + +build_bin_test() { + local crate="$1" + local file="$2" + EXTRA_RUSTC_FLAGS="--test $EXTRA_RUSTC_FLAGS" build_bin "$1" "$2" +} + +build_bin_test_file() { + local file="$1" + local derived_crate_name="${file//\//_}" + # Make sure to strip the top level `tests` directory: see #204051. Note that + # a forward slash has now become an underscore due to the substitution + # above. + derived_crate_name=${derived_crate_name#"tests_"} + derived_crate_name="${derived_crate_name%.rs}" + build_bin_test "$derived_crate_name" "$file" +} + +# Add additional link options that were provided by the build script. +setup_link_paths() { + EXTRA_LIB="" + if [[ -e target/link_ ]]; then + EXTRA_BUILD="$(cat target/link_) $EXTRA_BUILD" + fi + + echo "$EXTRA_LINK_SEARCH" | while read i; do + if [[ ! -z "$i" ]]; then + for library in $i; do + echo "-L $library" >> target/link + L=$(echo $library | sed -e "s#$(pwd)/target/build#$lib/lib#") + echo "-L $L" >> target/link.final + done + fi + done + echo "$EXTRA_LINK_LIBS" | while read i; do + if [[ ! -z "$i" ]]; then + for library in $i; do + echo "-l $library" >> target/link + done + fi + done + + if [[ -e target/link ]]; then + tr '\n' ' ' < target/link > target/link_ + LINK=$(cat target/link_) + fi +} + +search_for_bin_path() { + # heuristic to "guess" the correct source file as found in cargo: + # https://github.com/rust-lang/cargo/blob/90fc9f620190d5fa3c80b0c8c65a1e1361e6b8ae/src/cargo/util/toml/targets.rs#L308-L325 + + BIN_NAME=$1 + BIN_NAME_=$(echo $BIN_NAME | tr '-' '_') + + # the first two cases are the "new" default IIRC + FILES=( "src/bin/$BIN_NAME.rs" "src/bin/$BIN_NAME/main.rs" "src/bin/$BIN_NAME_.rs" "src/bin/$BIN_NAME_/main.rs" "src/bin/main.rs" "src/main.rs" ) + + if ! [ -e "$LIB_PATH" -o -e src/lib.rs -o -e "src/$LIB_NAME.rs" ]; then + # if this is not a library the following path is also valid + FILES=( "src/$BIN_NAME.rs" "src/$BIN_NAME_.rs" "${FILES[@]}" ) + fi + + for file in "${FILES[@]}"; + do + echo "checking file $file" + # first file that exists wins + if [[ -e "$file" ]]; then + BIN_PATH="$file" + break + fi + done + + if [[ -z "$BIN_PATH" ]]; then + echo_error "ERROR: failed to find file for binary target: $BIN_NAME" >&2 + exit 1 + fi +} + +# Extracts cargo_toml_path of the matching crate. +matching_cargo_toml_path() { + local manifest_path="$1" + local expected_crate_name="$2" + + # If the Cargo.toml is not a workspace root, + # it will only contain one package in ".packages" + # because "--no-deps" suppressed dependency resolution. + # + # But to make it more general, we search for a matching + # crate in all packages and use the manifest path that + # is referenced there. + cargo metadata --no-deps --format-version 1 \ + --manifest-path "$manifest_path" \ + | jq -r '.packages[] + | select( .name == "'$expected_crate_name'") + | .manifest_path' +} + +# Find a Cargo.toml in the current or any sub directory +# with a matching crate name. +matching_cargo_toml_dir() { + local expected_crate_name="$1" + + find -L -name Cargo.toml | sort | while read manifest_path; do + echo "...checking manifest_path $manifest_path" >&2 + local matching_path="$(matching_cargo_toml_path "$manifest_path" "$expected_crate_name")" + if [ -n "${matching_path}" ]; then + echo "$(dirname $matching_path)" + break + fi + done +} diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/log.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/log.nix new file mode 100644 index 000000000000..9054815f4a1b --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/log.nix @@ -0,0 +1,59 @@ +{ lib }: + +let echo_colored_body = start_escape: + # Body of a function that behaves like "echo" but + # has the output colored by the given start_escape + # sequence. E.g. + # + # * echo_x "Building ..." + # * echo_x -n "Running " + # + # This is more complicated than apparent at first sight + # because: + # * The color markers and the text must be print + # in the same echo statement. Otherise, other + # intermingled text from concurrent builds will + # be colored as well. + # * We need to preserve the trailing newline of the + # echo if and only if it is present. Bash likes + # to strip those if we capture the output of echo + # in a variable. + # * Leading "-" will be interpreted by test as an + # option for itself. Therefore, we prefix it with + # an x in `[[ "x$1" =~ ^x- ]]`. + '' + local echo_args=""; + while [[ "x$1" =~ ^x- ]]; do + echo_args+=" $1" + shift + done + + local start_escape="$(printf '${start_escape}')" + local reset="$(printf '\033[0m')" + echo $echo_args $start_escape"$@"$reset + ''; + echo_conditional_colored_body = colors: start_escape: + if colors == "always" + then (echo_colored_body start_escape) + else ''echo "$@"''; +in { + echo_colored = colors: '' + echo_colored() { + ${echo_conditional_colored_body colors ''\033[0;1;32m''} + } + + echo_error() { + ${echo_conditional_colored_body colors ''\033[0;1;31m''} + } + ''; + + noisily = colors: verbose: '' + noisily() { + ${lib.optionalString verbose '' + echo_colored -n "Running " + echo $@ + ''} + $@ + } + ''; +} diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/test/brotli-crates.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/test/brotli-crates.nix new file mode 100644 index 000000000000..4831c1062715 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/test/brotli-crates.nix @@ -0,0 +1,95 @@ +{ lib, stdenv, buildRustCrate, fetchgit }: +let kernel = stdenv.buildPlatform.parsed.kernel.name; + abi = stdenv.buildPlatform.parsed.abi.name; + include = includedFiles: src: builtins.filterSource (path: type: + lib.lists.any (f: + let p = toString (src + ("/" + f)); in + (path == p) || (type == "directory" && lib.strings.hasPrefix path p) + ) includedFiles + ) src; + updateFeatures = f: up: functions: builtins.deepSeq f (lib.lists.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions); + mapFeatures = features: map (fun: fun { features = features; }); + mkFeatures = feat: lib.lists.foldl (features: featureName: + if feat.${featureName} or false then + [ featureName ] ++ features + else + features + ) [] (builtins.attrNames feat); +in +rec { + alloc_no_stdlib_1_3_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "alloc-no-stdlib"; + version = "1.3.0"; + authors = [ "Daniel Reiter Horn <danielrh@dropbox.com>" ]; + sha256 = "1jcp27pzmqdszgp80y484g4kwbjbg7x8a589drcwbxg0i8xwkir9"; + crateBin = [ { name = "example"; } ]; + inherit dependencies buildDependencies features; + }; + brotli_2_5_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "brotli"; + version = "2.5.0"; + authors = [ "Daniel Reiter Horn <danielrh@dropbox.com>" "The Brotli Authors" ]; + sha256 = "1ynw4hkdwnp0kj30p86ls44ahv4s99258s019bqrq4mya8hlsb5b"; + crateBin = [ { name = "brotli"; } ]; + inherit dependencies buildDependencies features; + }; + brotli_decompressor_1_3_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "brotli-decompressor"; + version = "1.3.1"; + authors = [ "Daniel Reiter Horn <danielrh@dropbox.com>" "The Brotli Authors" ]; + sha256 = "022g69q1xzwdj0130qm3fa4qwpn4q1jx3lc8yz0v0v201p7bm8fb"; + crateBin = [ { name = "brotli-decompressor"; } ]; + inherit dependencies buildDependencies features; + }; + alloc_no_stdlib_1_3_0 = { features?(alloc_no_stdlib_1_3_0_features {}) }: alloc_no_stdlib_1_3_0_ { + features = mkFeatures (features.alloc_no_stdlib_1_3_0 or {}); + }; + alloc_no_stdlib_1_3_0_features = f: updateFeatures f ({ + alloc_no_stdlib_1_3_0.default = (f.alloc_no_stdlib_1_3_0.default or true); + }) []; + brotli_2_5_0 = { features?(brotli_2_5_0_features {}) }: brotli_2_5_0_ { + dependencies = mapFeatures features ([ alloc_no_stdlib_1_3_0 brotli_decompressor_1_3_1 ]); + features = mkFeatures (features.brotli_2_5_0 or {}); + }; + brotli_2_5_0_features = f: updateFeatures f (rec { + alloc_no_stdlib_1_3_0.no-stdlib = + (f.alloc_no_stdlib_1_3_0.no-stdlib or false) || + (brotli_2_5_0.no-stdlib or false) || + (f.brotli_2_5_0.no-stdlib or false); + alloc_no_stdlib_1_3_0.default = true; + brotli_2_5_0.default = (f.brotli_2_5_0.default or true); + brotli_decompressor_1_3_1.disable-timer = + (f.brotli_decompressor_1_3_1.disable-timer or false) || + (brotli_2_5_0.disable-timer or false) || + (f.brotli_2_5_0.disable-timer or false); + brotli_decompressor_1_3_1.no-stdlib = + (f.brotli_decompressor_1_3_1.no-stdlib or false) || + (brotli_2_5_0.no-stdlib or false) || + (f.brotli_2_5_0.no-stdlib or false); + brotli_decompressor_1_3_1.benchmark = + (f.brotli_decompressor_1_3_1.benchmark or false) || + (brotli_2_5_0.benchmark or false) || + (f.brotli_2_5_0.benchmark or false); + brotli_decompressor_1_3_1.default = true; + brotli_decompressor_1_3_1.seccomp = + (f.brotli_decompressor_1_3_1.seccomp or false) || + (brotli_2_5_0.seccomp or false) || + (f.brotli_2_5_0.seccomp or false); + }) [ alloc_no_stdlib_1_3_0_features brotli_decompressor_1_3_1_features ]; + brotli_decompressor_1_3_1 = { features?(brotli_decompressor_1_3_1_features {}) }: brotli_decompressor_1_3_1_ { + dependencies = mapFeatures features ([ alloc_no_stdlib_1_3_0 ]); + features = mkFeatures (features.brotli_decompressor_1_3_1 or {}); + }; + brotli_decompressor_1_3_1_features = f: updateFeatures f (rec { + alloc_no_stdlib_1_3_0.no-stdlib = + (f.alloc_no_stdlib_1_3_0.no-stdlib or false) || + (brotli_decompressor_1_3_1.no-stdlib or false) || + (f.brotli_decompressor_1_3_1.no-stdlib or false); + alloc_no_stdlib_1_3_0.default = true; + alloc_no_stdlib_1_3_0.unsafe = + (f.alloc_no_stdlib_1_3_0.unsafe or false) || + (brotli_decompressor_1_3_1.unsafe or false) || + (f.brotli_decompressor_1_3_1.unsafe or false); + brotli_decompressor_1_3_1.default = (f.brotli_decompressor_1_3_1.default or true); + }) [ alloc_no_stdlib_1_3_0_features ]; +} diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/test/default.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/test/default.nix new file mode 100644 index 000000000000..522eedfede7f --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/test/default.nix @@ -0,0 +1,671 @@ +{ lib +, buildPackages +, buildRustCrate +, callPackage +, releaseTools +, runCommand +, runCommandCC +, stdenv +, symlinkJoin +, writeTextFile +}: + +let + mkCrate = buildRustCrate: args: let + p = { + crateName = "nixtestcrate"; + version = "0.1.0"; + authors = [ "Test <test@example.com>" ]; + } // args; + in buildRustCrate p; + mkHostCrate = mkCrate buildRustCrate; + + mkCargoToml = + { name, crateVersion ? "0.1.0", path ? "Cargo.toml" }: + mkFile path '' + [package] + name = ${builtins.toJSON name} + version = ${builtins.toJSON crateVersion} + ''; + + mkFile = destination: text: writeTextFile { + name = "src"; + destination = "/${destination}"; + inherit text; + }; + + mkBin = name: mkFile name '' + use std::env; + fn main() { + let name: String = env::args().nth(0).unwrap(); + println!("executed {}", name); + } + ''; + + mkBinExtern = name: extern: mkFile name '' + extern crate ${extern}; + fn main() { + assert_eq!(${extern}::test(), 23); + } + ''; + + mkTestFile = name: functionName: mkFile name '' + #[cfg(test)] + #[test] + fn ${functionName}() { + assert!(true); + } + ''; + mkTestFileWithMain = name: functionName: mkFile name '' + #[cfg(test)] + #[test] + fn ${functionName}() { + assert!(true); + } + + fn main() {} + ''; + + + mkLib = name: mkFile name "pub fn test() -> i32 { return 23; }"; + + mkTest = crateArgs: let + crate = mkHostCrate (builtins.removeAttrs crateArgs ["expectedTestOutput"]); + hasTests = crateArgs.buildTests or false; + expectedTestOutputs = crateArgs.expectedTestOutputs or null; + binaries = map (v: lib.escapeShellArg v.name) (crateArgs.crateBin or []); + isLib = crateArgs ? libName || crateArgs ? libPath; + crateName = crateArgs.crateName or "nixtestcrate"; + libName = crateArgs.libName or crateName; + + libTestBinary = if !isLib then null else mkHostCrate { + crateName = "run-test-${crateName}"; + dependencies = [ crate ]; + src = mkBinExtern "src/main.rs" libName; + }; + + in + assert expectedTestOutputs != null -> hasTests; + assert hasTests -> expectedTestOutputs != null; + + runCommand "run-buildRustCrate-${crateName}-test" { + nativeBuildInputs = [ crate ]; + } (if !hasTests then '' + ${lib.concatMapStringsSep "\n" (binary: + # Can't actually run the binary when cross-compiling + (lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "type ") + binary + ) binaries} + ${lib.optionalString isLib '' + test -e ${crate}/lib/*.rlib || exit 1 + ${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "test -x "} \ + ${libTestBinary}/bin/run-test-${crateName} + ''} + touch $out + '' else if stdenv.hostPlatform == stdenv.buildPlatform then '' + for file in ${crate}/tests/*; do + $file 2>&1 >> $out + done + set -e + ${lib.concatMapStringsSep "\n" (o: "grep '${o}' $out || { echo 'output \"${o}\" not found in:'; cat $out; exit 23; }") expectedTestOutputs} + '' else '' + for file in ${crate}/tests/*; do + test -x "$file" + done + touch "$out" + '' + ); + + /* Returns a derivation that asserts that the crate specified by `crateArgs` + has the specified files as output. + + `name` is used as part of the derivation name that performs the checking. + + `crateArgs` is passed to `mkHostCrate` to build the crate with `buildRustCrate`. + + `expectedFiles` contains a list of expected file paths in the output. E.g. + `[ "./bin/my_binary" ]`. + + `output` specifies the name of the output to use. By default, the default + output is used but e.g. `output = "lib";` will cause the lib output + to be checked instead. You do not need to specify any directories. + */ + assertOutputs = { name, crateArgs, expectedFiles, output? null }: + assert (builtins.isString name); + assert (builtins.isAttrs crateArgs); + assert (builtins.isList expectedFiles); + + let + crate = mkHostCrate (builtins.removeAttrs crateArgs ["expectedTestOutput"]); + crateOutput = if output == null then crate else crate."${output}"; + expectedFilesFile = writeTextFile { + name = "expected-files-${name}"; + text = + let sorted = builtins.sort (a: b: a<b) expectedFiles; + concatenated = builtins.concatStringsSep "\n" sorted; + in "${concatenated}\n"; + }; + in + runCommand "assert-outputs-${name}" { + } ('' + local actualFiles=$(mktemp) + + cd "${crateOutput}" + find . -type f \ + | sort \ + '' + # sed out the hash because it differs per platform + + '' + | sed -E -e 's/-[0-9a-fA-F]{10}\.rlib/-HASH.rlib/g' \ + > "$actualFiles" + diff -q ${expectedFilesFile} "$actualFiles" > /dev/null || { + echo -e "\033[0;1;31mERROR: Difference in expected output files in ${crateOutput} \033[0m" >&2 + echo === Got: + sed -e 's/^/ /' $actualFiles + echo === Expected: + sed -e 's/^/ /' ${expectedFilesFile} + echo === Diff: + diff -u ${expectedFilesFile} $actualFiles |\ + tail -n +3 |\ + sed -e 's/^/ /' + exit 1 + } + touch $out + '') + ; + + in rec { + + tests = let + cases = rec { + libPath = { libPath = "src/my_lib.rs"; src = mkLib "src/my_lib.rs"; }; + srcLib = { src = mkLib "src/lib.rs"; }; + + # This used to be supported by cargo but as of 1.40.0 I can't make it work like that with just cargo anymore. + # This might be a regression or deprecated thing they finally removed… + # customLibName = { libName = "test_lib"; src = mkLib "src/test_lib.rs"; }; + # rustLibTestsCustomLibName = { + # libName = "test_lib"; + # src = mkTestFile "src/test_lib.rs" "foo"; + # buildTests = true; + # expectedTestOutputs = [ "test foo ... ok" ]; + # }; + + customLibNameAndLibPath = { libName = "test_lib"; libPath = "src/best-lib.rs"; src = mkLib "src/best-lib.rs"; }; + crateBinWithPath = { crateBin = [{ name = "test_binary1"; path = "src/foobar.rs"; }]; src = mkBin "src/foobar.rs"; }; + crateBinNoPath1 = { crateBin = [{ name = "my-binary2"; }]; src = mkBin "src/my_binary2.rs"; }; + crateBinNoPath2 = { + crateBin = [{ name = "my-binary3"; } { name = "my-binary4"; }]; + src = symlinkJoin { + name = "buildRustCrateMultipleBinariesCase"; + paths = [ (mkBin "src/bin/my_binary3.rs") (mkBin "src/bin/my_binary4.rs") ]; + }; + }; + crateBinNoPath3 = { crateBin = [{ name = "my-binary5"; }]; src = mkBin "src/bin/main.rs"; }; + crateBinNoPath4 = { crateBin = [{ name = "my-binary6"; }]; src = mkBin "src/main.rs";}; + crateBinRename1 = { + crateBin = [{ name = "my-binary-rename1"; }]; + src = mkBinExtern "src/main.rs" "foo_renamed"; + dependencies = [ (mkHostCrate { crateName = "foo"; src = mkLib "src/lib.rs"; }) ]; + crateRenames = { "foo" = "foo_renamed"; }; + }; + crateBinRename2 = { + crateBin = [{ name = "my-binary-rename2"; }]; + src = mkBinExtern "src/main.rs" "foo_renamed"; + dependencies = [ (mkHostCrate { crateName = "foo"; libName = "foolib"; src = mkLib "src/lib.rs"; }) ]; + crateRenames = { "foo" = "foo_renamed"; }; + }; + crateBinRenameMultiVersion = let + crateWithVersion = version: mkHostCrate { + crateName = "my_lib"; + inherit version; + src = mkFile "src/lib.rs" '' + pub const version: &str = "${version}"; + ''; + }; + depCrate01 = crateWithVersion "0.1.2"; + depCrate02 = crateWithVersion "0.2.1"; + in { + crateName = "my_bin"; + src = symlinkJoin { + name = "my_bin_src"; + paths = [ + (mkFile "src/main.rs" '' + #[test] + fn my_lib_01() { assert_eq!(lib01::version, "0.1.2"); } + + #[test] + fn my_lib_02() { assert_eq!(lib02::version, "0.2.1"); } + + fn main() { } + '') + ]; + }; + dependencies = [ depCrate01 depCrate02 ]; + crateRenames = { + "my_lib" = [ + { + version = "0.1.2"; + rename = "lib01"; + } + { + version = "0.2.1"; + rename = "lib02"; + } + ]; + }; + buildTests = true; + expectedTestOutputs = [ + "test my_lib_01 ... ok" + "test my_lib_02 ... ok" + ]; + }; + rustLibTestsDefault = { + src = mkTestFile "src/lib.rs" "baz"; + buildTests = true; + expectedTestOutputs = [ "test baz ... ok" ]; + }; + rustLibTestsCustomLibPath = { + libPath = "src/test_path.rs"; + src = mkTestFile "src/test_path.rs" "bar"; + buildTests = true; + expectedTestOutputs = [ "test bar ... ok" ]; + }; + rustLibTestsCustomLibPathWithTests = { + libPath = "src/test_path.rs"; + src = symlinkJoin { + name = "rust-lib-tests-custom-lib-path-with-tests-dir"; + paths = [ + (mkTestFile "src/test_path.rs" "bar") + (mkTestFile "tests/something.rs" "something") + ]; + }; + buildTests = true; + expectedTestOutputs = [ + "test bar ... ok" + "test something ... ok" + ]; + }; + rustBinTestsCombined = { + src = symlinkJoin { + name = "rust-bin-tests-combined"; + paths = [ + (mkTestFileWithMain "src/main.rs" "src_main") + (mkTestFile "tests/foo.rs" "tests_foo") + (mkTestFile "tests/bar.rs" "tests_bar") + ]; + }; + buildTests = true; + expectedTestOutputs = [ + "test src_main ... ok" + "test tests_foo ... ok" + "test tests_bar ... ok" + ]; + }; + rustBinTestsSubdirCombined = { + src = symlinkJoin { + name = "rust-bin-tests-subdir-combined"; + paths = [ + (mkTestFileWithMain "src/main.rs" "src_main") + (mkTestFile "tests/foo/main.rs" "tests_foo") + (mkTestFile "tests/bar/main.rs" "tests_bar") + ]; + }; + buildTests = true; + expectedTestOutputs = [ + "test src_main ... ok" + "test tests_foo ... ok" + "test tests_bar ... ok" + ]; + }; + linkAgainstRlibCrate = { + crateName = "foo"; + src = mkFile "src/main.rs" '' + extern crate somerlib; + fn main() {} + ''; + dependencies = [ + (mkHostCrate { + crateName = "somerlib"; + type = [ "rlib" ]; + src = mkLib "src/lib.rs"; + }) + ]; + }; + buildScriptDeps = let + depCrate = buildRustCrate: boolVal: mkCrate buildRustCrate { + crateName = "bar"; + src = mkFile "src/lib.rs" '' + pub const baz: bool = ${boolVal}; + ''; + }; + in { + crateName = "foo"; + src = symlinkJoin { + name = "build-script-and-main"; + paths = [ + (mkFile "src/main.rs" '' + extern crate bar; + #[cfg(test)] + #[test] + fn baz_false() { assert!(!bar::baz); } + fn main() { } + '') + (mkFile "build.rs" '' + extern crate bar; + fn main() { assert!(bar::baz); } + '') + ]; + }; + buildDependencies = [ (depCrate buildPackages.buildRustCrate "true") ]; + dependencies = [ (depCrate buildRustCrate "false") ]; + buildTests = true; + expectedTestOutputs = [ "test baz_false ... ok" ]; + }; + buildScriptFeatureEnv = { + crateName = "build-script-feature-env"; + features = [ "some-feature" "crate/another_feature" ]; + src = symlinkJoin { + name = "build-script-feature-env"; + paths = [ + (mkFile "src/main.rs" '' + #[cfg(test)] + #[test] + fn feature_not_visible() { + assert!(std::env::var("CARGO_FEATURE_SOME_FEATURE").is_err()); + assert!(option_env!("CARGO_FEATURE_SOME_FEATURE").is_none()); + } + fn main() {} + '') + (mkFile "build.rs" '' + fn main() { + assert!(std::env::var("CARGO_FEATURE_SOME_FEATURE").is_ok()); + assert!(option_env!("CARGO_FEATURE_SOME_FEATURE").is_none()); + } + '') + ]; + }; + buildTests = true; + expectedTestOutputs = [ "test feature_not_visible ... ok" ]; + }; + # Regression test for https://github.com/NixOS/nixpkgs/pull/88054 + # Build script output should be rewritten as valid env vars. + buildScriptIncludeDirDeps = let + depCrate = mkHostCrate { + crateName = "bar"; + src = symlinkJoin { + name = "build-script-and-include-dir-bar"; + paths = [ + (mkFile "src/lib.rs" '' + fn main() { } + '') + (mkFile "build.rs" '' + use std::path::PathBuf; + fn main() { println!("cargo:include-dir={}/src", std::env::current_dir().unwrap_or(PathBuf::from(".")).to_str().unwrap()); } + '') + ]; + }; + }; + in { + crateName = "foo"; + src = symlinkJoin { + name = "build-script-and-include-dir-foo"; + paths = [ + (mkFile "src/main.rs" '' + fn main() { } + '') + (mkFile "build.rs" '' + fn main() { assert!(std::env::var_os("DEP_BAR_INCLUDE_DIR").is_some()); } + '') + ]; + }; + buildDependencies = [ depCrate ]; + dependencies = [ depCrate ]; + }; + # Regression test for https://github.com/NixOS/nixpkgs/issues/74071 + # Whenevever a build.rs file is generating files those should not be overlayed onto the actual source dir + buildRsOutDirOverlay = { + src = symlinkJoin { + name = "buildrs-out-dir-overlay"; + paths = [ + (mkLib "src/lib.rs") + (mkFile "build.rs" '' + use std::env; + use std::ffi::OsString; + use std::fs; + use std::path::Path; + fn main() { + let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR not set"); + let out_file = Path::new(&out_dir).join("lib.rs"); + fs::write(out_file, "invalid rust code!").expect("failed to write lib.rs"); + } + '') + ]; + }; + }; + # Regression test for https://github.com/NixOS/nixpkgs/pull/83379 + # link flag order should be preserved + linkOrder = { + src = symlinkJoin { + name = "buildrs-out-dir-overlay"; + paths = [ + (mkFile "build.rs" '' + fn main() { + // in the other order, linkage will fail + println!("cargo:rustc-link-lib=b"); + println!("cargo:rustc-link-lib=a"); + } + '') + (mkFile "src/main.rs" '' + extern "C" { + fn hello_world(); + } + fn main() { + unsafe { + hello_world(); + } + } + '') + ]; + }; + buildInputs = let + compile = name: text: let + src = writeTextFile { + name = "${name}-src.c"; + inherit text; + }; + in runCommandCC name {} '' + mkdir -p $out/lib + # Note: On darwin (which defaults to clang) we have to add + # `-undefined dynamic_lookup` as otherwise the compilation fails. + $CC -shared \ + ${lib.optionalString stdenv.isDarwin "-undefined dynamic_lookup"} \ + -o $out/lib/${name}${stdenv.hostPlatform.extensions.library} ${src} + ''; + b = compile "libb" '' + #include <stdio.h> + + void hello(); + + void hello_world() { + hello(); + printf(" world!\n"); + } + ''; + a = compile "liba" '' + #include <stdio.h> + + void hello() { + printf("hello"); + } + ''; + in [ a b ]; + }; + rustCargoTomlInSubDir = { + # The "workspace_member" can be set to the sub directory with the crate to build. + # By default ".", meaning the top level directory is assumed. + # Using null will trigger a search. + workspace_member = null; + src = symlinkJoin rec { + name = "find-cargo-toml"; + paths = [ + (mkCargoToml { name = "ignoreMe"; }) + (mkTestFileWithMain "src/main.rs" "ignore_main") + + (mkCargoToml { name = "rustCargoTomlInSubDir"; path = "subdir/Cargo.toml"; }) + (mkTestFileWithMain "subdir/src/main.rs" "src_main") + (mkTestFile "subdir/tests/foo/main.rs" "tests_foo") + (mkTestFile "subdir/tests/bar/main.rs" "tests_bar") + ]; + }; + buildTests = true; + expectedTestOutputs = [ + "test src_main ... ok" + "test tests_foo ... ok" + "test tests_bar ... ok" + ]; + }; + + rustCargoTomlInTopDir = + let + withoutCargoTomlSearch = builtins.removeAttrs rustCargoTomlInSubDir [ "workspace_member" ]; + in + withoutCargoTomlSearch // { + expectedTestOutputs = [ + "test ignore_main ... ok" + ]; + }; + procMacroInPrelude = { + procMacro = true; + edition = "2018"; + src = symlinkJoin { + name = "proc-macro-in-prelude"; + paths = [ + (mkFile "src/lib.rs" '' + use proc_macro::TokenTree; + '') + ]; + }; + }; + }; + brotliCrates = (callPackage ./brotli-crates.nix {}); + rcgenCrates = callPackage ./rcgen-crates.nix { + # Suppress deprecation warning + buildRustCrate = null; + }; + tests = lib.mapAttrs (key: value: mkTest (value // lib.optionalAttrs (!value?crateName) { crateName = key; })) cases; + in tests // rec { + + crateBinWithPathOutputs = assertOutputs { + name="crateBinWithPath"; + crateArgs = { + crateBin = [{ name = "test_binary1"; path = "src/foobar.rs"; }]; + src = mkBin "src/foobar.rs"; + }; + expectedFiles = [ + "./bin/test_binary1" + ]; + }; + + crateBinWithPathOutputsDebug = assertOutputs { + name="crateBinWithPath"; + crateArgs = { + release = false; + crateBin = [{ name = "test_binary1"; path = "src/foobar.rs"; }]; + src = mkBin "src/foobar.rs"; + }; + expectedFiles = [ + "./bin/test_binary1" + ] ++ lib.optionals stdenv.isDarwin [ + # On Darwin, the debug symbols are in a separate directory. + "./bin/test_binary1.dSYM/Contents/Info.plist" + "./bin/test_binary1.dSYM/Contents/Resources/DWARF/test_binary1" + ]; + }; + + crateBinNoPath1Outputs = assertOutputs { + name="crateBinNoPath1"; + crateArgs = { + crateBin = [{ name = "my-binary2"; }]; + src = mkBin "src/my_binary2.rs"; + }; + expectedFiles = [ + "./bin/my-binary2" + ]; + }; + + crateLibOutputs = assertOutputs { + name="crateLib"; + output="lib"; + crateArgs = { + libName = "test_lib"; + type = [ "rlib" ]; + libPath = "src/lib.rs"; + src = mkLib "src/lib.rs"; + }; + expectedFiles = [ + "./nix-support/propagated-build-inputs" + "./lib/libtest_lib-HASH.rlib" + "./lib/link" + ]; + }; + + crateLibOutputsDebug = assertOutputs { + name="crateLib"; + output="lib"; + crateArgs = { + release = false; + libName = "test_lib"; + type = [ "rlib" ]; + libPath = "src/lib.rs"; + src = mkLib "src/lib.rs"; + }; + expectedFiles = [ + "./nix-support/propagated-build-inputs" + "./lib/libtest_lib-HASH.rlib" + "./lib/link" + ]; + }; + + brotliTest = let + pkg = brotliCrates.brotli_2_5_0 {}; + in runCommand "run-brotli-test-cmd" { + nativeBuildInputs = [ pkg ]; + } (if stdenv.hostPlatform == stdenv.buildPlatform then '' + ${pkg}/bin/brotli -c ${pkg}/bin/brotli > /dev/null && touch $out + '' else '' + test -x '${pkg}/bin/brotli' && touch $out + ''); + allocNoStdLibTest = let + pkg = brotliCrates.alloc_no_stdlib_1_3_0 {}; + in runCommand "run-alloc-no-stdlib-test-cmd" { + nativeBuildInputs = [ pkg ]; + } '' + test -e ${pkg}/bin/example && touch $out + ''; + brotliDecompressorTest = let + pkg = brotliCrates.brotli_decompressor_1_3_1 {}; + in runCommand "run-brotli-decompressor-test-cmd" { + nativeBuildInputs = [ pkg ]; + } '' + test -e ${pkg}/bin/brotli-decompressor && touch $out + ''; + + rcgenTest = let + pkg = rcgenCrates.rootCrate.build; + in runCommand "run-rcgen-test-cmd" { + nativeBuildInputs = [ pkg ]; + } (if stdenv.hostPlatform == stdenv.buildPlatform then '' + ${pkg}/bin/rcgen && touch $out + '' else '' + test -x '${pkg}/bin/rcgen' && touch $out + ''); + }; + test = releaseTools.aggregate { + name = "buildRustCrate-tests"; + meta = { + description = "Test cases for buildRustCrate"; + maintainers = [ ]; + }; + constituents = builtins.attrValues tests; + }; +} diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/test/rcgen-crates.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/test/rcgen-crates.nix new file mode 100644 index 000000000000..ed273c01d26d --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/test/rcgen-crates.nix @@ -0,0 +1,3494 @@ + +# This file was @generated by crate2nix 0.10.0 with the command: +# "generate" +# See https://github.com/kolloch/crate2nix for more info. + +{ nixpkgs ? <nixpkgs> +, pkgs ? import nixpkgs { config = {}; } +, lib ? pkgs.lib +, stdenv ? pkgs.stdenv +, buildRustCrateForPkgs ? if buildRustCrate != null + then lib.warn "crate2nix: Passing `buildRustCrate` as argument to Cargo.nix is deprecated. If you don't customize `buildRustCrate`, replace `callPackage ./Cargo.nix {}` by `import ./Cargo.nix { inherit pkgs; }`, and if you need to customize `buildRustCrate`, use `buildRustCrateForPkgs` instead." (_: buildRustCrate) + else pkgs: pkgs.buildRustCrate + # Deprecated +, buildRustCrate ? null + # This is used as the `crateOverrides` argument for `buildRustCrate`. +, defaultCrateOverrides ? pkgs.defaultCrateOverrides + # The features to enable for the root_crate or the workspace_members. +, rootFeatures ? [ "default" ] + # If true, throw errors instead of issueing deprecation warnings. +, strictDeprecation ? false + # Used for conditional compilation based on CPU feature detection. +, targetFeatures ? [] + # Whether to perform release builds: longer compile times, faster binaries. +, release ? true + # Additional crate2nix configuration if it exists. +, crateConfig + ? lib.optionalAttrs (builtins.pathExists ./crate-config.nix) (pkgs.callPackage ./crate-config.nix {}) +}: + +rec { + # + # "public" attributes that we attempt to keep stable with new versions of crate2nix. + # + + rootCrate = rec { + packageId = "rcgen"; + + # Use this attribute to refer to the derivation building your root crate package. + # You can override the features with rootCrate.build.override { features = [ "default" "feature1" ... ]; }. + build = internal.buildRustCrateWithFeatures { + inherit packageId; + }; + + # Debug support which might change between releases. + # File a bug if you depend on any for non-debug work! + debug = internal.debugCrate { inherit packageId; }; + }; + # Refer your crate build derivation by name here. + # You can override the features with + # workspaceMembers."${crateName}".build.override { features = [ "default" "feature1" ... ]; }. + workspaceMembers = { + "rcgen" = rec { + packageId = "rcgen"; + build = internal.buildRustCrateWithFeatures { + packageId = "rcgen"; + }; + + # Debug support which might change between releases. + # File a bug if you depend on any for non-debug work! + debug = internal.debugCrate { inherit packageId; }; + }; + }; + + # A derivation that joins the outputs of all workspace members together. + allWorkspaceMembers = pkgs.symlinkJoin { + name = "all-workspace-members"; + paths = + let members = builtins.attrValues workspaceMembers; + in builtins.map (m: m.build) members; + }; + + # + # "internal" ("private") attributes that may change in every new version of crate2nix. + # + + internal = rec { + # Build and dependency information for crates. + # Many of the fields are passed one-to-one to buildRustCrate. + # + # Noteworthy: + # * `dependencies`/`buildDependencies`: similar to the corresponding fields for buildRustCrate. + # but with additional information which is used during dependency/feature resolution. + # * `resolvedDependencies`: the selected default features reported by cargo - only included for debugging. + # * `devDependencies` as of now not used by `buildRustCrate` but used to + # inject test dependencies into the build + + crates = { + "asn1-rs" = rec { + crateName = "asn1-rs"; + version = "0.3.1"; + edition = "2018"; + sha256 = "0czsk1nd4dx2k83f7jzkn8klx05wbmblkx1jh51i4c170akhbzrh"; + authors = [ + "Pierre Chifflier <chifflier@wzdftpd.net>" + ]; + dependencies = [ + { + name = "asn1-rs-derive"; + packageId = "asn1-rs-derive"; + } + { + name = "asn1-rs-impl"; + packageId = "asn1-rs-impl"; + } + { + name = "displaydoc"; + packageId = "displaydoc"; + } + { + name = "nom"; + packageId = "nom"; + usesDefaultFeatures = false; + features = [ "std" ]; + } + { + name = "num-traits"; + packageId = "num-traits"; + } + { + name = "rusticata-macros"; + packageId = "rusticata-macros"; + } + { + name = "thiserror"; + packageId = "thiserror"; + } + { + name = "time"; + packageId = "time"; + optional = true; + features = [ "macros" "parsing" "formatting" ]; + } + ]; + features = { + "bigint" = [ "num-bigint" ]; + "bits" = [ "bitvec" ]; + "bitvec" = [ "dep:bitvec" ]; + "cookie-factory" = [ "dep:cookie-factory" ]; + "datetime" = [ "time" ]; + "default" = [ "std" ]; + "num-bigint" = [ "dep:num-bigint" ]; + "serialize" = [ "cookie-factory" ]; + "time" = [ "dep:time" ]; + }; + resolvedDefaultFeatures = [ "datetime" "default" "std" "time" ]; + }; + "asn1-rs-derive" = rec { + crateName = "asn1-rs-derive"; + version = "0.1.0"; + edition = "2018"; + sha256 = "1gzf9vab06lk0zjvbr07axx64fndkng2s28bnj27fnwd548pb2yv"; + procMacro = true; + authors = [ + "Pierre Chifflier <chifflier@wzdftpd.net>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn"; + } + { + name = "synstructure"; + packageId = "synstructure"; + } + ]; + + }; + "asn1-rs-impl" = rec { + crateName = "asn1-rs-impl"; + version = "0.1.0"; + edition = "2018"; + sha256 = "1va27bn7qxqp4wanzjlkagnynv6jnrhnwmcky2ahzb1r405p6xr7"; + procMacro = true; + authors = [ + "Pierre Chifflier <chifflier@wzdftpd.net>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn"; + } + ]; + + }; + "autocfg 0.1.7" = rec { + crateName = "autocfg"; + version = "0.1.7"; + edition = "2015"; + sha256 = "1chwgimpx5z7xbag7krr9d8asxfqbh683qhgl9kn3hxk2l0djj8x"; + authors = [ + "Josh Stone <cuviper@gmail.com>" + ]; + + }; + "autocfg 1.0.1" = rec { + crateName = "autocfg"; + version = "1.0.1"; + edition = "2015"; + sha256 = "0jj6i9zn4gjl03kjvziqdji6rwx8ykz8zk2ngpc331z2g3fk3c6d"; + authors = [ + "Josh Stone <cuviper@gmail.com>" + ]; + + }; + "base64" = rec { + crateName = "base64"; + version = "0.13.0"; + edition = "2018"; + sha256 = "1z82g23mbzjgijkpcrilc7nljpxpvpf7zxf6iyiapkgka2ngwkch"; + authors = [ + "Alice Maz <alice@alicemaz.com>" + "Marshall Pierce <marshall@mpierce.org>" + ]; + features = { + "default" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "base64ct" = rec { + crateName = "base64ct"; + version = "1.1.1"; + edition = "2018"; + sha256 = "0p4was874qc90q2chm2i14m9mn8zmxjis8vaxihd6a2x4aqxkd76"; + authors = [ + "RustCrypto Developers" + ]; + features = { + "std" = [ "alloc" ]; + }; + }; + "bitflags" = rec { + crateName = "bitflags"; + version = "1.3.2"; + edition = "2018"; + sha256 = "12ki6w8gn1ldq7yz9y680llwk5gmrhrzszaa17g1sbrw2r2qvwxy"; + authors = [ + "The Rust Project Developers" + ]; + features = { + "compiler_builtins" = [ "dep:compiler_builtins" ]; + "core" = [ "dep:core" ]; + "rustc-dep-of-std" = [ "core" "compiler_builtins" ]; + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "botan" = rec { + crateName = "botan"; + version = "0.8.1"; + edition = "2018"; + sha256 = "08bmiyn7c3b0dgx20w6hr28d9jcq7cj78cchr84pc686sb2s41ik"; + authors = [ + "Jack Lloyd <jack@randombit.net>" + ]; + dependencies = [ + { + name = "botan-sys"; + packageId = "botan-sys"; + } + { + name = "cty"; + packageId = "cty"; + } + ]; + features = { + "cstr_core" = [ "dep:cstr_core" ]; + "no-std" = [ "cstr_core/alloc" ]; + "vendored" = [ "botan-sys/vendored" ]; + }; + resolvedDefaultFeatures = [ "default" "vendored" ]; + }; + "botan-src" = rec { + crateName = "botan-src"; + version = "0.21703.0"; + edition = "2018"; + sha256 = "0s2ad9q84qsrllfsbj7hjhn7gr3hab9ng6lwzwqmimia6yvja8y8"; + authors = [ + "Rodolphe Breard <rodolphe@what.tf>" + "Jack Lloyd <jack@randombit.net>" + ]; + + }; + "botan-sys" = rec { + crateName = "botan-sys"; + version = "0.8.1"; + edition = "2015"; + sha256 = "1m11zblxfanrhl97j7z3ap7n17rr8j0rg91sr7f9j6y2bsniaz1x"; + authors = [ + "Jack Lloyd <jack@randombit.net>" + ]; + dependencies = [ + { + name = "cty"; + packageId = "cty"; + } + ]; + buildDependencies = [ + { + name = "botan-src"; + packageId = "botan-src"; + optional = true; + } + ]; + features = { + "botan-src" = [ "dep:botan-src" ]; + "vendored" = [ "botan-src" ]; + }; + resolvedDefaultFeatures = [ "botan-src" "default" "vendored" ]; + }; + "bumpalo" = rec { + crateName = "bumpalo"; + version = "3.9.1"; + edition = "2018"; + sha256 = "1688dv6s0cbj72p9lmll8a02a85dzxvdw2is7pji490zmd35m954"; + authors = [ + "Nick Fitzgerald <fitzgen@gmail.com>" + ]; + features = { + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "byteorder" = rec { + crateName = "byteorder"; + version = "1.4.3"; + edition = "2018"; + sha256 = "0456lv9xi1a5bcm32arknf33ikv76p3fr9yzki4lb2897p2qkh8l"; + authors = [ + "Andrew Gallant <jamslam@gmail.com>" + ]; + features = { + "default" = [ "std" ]; + }; + }; + "cc" = rec { + crateName = "cc"; + version = "1.0.72"; + edition = "2018"; + crateBin = []; + sha256 = "1vl50h2qh0nh0iddzj6gd1pnxnxpvwmbfxc30578c1pajmxi7a92"; + authors = [ + "Alex Crichton <alex@alexcrichton.com>" + ]; + features = { + "jobserver" = [ "dep:jobserver" ]; + "parallel" = [ "jobserver" ]; + }; + }; + "cfg-if" = rec { + crateName = "cfg-if"; + version = "1.0.0"; + edition = "2018"; + sha256 = "1za0vb97n4brpzpv8lsbnzmq5r8f2b0cpqqr0sy8h5bn751xxwds"; + authors = [ + "Alex Crichton <alex@alexcrichton.com>" + ]; + features = { + "compiler_builtins" = [ "dep:compiler_builtins" ]; + "core" = [ "dep:core" ]; + "rustc-dep-of-std" = [ "core" "compiler_builtins" ]; + }; + }; + "const-oid" = rec { + crateName = "const-oid"; + version = "0.6.2"; + edition = "2018"; + sha256 = "12vv7csqqjj0x1l5mf51lgqiw76k5c3mb1yzfhfcqysks2j2lvwx"; + authors = [ + "RustCrypto Developers" + ]; + features = { + }; + }; + "crypto-bigint" = rec { + crateName = "crypto-bigint"; + version = "0.2.11"; + edition = "2018"; + sha256 = "00qckh65nzb7s7vd60wylw6alxf9g37xh31lirb1qw0l8fxx6fzq"; + authors = [ + "RustCrypto Developers" + ]; + dependencies = [ + { + name = "generic-array"; + packageId = "generic-array"; + optional = true; + } + { + name = "rand_core"; + packageId = "rand_core"; + optional = true; + } + { + name = "subtle"; + packageId = "subtle"; + usesDefaultFeatures = false; + } + ]; + features = { + "default" = [ "rand" ]; + "generic-array" = [ "dep:generic-array" ]; + "rand" = [ "rand_core" ]; + "rand_core" = [ "dep:rand_core" ]; + "rlp" = [ "dep:rlp" ]; + "zeroize" = [ "dep:zeroize" ]; + }; + resolvedDefaultFeatures = [ "default" "generic-array" "rand" "rand_core" ]; + }; + "cty" = rec { + crateName = "cty"; + version = "0.2.2"; + edition = "2015"; + sha256 = "0d8z0pbr87wgzqqb2jk5pvj0afzc6d3rb772ach6fijhg6yglrdk"; + authors = [ + "Jorge Aparicio <jorge@japaric.io>" + ]; + + }; + "data-encoding" = rec { + crateName = "data-encoding"; + version = "2.3.2"; + edition = "2018"; + sha256 = "0mvd8bjq5mq50fcf931cff57vwmbsvs1kpxynkzrshli98y3kqiy"; + authors = [ + "Julien Cretin <git@ia0.eu>" + ]; + features = { + "default" = [ "std" ]; + "std" = [ "alloc" ]; + }; + resolvedDefaultFeatures = [ "alloc" "default" "std" ]; + }; + "der" = rec { + crateName = "der"; + version = "0.4.5"; + edition = "2018"; + sha256 = "1x4k0jln8va1657cghl40l6p7hyvr1ixz71v9cd6imwmgp51rdvr"; + authors = [ + "RustCrypto Developers" + ]; + dependencies = [ + { + name = "const-oid"; + packageId = "const-oid"; + optional = true; + } + { + name = "crypto-bigint"; + packageId = "crypto-bigint"; + optional = true; + features = [ "generic-array" ]; + } + ]; + features = { + "bigint" = [ "crypto-bigint" ]; + "const-oid" = [ "dep:const-oid" ]; + "crypto-bigint" = [ "dep:crypto-bigint" ]; + "der_derive" = [ "dep:der_derive" ]; + "derive" = [ "der_derive" ]; + "oid" = [ "const-oid" ]; + "std" = [ "alloc" ]; + }; + resolvedDefaultFeatures = [ "alloc" "bigint" "const-oid" "crypto-bigint" "oid" "std" ]; + }; + "der-parser" = rec { + crateName = "der-parser"; + version = "7.0.0"; + edition = "2018"; + sha256 = "10kfa2gzl3x20mwgrd43cyi79xgkqxyzcyrh0xylv4apa33qlfgy"; + authors = [ + "Pierre Chifflier <chifflier@wzdftpd.net>" + ]; + dependencies = [ + { + name = "asn1-rs"; + packageId = "asn1-rs"; + } + { + name = "displaydoc"; + packageId = "displaydoc"; + usesDefaultFeatures = false; + } + { + name = "nom"; + packageId = "nom"; + } + { + name = "num-bigint"; + packageId = "num-bigint"; + optional = true; + } + { + name = "num-traits"; + packageId = "num-traits"; + } + { + name = "rusticata-macros"; + packageId = "rusticata-macros"; + } + ]; + features = { + "bigint" = [ "num-bigint" ]; + "cookie-factory" = [ "dep:cookie-factory" ]; + "default" = [ "std" ]; + "num-bigint" = [ "dep:num-bigint" ]; + "serialize" = [ "std" "cookie-factory" ]; + }; + resolvedDefaultFeatures = [ "bigint" "default" "num-bigint" "std" ]; + }; + "digest" = rec { + crateName = "digest"; + version = "0.9.0"; + edition = "2018"; + sha256 = "0rmhvk33rgvd6ll71z8sng91a52rw14p0drjn1da0mqa138n1pfk"; + authors = [ + "RustCrypto Developers" + ]; + dependencies = [ + { + name = "generic-array"; + packageId = "generic-array"; + } + ]; + features = { + "blobby" = [ "dep:blobby" ]; + "dev" = [ "blobby" ]; + "std" = [ "alloc" ]; + }; + resolvedDefaultFeatures = [ "alloc" "std" ]; + }; + "displaydoc" = rec { + crateName = "displaydoc"; + version = "0.2.3"; + edition = "2018"; + sha256 = "11i8p5snlc1hs4g5q3wiyr75dn276l6kr0si5m7xmfa6y31mvy9v"; + procMacro = true; + authors = [ + "Jane Lusby <jlusby@yaah.dev>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn"; + } + ]; + features = { + "default" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "foreign-types" = rec { + crateName = "foreign-types"; + version = "0.3.2"; + edition = "2015"; + sha256 = "1cgk0vyd7r45cj769jym4a6s7vwshvd0z4bqrb92q1fwibmkkwzn"; + authors = [ + "Steven Fackler <sfackler@gmail.com>" + ]; + dependencies = [ + { + name = "foreign-types-shared"; + packageId = "foreign-types-shared"; + } + ]; + + }; + "foreign-types-shared" = rec { + crateName = "foreign-types-shared"; + version = "0.1.1"; + edition = "2015"; + sha256 = "0jxgzd04ra4imjv8jgkmdq59kj8fsz6w4zxsbmlai34h26225c00"; + authors = [ + "Steven Fackler <sfackler@gmail.com>" + ]; + + }; + "generic-array" = rec { + crateName = "generic-array"; + version = "0.14.5"; + edition = "2015"; + sha256 = "00qqhls43bzvyb7s26iw6knvsz3mckbxl3rhaahvypzhqwzd6j7x"; + libName = "generic_array"; + authors = [ + "Bartłomiej Kamiński <fizyk20@gmail.com>" + "Aaron Trent <novacrazy@gmail.com>" + ]; + dependencies = [ + { + name = "typenum"; + packageId = "typenum"; + } + ]; + buildDependencies = [ + { + name = "version_check"; + packageId = "version_check"; + } + ]; + features = { + "serde" = [ "dep:serde" ]; + }; + }; + "getrandom" = rec { + crateName = "getrandom"; + version = "0.2.4"; + edition = "2018"; + sha256 = "0k0bdr1dyf4n9fvnkx4fmwxhv4hgnyf55gj86v4m69fln743g3a1"; + authors = [ + "The Rand Project Developers" + ]; + dependencies = [ + { + name = "cfg-if"; + packageId = "cfg-if"; + } + { + name = "libc"; + packageId = "libc"; + usesDefaultFeatures = false; + target = { target, features }: (target."unix" or false); + } + { + name = "wasi"; + packageId = "wasi"; + target = { target, features }: (target."os" == "wasi"); + } + ]; + features = { + "compiler_builtins" = [ "dep:compiler_builtins" ]; + "core" = [ "dep:core" ]; + "js" = [ "wasm-bindgen" "js-sys" ]; + "js-sys" = [ "dep:js-sys" ]; + "rustc-dep-of-std" = [ "compiler_builtins" "core" "libc/rustc-dep-of-std" "wasi/rustc-dep-of-std" ]; + "wasm-bindgen" = [ "dep:wasm-bindgen" ]; + }; + resolvedDefaultFeatures = [ "std" ]; + }; + "itoa" = rec { + crateName = "itoa"; + version = "1.0.1"; + edition = "2018"; + sha256 = "0d8wr2qf5b25a04xf10rz9r0pdbjdgb0zaw3xvf8k2sqcz1qzaqs"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + ]; + + }; + "js-sys" = rec { + crateName = "js-sys"; + version = "0.3.56"; + edition = "2018"; + sha256 = "010g8jkj5avy3xd77i3cprjzzpfa6z9z2ay0fkllqmpx617c53x3"; + authors = [ + "The wasm-bindgen Developers" + ]; + dependencies = [ + { + name = "wasm-bindgen"; + packageId = "wasm-bindgen"; + } + ]; + + }; + "lazy_static" = rec { + crateName = "lazy_static"; + version = "1.4.0"; + edition = "2015"; + sha256 = "0in6ikhw8mgl33wjv6q6xfrb5b9jr16q8ygjy803fay4zcisvaz2"; + authors = [ + "Marvin Löbel <loebel.marvin@gmail.com>" + ]; + dependencies = [ + { + name = "spin"; + packageId = "spin"; + optional = true; + } + ]; + features = { + "spin" = [ "dep:spin" ]; + "spin_no_std" = [ "spin" ]; + }; + resolvedDefaultFeatures = [ "spin" "spin_no_std" ]; + }; + "libc" = rec { + crateName = "libc"; + version = "0.2.116"; + edition = "2015"; + sha256 = "0x6sk17kv2fdsqxlm23bz9x1y79w90k7ylkflk44rgidhy4bspan"; + authors = [ + "The Rust Project Developers" + ]; + features = { + "default" = [ "std" ]; + "rustc-dep-of-std" = [ "align" "rustc-std-workspace-core" ]; + "rustc-std-workspace-core" = [ "dep:rustc-std-workspace-core" ]; + "use_std" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "libm" = rec { + crateName = "libm"; + version = "0.2.1"; + edition = "2018"; + sha256 = "0akh56sh51adhagmk9l84dyrlz60gv8ri05xhr13i1b18czkpmy7"; + authors = [ + "Jorge Aparicio <jorge@japaric.io>" + ]; + features = { + "musl-reference-tests" = [ "rand" ]; + "rand" = [ "dep:rand" ]; + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "log" = rec { + crateName = "log"; + version = "0.4.14"; + edition = "2015"; + sha256 = "04175hv0v62shd82qydq58a48k3bjijmk54v38zgqlbxqkkbpfai"; + authors = [ + "The Rust Project Developers" + ]; + dependencies = [ + { + name = "cfg-if"; + packageId = "cfg-if"; + } + ]; + features = { + "kv_unstable" = [ "value-bag" ]; + "kv_unstable_serde" = [ "kv_unstable_std" "value-bag/serde" "serde" ]; + "kv_unstable_std" = [ "std" "kv_unstable" "value-bag/error" ]; + "kv_unstable_sval" = [ "kv_unstable" "value-bag/sval" "sval" ]; + "serde" = [ "dep:serde" ]; + "sval" = [ "dep:sval" ]; + "value-bag" = [ "dep:value-bag" ]; + }; + }; + "memchr" = rec { + crateName = "memchr"; + version = "2.4.1"; + edition = "2018"; + sha256 = "0smq8xzd40njqpfzv5mghigj91fzlfrfg842iz8x0wqvw2dw731h"; + authors = [ + "Andrew Gallant <jamslam@gmail.com>" + "bluss" + ]; + features = { + "compiler_builtins" = [ "dep:compiler_builtins" ]; + "core" = [ "dep:core" ]; + "default" = [ "std" ]; + "libc" = [ "dep:libc" ]; + "rustc-dep-of-std" = [ "core" "compiler_builtins" ]; + "use_std" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "std" ]; + }; + "minimal-lexical" = rec { + crateName = "minimal-lexical"; + version = "0.2.1"; + edition = "2018"; + sha256 = "16ppc5g84aijpri4jzv14rvcnslvlpphbszc7zzp6vfkddf4qdb8"; + authors = [ + "Alex Huszagh <ahuszagh@gmail.com>" + ]; + features = { + "default" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "std" ]; + }; + "nom" = rec { + crateName = "nom"; + version = "7.1.0"; + edition = "2018"; + sha256 = "0281jdx0xcyhjgs1jkj9pii8py1clcpazg41bgz7d71qxzhi278v"; + authors = [ + "contact@geoffroycouprie.com" + ]; + dependencies = [ + { + name = "memchr"; + packageId = "memchr"; + usesDefaultFeatures = false; + } + { + name = "minimal-lexical"; + packageId = "minimal-lexical"; + usesDefaultFeatures = false; + } + ]; + buildDependencies = [ + { + name = "version_check"; + packageId = "version_check"; + } + ]; + features = { + "default" = [ "std" ]; + "std" = [ "alloc" "memchr/std" "minimal-lexical/std" ]; + }; + resolvedDefaultFeatures = [ "alloc" "default" "std" ]; + }; + "num-bigint" = rec { + crateName = "num-bigint"; + version = "0.4.3"; + edition = "2018"; + sha256 = "0py73wsa5j4izhd39nkqzqv260r0ma08vy30ky54ld3vkhlbcfpr"; + authors = [ + "The Rust Project Developers" + ]; + dependencies = [ + { + name = "num-integer"; + packageId = "num-integer"; + usesDefaultFeatures = false; + features = [ "i128" ]; + } + { + name = "num-traits"; + packageId = "num-traits"; + usesDefaultFeatures = false; + features = [ "i128" ]; + } + ]; + buildDependencies = [ + { + name = "autocfg"; + packageId = "autocfg 1.0.1"; + } + ]; + features = { + "arbitrary" = [ "dep:arbitrary" ]; + "default" = [ "std" ]; + "quickcheck" = [ "dep:quickcheck" ]; + "rand" = [ "dep:rand" ]; + "serde" = [ "dep:serde" ]; + "std" = [ "num-integer/std" "num-traits/std" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "num-bigint-dig" = rec { + crateName = "num-bigint-dig"; + version = "0.7.0"; + edition = "2015"; + sha256 = "1004mmipvc7pvaf3kf13i1nqh3vxf789bj72d8wl51y185aywis5"; + authors = [ + "dignifiedquire <dignifiedquire@gmail.com>" + "The Rust Project Developers" + ]; + dependencies = [ + { + name = "byteorder"; + packageId = "byteorder"; + usesDefaultFeatures = false; + } + { + name = "lazy_static"; + packageId = "lazy_static"; + usesDefaultFeatures = false; + features = [ "spin_no_std" ]; + } + { + name = "libm"; + packageId = "libm"; + } + { + name = "num-integer"; + packageId = "num-integer"; + usesDefaultFeatures = false; + } + { + name = "num-iter"; + packageId = "num-iter"; + usesDefaultFeatures = false; + } + { + name = "num-traits"; + packageId = "num-traits"; + usesDefaultFeatures = false; + } + { + name = "rand"; + packageId = "rand"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "smallvec"; + packageId = "smallvec"; + usesDefaultFeatures = false; + } + { + name = "zeroize"; + packageId = "zeroize"; + optional = true; + usesDefaultFeatures = false; + features = [ "zeroize_derive" ]; + } + ]; + buildDependencies = [ + { + name = "autocfg"; + packageId = "autocfg 0.1.7"; + } + ]; + devDependencies = [ + { + name = "rand"; + packageId = "rand"; + features = [ "small_rng" ]; + } + ]; + features = { + "default" = [ "std" "i128" "u64_digit" ]; + "i128" = [ "num-integer/i128" "num-traits/i128" ]; + "prime" = [ "rand/std_rng" ]; + "rand" = [ "dep:rand" ]; + "serde" = [ "dep:serde" ]; + "std" = [ "num-integer/std" "num-traits/std" "smallvec/write" "rand/std" "serde/std" ]; + "zeroize" = [ "dep:zeroize" ]; + }; + resolvedDefaultFeatures = [ "i128" "prime" "rand" "u64_digit" "zeroize" ]; + }; + "num-integer" = rec { + crateName = "num-integer"; + version = "0.1.44"; + edition = "2015"; + sha256 = "1nq152y3304as1iai95hqz8prqnc94lks1s7q05sfjdmcf56kk6j"; + authors = [ + "The Rust Project Developers" + ]; + dependencies = [ + { + name = "num-traits"; + packageId = "num-traits"; + usesDefaultFeatures = false; + } + ]; + buildDependencies = [ + { + name = "autocfg"; + packageId = "autocfg 1.0.1"; + } + ]; + features = { + "default" = [ "std" ]; + "i128" = [ "num-traits/i128" ]; + "std" = [ "num-traits/std" ]; + }; + resolvedDefaultFeatures = [ "i128" "std" ]; + }; + "num-iter" = rec { + crateName = "num-iter"; + version = "0.1.42"; + edition = "2015"; + sha256 = "0ndd9wb9qar50fdr16xm3i1zk6h2g9br56nml2n22kd56y1iq0mj"; + authors = [ + "The Rust Project Developers" + ]; + dependencies = [ + { + name = "num-integer"; + packageId = "num-integer"; + usesDefaultFeatures = false; + } + { + name = "num-traits"; + packageId = "num-traits"; + usesDefaultFeatures = false; + } + ]; + buildDependencies = [ + { + name = "autocfg"; + packageId = "autocfg 1.0.1"; + } + ]; + features = { + "default" = [ "std" ]; + "i128" = [ "num-integer/i128" "num-traits/i128" ]; + "std" = [ "num-integer/std" "num-traits/std" ]; + }; + }; + "num-traits" = rec { + crateName = "num-traits"; + version = "0.2.14"; + edition = "2015"; + sha256 = "144j176s2p76azy2ngk2vkdzgwdc0bc8c93jhki8c9fsbknb2r4s"; + authors = [ + "The Rust Project Developers" + ]; + dependencies = [ + { + name = "libm"; + packageId = "libm"; + optional = true; + } + ]; + buildDependencies = [ + { + name = "autocfg"; + packageId = "autocfg 1.0.1"; + } + ]; + features = { + "default" = [ "std" ]; + "libm" = [ "dep:libm" ]; + }; + resolvedDefaultFeatures = [ "default" "i128" "libm" "std" ]; + }; + "num_threads" = rec { + crateName = "num_threads"; + version = "0.1.3"; + edition = "2015"; + sha256 = "05gvsnv4k6d69iksz47i7fq1r61dj1k1nh4i8xrw7qlkcfx9kflp"; + authors = [ + "Jacob Pratt <open-source@jhpratt.dev>" + ]; + dependencies = [ + { + name = "libc"; + packageId = "libc"; + target = { target, features }: ((target."os" == "macos") || (target."os" == "freebsd")); + } + ]; + + }; + "oid-registry" = rec { + crateName = "oid-registry"; + version = "0.4.0"; + edition = "2018"; + sha256 = "0akbah3j8231ayrp2l1y5d9zmvbvqcsj0sa6s6dz6h85z8bhgqiq"; + authors = [ + "Pierre Chifflier <chifflier@wzdftpd.net>" + ]; + dependencies = [ + { + name = "asn1-rs"; + packageId = "asn1-rs"; + } + ]; + features = { + "crypto" = [ "kdf" "pkcs1" "pkcs7" "pkcs9" "pkcs12" "nist_algs" "x962" ]; + "default" = [ "registry" ]; + }; + resolvedDefaultFeatures = [ "crypto" "default" "kdf" "nist_algs" "pkcs1" "pkcs12" "pkcs7" "pkcs9" "registry" "x509" "x962" ]; + }; + "once_cell" = rec { + crateName = "once_cell"; + version = "1.9.0"; + edition = "2018"; + sha256 = "1mfqhrsgi368x92bwnq3vi3p5nv0n1qlrn69gfflhvkfkxfm2cns"; + authors = [ + "Aleksey Kladov <aleksey.kladov@gmail.com>" + ]; + features = { + "alloc" = [ "race" ]; + "atomic-polyfill" = [ "dep:atomic-polyfill" ]; + "default" = [ "std" ]; + "parking_lot" = [ "dep:parking_lot" ]; + "std" = [ "alloc" ]; + }; + resolvedDefaultFeatures = [ "alloc" "default" "race" "std" ]; + }; + "openssl" = rec { + crateName = "openssl"; + version = "0.10.38"; + edition = "2018"; + sha256 = "15baqlphisr1f7ddq11jnrrzz4shdh35kwal24adyc2c4cif4yhc"; + authors = [ + "Steven Fackler <sfackler@gmail.com>" + ]; + dependencies = [ + { + name = "bitflags"; + packageId = "bitflags"; + } + { + name = "cfg-if"; + packageId = "cfg-if"; + } + { + name = "foreign-types"; + packageId = "foreign-types"; + } + { + name = "libc"; + packageId = "libc"; + } + { + name = "once_cell"; + packageId = "once_cell"; + } + { + name = "openssl-sys"; + packageId = "openssl-sys"; + rename = "ffi"; + } + ]; + features = { + "vendored" = [ "ffi/vendored" ]; + }; + }; + "openssl-sys" = rec { + crateName = "openssl-sys"; + version = "0.9.72"; + edition = "2015"; + sha256 = "1jq3qbcvf16qn71yasdzw54b14n8nz98vr52l1gp60in72f10iky"; + build = "build/main.rs"; + authors = [ + "Alex Crichton <alex@alexcrichton.com>" + "Steven Fackler <sfackler@gmail.com>" + ]; + dependencies = [ + { + name = "libc"; + packageId = "libc"; + } + ]; + buildDependencies = [ + { + name = "autocfg"; + packageId = "autocfg 1.0.1"; + } + { + name = "cc"; + packageId = "cc"; + } + { + name = "pkg-config"; + packageId = "pkg-config"; + } + { + name = "vcpkg"; + packageId = "vcpkg"; + target = {target, features}: (target."env" == "msvc"); + } + ]; + features = { + "openssl-src" = [ "dep:openssl-src" ]; + "vendored" = [ "openssl-src" ]; + }; + }; + "pem" = rec { + crateName = "pem"; + version = "1.0.2"; + edition = "2018"; + sha256 = "0iqrvfnm71x9pvff39d5ajwn3gc9glxlv4d4h22max7342db18z9"; + authors = [ + "Jonathan Creekmore <jonathan@thecreekmores.org>" + ]; + dependencies = [ + { + name = "base64"; + packageId = "base64"; + } + ]; + + }; + "pem-rfc7468" = rec { + crateName = "pem-rfc7468"; + version = "0.2.4"; + edition = "2018"; + sha256 = "1m1c9jypydzabg4yscplmvff7pdcc8gg4cqg081hnlf03hxkmsc4"; + authors = [ + "RustCrypto Developers" + ]; + dependencies = [ + { + name = "base64ct"; + packageId = "base64ct"; + } + ]; + features = { + "std" = [ "alloc" ]; + }; + resolvedDefaultFeatures = [ "alloc" ]; + }; + "pkcs1" = rec { + crateName = "pkcs1"; + version = "0.2.4"; + edition = "2018"; + sha256 = "0b2f1a0lf5h53zrjvcqbxzjhh89gcfa1myhf6z7w10ypg61fwsqi"; + authors = [ + "RustCrypto Developers" + ]; + dependencies = [ + { + name = "der"; + packageId = "der"; + features = [ "bigint" "oid" ]; + } + { + name = "pem-rfc7468"; + packageId = "pem-rfc7468"; + optional = true; + } + { + name = "zeroize"; + packageId = "zeroize"; + optional = true; + usesDefaultFeatures = false; + features = [ "alloc" ]; + } + ]; + features = { + "alloc" = [ "der/alloc" "zeroize" ]; + "pem" = [ "alloc" "pem-rfc7468/alloc" ]; + "pem-rfc7468" = [ "dep:pem-rfc7468" ]; + "zeroize" = [ "dep:zeroize" ]; + }; + resolvedDefaultFeatures = [ "alloc" "pem" "pem-rfc7468" "std" "zeroize" ]; + }; + "pkcs8" = rec { + crateName = "pkcs8"; + version = "0.7.6"; + edition = "2018"; + sha256 = "0iq46p6fa2b8xy6pj52zpmdy8ya3fg31dj4rc19x1fi69nvgjgpf"; + authors = [ + "RustCrypto Developers" + ]; + dependencies = [ + { + name = "der"; + packageId = "der"; + features = [ "oid" ]; + } + { + name = "pem-rfc7468"; + packageId = "pem-rfc7468"; + optional = true; + } + { + name = "pkcs1"; + packageId = "pkcs1"; + optional = true; + features = [ "alloc" ]; + } + { + name = "spki"; + packageId = "spki"; + } + { + name = "zeroize"; + packageId = "zeroize"; + optional = true; + usesDefaultFeatures = false; + features = [ "alloc" ]; + } + ]; + features = { + "3des" = [ "encryption" "pkcs5/3des" ]; + "alloc" = [ "der/alloc" "zeroize" ]; + "des-insecure" = [ "encryption" "pkcs5/des-insecure" ]; + "encryption" = [ "alloc" "pkcs5/alloc" "pkcs5/pbes2" "rand_core" ]; + "pem" = [ "alloc" "pem-rfc7468/alloc" ]; + "pem-rfc7468" = [ "dep:pem-rfc7468" ]; + "pkcs1" = [ "dep:pkcs1" ]; + "pkcs5" = [ "dep:pkcs5" ]; + "rand_core" = [ "dep:rand_core" ]; + "sha1" = [ "encryption" "pkcs5/sha1" ]; + "std" = [ "alloc" "der/std" ]; + "zeroize" = [ "dep:zeroize" ]; + }; + resolvedDefaultFeatures = [ "alloc" "pem" "pem-rfc7468" "pkcs1" "std" "zeroize" ]; + }; + "pkg-config" = rec { + crateName = "pkg-config"; + version = "0.3.24"; + edition = "2015"; + sha256 = "1ghcyjp5537r7qigmgl3dj62j01arlpddaq93a3i414v3iskz2aq"; + authors = [ + "Alex Crichton <alex@alexcrichton.com>" + ]; + + }; + "ppv-lite86" = rec { + crateName = "ppv-lite86"; + version = "0.2.16"; + edition = "2018"; + sha256 = "0wkqwnvnfcgqlrahphl45vdlgi2f1bs7nqcsalsllp1y4dp9x7zb"; + authors = [ + "The CryptoCorrosion Contributors" + ]; + features = { + "default" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "simd" "std" ]; + }; + "proc-macro2" = rec { + crateName = "proc-macro2"; + version = "1.0.36"; + edition = "2018"; + sha256 = "0adh6gvs31x6pfwmygypmzrv1jc7kjq568vsqcfaxk7vhdc2sd67"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + "Alex Crichton <alex@alexcrichton.com>" + ]; + dependencies = [ + { + name = "unicode-xid"; + packageId = "unicode-xid"; + } + ]; + features = { + "default" = [ "proc-macro" ]; + }; + resolvedDefaultFeatures = [ "default" "proc-macro" ]; + }; + "quote" = rec { + crateName = "quote"; + version = "1.0.15"; + edition = "2018"; + sha256 = "0id1q0875pvhkg0mlb5z8gzdm2g2rbbz76bfzhv331lrm2b3wkc6"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + usesDefaultFeatures = false; + } + ]; + features = { + "default" = [ "proc-macro" ]; + "proc-macro" = [ "proc-macro2/proc-macro" ]; + }; + resolvedDefaultFeatures = [ "default" "proc-macro" ]; + }; + "rand" = rec { + crateName = "rand"; + version = "0.8.4"; + edition = "2018"; + sha256 = "1n5wska2fbfj4dsfz8mc0pd0dgjlrb6c9anpk5mwym345rip6x9f"; + authors = [ + "The Rand Project Developers" + "The Rust Project Developers" + ]; + dependencies = [ + { + name = "libc"; + packageId = "libc"; + optional = true; + usesDefaultFeatures = false; + target = { target, features }: (target."unix" or false); + } + { + name = "rand_chacha"; + packageId = "rand_chacha"; + optional = true; + usesDefaultFeatures = false; + target = { target, features }: (!(target."os" == "emscripten")); + } + { + name = "rand_core"; + packageId = "rand_core"; + } + { + name = "rand_hc"; + packageId = "rand_hc"; + optional = true; + target = { target, features }: (target."os" == "emscripten"); + } + ]; + devDependencies = [ + { + name = "rand_hc"; + packageId = "rand_hc"; + } + ]; + features = { + "alloc" = [ "rand_core/alloc" ]; + "default" = [ "std" "std_rng" ]; + "getrandom" = [ "rand_core/getrandom" ]; + "libc" = [ "dep:libc" ]; + "log" = [ "dep:log" ]; + "packed_simd" = [ "dep:packed_simd" ]; + "rand_chacha" = [ "dep:rand_chacha" ]; + "rand_hc" = [ "dep:rand_hc" ]; + "serde" = [ "dep:serde" ]; + "serde1" = [ "serde" "rand_core/serde1" ]; + "simd_support" = [ "packed_simd" ]; + "std" = [ "rand_core/std" "rand_chacha/std" "alloc" "getrandom" "libc" ]; + "std_rng" = [ "rand_chacha" "rand_hc" ]; + }; + resolvedDefaultFeatures = [ "alloc" "default" "getrandom" "libc" "rand_chacha" "rand_hc" "std" "std_rng" ]; + }; + "rand_chacha" = rec { + crateName = "rand_chacha"; + version = "0.3.1"; + edition = "2018"; + sha256 = "123x2adin558xbhvqb8w4f6syjsdkmqff8cxwhmjacpsl1ihmhg6"; + authors = [ + "The Rand Project Developers" + "The Rust Project Developers" + "The CryptoCorrosion Contributors" + ]; + dependencies = [ + { + name = "ppv-lite86"; + packageId = "ppv-lite86"; + usesDefaultFeatures = false; + features = [ "simd" ]; + } + { + name = "rand_core"; + packageId = "rand_core"; + } + ]; + features = { + "default" = [ "std" ]; + "serde" = [ "dep:serde" ]; + "serde1" = [ "serde" ]; + "std" = [ "ppv-lite86/std" ]; + }; + resolvedDefaultFeatures = [ "std" ]; + }; + "rand_core" = rec { + crateName = "rand_core"; + version = "0.6.3"; + edition = "2018"; + sha256 = "1rxlxc3bpzgwphcg9c9yasvv9idipcg2z2y4j0vlb52jyl418kyk"; + authors = [ + "The Rand Project Developers" + "The Rust Project Developers" + ]; + dependencies = [ + { + name = "getrandom"; + packageId = "getrandom"; + optional = true; + } + ]; + features = { + "getrandom" = [ "dep:getrandom" ]; + "serde" = [ "dep:serde" ]; + "serde1" = [ "serde" ]; + "std" = [ "alloc" "getrandom" "getrandom/std" ]; + }; + resolvedDefaultFeatures = [ "alloc" "getrandom" "std" ]; + }; + "rand_hc" = rec { + crateName = "rand_hc"; + version = "0.3.1"; + edition = "2018"; + sha256 = "1rwpykyvhkxs4jvqdja3mzp9dqaqamzn113cxaigs9z2dmcry7nm"; + authors = [ + "The Rand Project Developers" + ]; + dependencies = [ + { + name = "rand_core"; + packageId = "rand_core"; + } + ]; + + }; + "rcgen" = rec { + crateName = "rcgen"; + version = "0.9.2"; + edition = "2018"; + crateBin = [ + { name = "rcgen"; path = "src/main.rs"; } + ]; + sha256 = "0ppwfl9g504x2qwk7m7mag8c3l70w9mcfha93013nlzqdlw2vynp"; + authors = [ + "est31 <MTest31@outlook.com>" + ]; + dependencies = [ + { + name = "pem"; + packageId = "pem"; + optional = true; + } + { + name = "ring"; + packageId = "ring"; + } + { + name = "time"; + packageId = "time"; + usesDefaultFeatures = false; + } + { + name = "x509-parser"; + packageId = "x509-parser"; + optional = true; + features = [ "verify" ]; + } + { + name = "yasna"; + packageId = "yasna"; + features = [ "time" "std" ]; + } + { + name = "zeroize"; + packageId = "zeroize"; + optional = true; + } + ]; + devDependencies = [ + { + name = "botan"; + packageId = "botan"; + features = [ "vendored" ]; + } + { + name = "openssl"; + packageId = "openssl"; + } + { + name = "rand"; + packageId = "rand"; + } + { + name = "rsa"; + packageId = "rsa"; + } + { + name = "webpki"; + packageId = "webpki"; + features = [ "std" ]; + } + { + name = "x509-parser"; + packageId = "x509-parser"; + features = [ "verify" ]; + } + ]; + features = { + "default" = [ "pem" ]; + "pem" = [ "dep:pem" ]; + "x509-parser" = [ "dep:x509-parser" ]; + "zeroize" = [ "dep:zeroize" ]; + }; + resolvedDefaultFeatures = [ "default" "pem" "x509-parser" "zeroize" ]; + }; + "ring" = rec { + crateName = "ring"; + version = "0.16.20"; + edition = "2018"; + sha256 = "1z682xp7v38ayq9g9nkbhhfpj6ygralmlx7wdmsfv8rnw99cylrh"; + authors = [ + "Brian Smith <brian@briansmith.org>" + ]; + dependencies = [ + { + name = "libc"; + packageId = "libc"; + usesDefaultFeatures = false; + target = { target, features }: ((target."os" == "android") || (target."os" == "linux")); + } + { + name = "once_cell"; + packageId = "once_cell"; + optional = true; + usesDefaultFeatures = false; + target = { target, features }: ((target."os" == "android") || (target."os" == "linux")); + features = [ "std" ]; + } + { + name = "once_cell"; + packageId = "once_cell"; + usesDefaultFeatures = false; + target = { target, features }: ((target."os" == "dragonfly") || (target."os" == "freebsd") || (target."os" == "illumos") || (target."os" == "netbsd") || (target."os" == "openbsd") || (target."os" == "solaris")); + features = [ "std" ]; + } + { + name = "spin"; + packageId = "spin"; + usesDefaultFeatures = false; + target = { target, features }: ((target."arch" == "x86") || (target."arch" == "x86_64") || (((target."arch" == "aarch64") || (target."arch" == "arm")) && ((target."os" == "android") || (target."os" == "fuchsia") || (target."os" == "linux")))); + } + { + name = "untrusted"; + packageId = "untrusted"; + } + { + name = "web-sys"; + packageId = "web-sys"; + usesDefaultFeatures = false; + target = { target, features }: ((target."arch" == "wasm32") && (target."vendor" == "unknown") && (target."os" == "unknown") && (target."env" == "")); + features = [ "Crypto" "Window" ]; + } + { + name = "winapi"; + packageId = "winapi"; + usesDefaultFeatures = false; + target = { target, features }: (target."os" == "windows"); + features = [ "ntsecapi" "wtypesbase" ]; + } + ]; + buildDependencies = [ + { + name = "cc"; + packageId = "cc"; + usesDefaultFeatures = false; + } + ]; + devDependencies = [ + { + name = "libc"; + packageId = "libc"; + usesDefaultFeatures = false; + target = {target, features}: ((target."unix" or false) || (target."windows" or false)); + } + ]; + features = { + "default" = [ "alloc" "dev_urandom_fallback" ]; + "dev_urandom_fallback" = [ "once_cell" ]; + "once_cell" = [ "dep:once_cell" ]; + "std" = [ "alloc" ]; + }; + resolvedDefaultFeatures = [ "alloc" "default" "dev_urandom_fallback" "once_cell" ]; + }; + "rsa" = rec { + crateName = "rsa"; + version = "0.5.0"; + edition = "2018"; + sha256 = "039676a4mj0875phdi7vc0bd37hv84dh0dql6fmk8dl2w81jcp70"; + authors = [ + "RustCrypto Developers" + "dignifiedquire <dignifiedquire@gmail.com>" + ]; + dependencies = [ + { + name = "byteorder"; + packageId = "byteorder"; + usesDefaultFeatures = false; + } + { + name = "digest"; + packageId = "digest"; + usesDefaultFeatures = false; + } + { + name = "lazy_static"; + packageId = "lazy_static"; + features = [ "spin_no_std" ]; + } + { + name = "num-bigint-dig"; + packageId = "num-bigint-dig"; + rename = "num-bigint"; + usesDefaultFeatures = false; + features = [ "i128" "u64_digit" "prime" "zeroize" ]; + } + { + name = "num-integer"; + packageId = "num-integer"; + usesDefaultFeatures = false; + } + { + name = "num-iter"; + packageId = "num-iter"; + usesDefaultFeatures = false; + } + { + name = "num-traits"; + packageId = "num-traits"; + usesDefaultFeatures = false; + features = [ "libm" ]; + } + { + name = "pkcs1"; + packageId = "pkcs1"; + usesDefaultFeatures = false; + } + { + name = "pkcs8"; + packageId = "pkcs8"; + usesDefaultFeatures = false; + } + { + name = "rand"; + packageId = "rand"; + usesDefaultFeatures = false; + features = [ "std_rng" ]; + } + { + name = "subtle"; + packageId = "subtle"; + usesDefaultFeatures = false; + } + { + name = "zeroize"; + packageId = "zeroize"; + features = [ "alloc" "zeroize_derive" ]; + } + ]; + features = { + "alloc" = [ "digest/alloc" "pkcs1/alloc" "pkcs8/alloc" "pkcs8/pkcs1" ]; + "default" = [ "std" "pem" ]; + "nightly" = [ "subtle/nightly" "num-bigint/nightly" ]; + "pem" = [ "alloc" "pkcs1/pem" "pkcs8/pem" ]; + "pkcs5" = [ "pkcs8/encryption" ]; + "serde" = [ "num-bigint/serde" "serde_crate" ]; + "serde_crate" = [ "dep:serde_crate" ]; + "std" = [ "alloc" "digest/std" "pkcs1/std" "pkcs8/std" "rand/std" ]; + }; + resolvedDefaultFeatures = [ "alloc" "default" "pem" "std" ]; + }; + "rusticata-macros" = rec { + crateName = "rusticata-macros"; + version = "4.0.0"; + edition = "2018"; + sha256 = "03dmfxhgwzpm1360iwcpcg3y18ddgya0i0hc599am212pdvj7ib5"; + authors = [ + "Pierre Chifflier <chifflier@wzdftpd.net>" + ]; + dependencies = [ + { + name = "nom"; + packageId = "nom"; + usesDefaultFeatures = false; + features = [ "std" ]; + } + ]; + + }; + "smallvec" = rec { + crateName = "smallvec"; + version = "1.8.0"; + edition = "2018"; + sha256 = "10zf4fn63p2d6sx8qap3jvyarcfw563308x3431hd4c34r35gpgj"; + authors = [ + "The Servo Project Developers" + ]; + features = { + "arbitrary" = [ "dep:arbitrary" ]; + "const_new" = [ "const_generics" ]; + "serde" = [ "dep:serde" ]; + }; + }; + "spin" = rec { + crateName = "spin"; + version = "0.5.2"; + edition = "2015"; + sha256 = "0b84m6dbzrwf2kxylnw82d3dr8w06av7rfkr8s85fb5f43rwyqvf"; + authors = [ + "Mathijs van de Nes <git@mathijs.vd-nes.nl>" + "John Ericson <git@JohnEricson.me>" + ]; + + }; + "spki" = rec { + crateName = "spki"; + version = "0.4.1"; + edition = "2018"; + sha256 = "0ckgkcg6db5y94dqhmyikgn8yrsah6pyf4j197hv1c51bp0s00aw"; + authors = [ + "RustCrypto Developers" + ]; + dependencies = [ + { + name = "der"; + packageId = "der"; + features = [ "oid" ]; + } + ]; + features = { + "std" = [ "der/std" ]; + }; + }; + "subtle" = rec { + crateName = "subtle"; + version = "2.4.1"; + edition = "2015"; + sha256 = "00b6jzh9gzb0h9n25g06nqr90z3xzqppfhhb260s1hjhh4pg7pkb"; + authors = [ + "Isis Lovecruft <isis@patternsinthevoid.net>" + "Henry de Valence <hdevalence@hdevalence.ca>" + ]; + features = { + "default" = [ "std" "i128" ]; + }; + }; + "syn" = rec { + crateName = "syn"; + version = "1.0.86"; + edition = "2018"; + sha256 = "0sqwa4nqxzm89nj8xd8sk4iz0hbrw3mb17b6hyc2w2d0zzsb6rca"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + usesDefaultFeatures = false; + } + { + name = "quote"; + packageId = "quote"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "unicode-xid"; + packageId = "unicode-xid"; + } + ]; + features = { + "default" = [ "derive" "parsing" "printing" "clone-impls" "proc-macro" ]; + "printing" = [ "quote" ]; + "proc-macro" = [ "proc-macro2/proc-macro" "quote/proc-macro" ]; + "quote" = [ "dep:quote" ]; + "test" = [ "syn-test-suite/all-features" ]; + }; + resolvedDefaultFeatures = [ "clone-impls" "default" "derive" "extra-traits" "full" "parsing" "printing" "proc-macro" "quote" "visit" ]; + }; + "synstructure" = rec { + crateName = "synstructure"; + version = "0.12.6"; + edition = "2018"; + sha256 = "03r1lydbf3japnlpc4wka7y90pmz1i0danaj3f9a7b431akdlszk"; + authors = [ + "Nika Layzell <nika@thelayzells.com>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + usesDefaultFeatures = false; + } + { + name = "quote"; + packageId = "quote"; + usesDefaultFeatures = false; + } + { + name = "syn"; + packageId = "syn"; + usesDefaultFeatures = false; + features = [ "derive" "parsing" "printing" "clone-impls" "visit" "extra-traits" ]; + } + { + name = "unicode-xid"; + packageId = "unicode-xid"; + } + ]; + features = { + "default" = [ "proc-macro" ]; + "proc-macro" = [ "proc-macro2/proc-macro" "syn/proc-macro" "quote/proc-macro" ]; + }; + resolvedDefaultFeatures = [ "default" "proc-macro" ]; + }; + "thiserror" = rec { + crateName = "thiserror"; + version = "1.0.30"; + edition = "2018"; + sha256 = "05y4wm29ck8flwq5k1q6nhwh00a3b30cz3xr0qvnbwad5vjsnjw5"; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + ]; + dependencies = [ + { + name = "thiserror-impl"; + packageId = "thiserror-impl"; + } + ]; + + }; + "thiserror-impl" = rec { + crateName = "thiserror-impl"; + version = "1.0.30"; + edition = "2018"; + sha256 = "0jviwmvx6wzawsj6c9msic7h419wmsbjagl9dzhpydkzc8zzscma"; + procMacro = true; + authors = [ + "David Tolnay <dtolnay@gmail.com>" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn"; + } + ]; + + }; + "time" = rec { + crateName = "time"; + version = "0.3.7"; + edition = "2018"; + sha256 = "0gbmwlkj15dfhbqvxlzji1ffc1lidblpgg1q3b3378hgyfcbqk00"; + authors = [ + "Jacob Pratt <open-source@jhpratt.dev>" + "Time contributors" + ]; + dependencies = [ + { + name = "itoa"; + packageId = "itoa"; + optional = true; + } + { + name = "libc"; + packageId = "libc"; + target = { target, features }: (target."family" == "unix"); + } + { + name = "num_threads"; + packageId = "num_threads"; + target = { target, features }: (target."family" == "unix"); + } + { + name = "time-macros"; + packageId = "time-macros"; + optional = true; + } + ]; + features = { + "default" = [ "std" ]; + "formatting" = [ "itoa" "std" ]; + "itoa" = [ "dep:itoa" ]; + "large-dates" = [ "time-macros/large-dates" ]; + "local-offset" = [ "std" ]; + "macros" = [ "time-macros" ]; + "quickcheck" = [ "quickcheck-dep" "alloc" ]; + "quickcheck-dep" = [ "dep:quickcheck-dep" ]; + "rand" = [ "dep:rand" ]; + "serde" = [ "dep:serde" ]; + "serde-human-readable" = [ "serde" "formatting" "parsing" ]; + "serde-well-known" = [ "serde/alloc" "formatting" "parsing" ]; + "std" = [ "alloc" ]; + "time-macros" = [ "dep:time-macros" ]; + }; + resolvedDefaultFeatures = [ "alloc" "default" "formatting" "itoa" "macros" "parsing" "std" "time-macros" ]; + }; + "time-macros" = rec { + crateName = "time-macros"; + version = "0.2.3"; + edition = "2018"; + sha256 = "1mj7pv8y9j2csrh1l8aabras36pgysbnfy18330srh4g8sihrsr5"; + procMacro = true; + authors = [ + "Jacob Pratt <open-source@jhpratt.dev>" + "Time contributors" + ]; + features = { + }; + }; + "typenum" = rec { + crateName = "typenum"; + version = "1.15.0"; + edition = "2018"; + sha256 = "11yrvz1vd43gqv738yw1v75rzngjbs7iwcgzjy3cq5ywkv2imy6w"; + build = "build/main.rs"; + authors = [ + "Paho Lurie-Gregg <paho@paholg.com>" + "Andre Bogus <bogusandre@gmail.com>" + ]; + features = { + "scale-info" = [ "dep:scale-info" ]; + "scale_info" = [ "scale-info/derive" ]; + }; + }; + "unicode-xid" = rec { + crateName = "unicode-xid"; + version = "0.2.2"; + edition = "2015"; + sha256 = "1wrkgcw557v311dkdb6n2hrix9dm2qdsb1zpw7pn79l03zb85jwc"; + authors = [ + "erick.tryzelaar <erick.tryzelaar@gmail.com>" + "kwantam <kwantam@gmail.com>" + "Manish Goregaokar <manishsmail@gmail.com>" + ]; + features = { + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "untrusted" = rec { + crateName = "untrusted"; + version = "0.7.1"; + edition = "2018"; + sha256 = "0jkbqaj9d3v5a91pp3wp9mffvng1nhycx6sh4qkdd9qyr62ccmm1"; + libPath = "src/untrusted.rs"; + authors = [ + "Brian Smith <brian@briansmith.org>" + ]; + + }; + "vcpkg" = rec { + crateName = "vcpkg"; + version = "0.2.15"; + edition = "2015"; + sha256 = "09i4nf5y8lig6xgj3f7fyrvzd3nlaw4znrihw8psidvv5yk4xkdc"; + authors = [ + "Jim McGrath <jimmc2@gmail.com>" + ]; + + }; + "version_check" = rec { + crateName = "version_check"; + version = "0.9.4"; + edition = "2015"; + sha256 = "0gs8grwdlgh0xq660d7wr80x14vxbizmd8dbp29p2pdncx8lp1s9"; + authors = [ + "Sergio Benitez <sb@sergio.bz>" + ]; + + }; + "wasi" = rec { + crateName = "wasi"; + version = "0.10.2+wasi-snapshot-preview1"; + edition = "2018"; + sha256 = "1ii7nff4y1mpcrxzzvbpgxm7a1nn3szjf1n21jnx37c2g6dbsvzx"; + authors = [ + "The Cranelift Project Developers" + ]; + features = { + "compiler_builtins" = [ "dep:compiler_builtins" ]; + "core" = [ "dep:core" ]; + "default" = [ "std" ]; + "rustc-dep-of-std" = [ "compiler_builtins" "core" "rustc-std-workspace-alloc" ]; + "rustc-std-workspace-alloc" = [ "dep:rustc-std-workspace-alloc" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "wasm-bindgen" = rec { + crateName = "wasm-bindgen"; + version = "0.2.79"; + edition = "2018"; + sha256 = "01kc4lj2vlf0ra2w63izrgdlv8p6f8p15086hhyqln6q4dsazw95"; + authors = [ + "The wasm-bindgen Developers" + ]; + dependencies = [ + { + name = "cfg-if"; + packageId = "cfg-if"; + } + { + name = "wasm-bindgen-macro"; + packageId = "wasm-bindgen-macro"; + } + ]; + features = { + "default" = [ "spans" "std" ]; + "enable-interning" = [ "std" ]; + "serde" = [ "dep:serde" ]; + "serde-serialize" = [ "serde" "serde_json" "std" ]; + "serde_json" = [ "dep:serde_json" ]; + "spans" = [ "wasm-bindgen-macro/spans" ]; + "strict-macro" = [ "wasm-bindgen-macro/strict-macro" ]; + "xxx_debug_only_print_generated_code" = [ "wasm-bindgen-macro/xxx_debug_only_print_generated_code" ]; + }; + resolvedDefaultFeatures = [ "default" "spans" "std" ]; + }; + "wasm-bindgen-backend" = rec { + crateName = "wasm-bindgen-backend"; + version = "0.2.79"; + edition = "2018"; + sha256 = "1jpdrl5jj01961jxhmvj7v25ws928fyfj8ms7izifnhg0ggw08cb"; + authors = [ + "The wasm-bindgen Developers" + ]; + dependencies = [ + { + name = "bumpalo"; + packageId = "bumpalo"; + } + { + name = "lazy_static"; + packageId = "lazy_static"; + } + { + name = "log"; + packageId = "log"; + } + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn"; + features = [ "full" ]; + } + { + name = "wasm-bindgen-shared"; + packageId = "wasm-bindgen-shared"; + } + ]; + features = { + "extra-traits" = [ "syn/extra-traits" ]; + }; + resolvedDefaultFeatures = [ "spans" ]; + }; + "wasm-bindgen-macro" = rec { + crateName = "wasm-bindgen-macro"; + version = "0.2.79"; + edition = "2018"; + sha256 = "00gdh0dlf2r77mxwh08q0z01vz2z7mvrllmj4gjjx9a0kvb06hig"; + procMacro = true; + authors = [ + "The wasm-bindgen Developers" + ]; + dependencies = [ + { + name = "quote"; + packageId = "quote"; + } + { + name = "wasm-bindgen-macro-support"; + packageId = "wasm-bindgen-macro-support"; + } + ]; + features = { + "spans" = [ "wasm-bindgen-macro-support/spans" ]; + "strict-macro" = [ "wasm-bindgen-macro-support/strict-macro" ]; + }; + resolvedDefaultFeatures = [ "spans" ]; + }; + "wasm-bindgen-macro-support" = rec { + crateName = "wasm-bindgen-macro-support"; + version = "0.2.79"; + edition = "2018"; + sha256 = "1g1fjqvrkrf3j20z8nxsf60cypxg9dfvpbachl2b53908q6s7a5z"; + authors = [ + "The wasm-bindgen Developers" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn"; + features = [ "visit" "full" ]; + } + { + name = "wasm-bindgen-backend"; + packageId = "wasm-bindgen-backend"; + } + { + name = "wasm-bindgen-shared"; + packageId = "wasm-bindgen-shared"; + } + ]; + features = { + "extra-traits" = [ "syn/extra-traits" ]; + "spans" = [ "wasm-bindgen-backend/spans" ]; + }; + resolvedDefaultFeatures = [ "spans" ]; + }; + "wasm-bindgen-shared" = rec { + crateName = "wasm-bindgen-shared"; + version = "0.2.79"; + edition = "2018"; + sha256 = "18h67l9b9jn06iw9r2p7bh9i0brh24lilcp4f26f4f24bh1qv59x"; + authors = [ + "The wasm-bindgen Developers" + ]; + + }; + "web-sys" = rec { + crateName = "web-sys"; + version = "0.3.56"; + edition = "2018"; + sha256 = "1sxqmwq773ss5m6vz7z95fdm6bqlix0s2awsy0j5gllxy8cv6q60"; + authors = [ + "The wasm-bindgen Developers" + ]; + dependencies = [ + { + name = "js-sys"; + packageId = "js-sys"; + } + { + name = "wasm-bindgen"; + packageId = "wasm-bindgen"; + } + ]; + features = { + "AbortSignal" = [ "EventTarget" ]; + "AnalyserNode" = [ "AudioNode" "EventTarget" ]; + "Animation" = [ "EventTarget" ]; + "AnimationEvent" = [ "Event" ]; + "AnimationPlaybackEvent" = [ "Event" ]; + "Attr" = [ "EventTarget" "Node" ]; + "AudioBufferSourceNode" = [ "AudioNode" "AudioScheduledSourceNode" "EventTarget" ]; + "AudioContext" = [ "BaseAudioContext" "EventTarget" ]; + "AudioDestinationNode" = [ "AudioNode" "EventTarget" ]; + "AudioNode" = [ "EventTarget" ]; + "AudioProcessingEvent" = [ "Event" ]; + "AudioScheduledSourceNode" = [ "AudioNode" "EventTarget" ]; + "AudioStreamTrack" = [ "EventTarget" "MediaStreamTrack" ]; + "AudioTrackList" = [ "EventTarget" ]; + "AudioWorklet" = [ "Worklet" ]; + "AudioWorkletGlobalScope" = [ "WorkletGlobalScope" ]; + "AudioWorkletNode" = [ "AudioNode" "EventTarget" ]; + "AuthenticatorAssertionResponse" = [ "AuthenticatorResponse" ]; + "AuthenticatorAttestationResponse" = [ "AuthenticatorResponse" ]; + "BaseAudioContext" = [ "EventTarget" ]; + "BatteryManager" = [ "EventTarget" ]; + "BeforeUnloadEvent" = [ "Event" ]; + "BiquadFilterNode" = [ "AudioNode" "EventTarget" ]; + "BlobEvent" = [ "Event" ]; + "Bluetooth" = [ "EventTarget" ]; + "BluetoothAdvertisingEvent" = [ "Event" ]; + "BluetoothDevice" = [ "EventTarget" ]; + "BluetoothPermissionResult" = [ "EventTarget" "PermissionStatus" ]; + "BluetoothRemoteGattCharacteristic" = [ "EventTarget" ]; + "BluetoothRemoteGattService" = [ "EventTarget" ]; + "BroadcastChannel" = [ "EventTarget" ]; + "CanvasCaptureMediaStream" = [ "EventTarget" "MediaStream" ]; + "CdataSection" = [ "CharacterData" "EventTarget" "Node" "Text" ]; + "ChannelMergerNode" = [ "AudioNode" "EventTarget" ]; + "ChannelSplitterNode" = [ "AudioNode" "EventTarget" ]; + "CharacterData" = [ "EventTarget" "Node" ]; + "ChromeWorker" = [ "EventTarget" "Worker" ]; + "Clipboard" = [ "EventTarget" ]; + "ClipboardEvent" = [ "Event" ]; + "CloseEvent" = [ "Event" ]; + "Comment" = [ "CharacterData" "EventTarget" "Node" ]; + "CompositionEvent" = [ "Event" "UiEvent" ]; + "ConstantSourceNode" = [ "AudioNode" "AudioScheduledSourceNode" "EventTarget" ]; + "ConvolverNode" = [ "AudioNode" "EventTarget" ]; + "CssAnimation" = [ "Animation" "EventTarget" ]; + "CssConditionRule" = [ "CssGroupingRule" "CssRule" ]; + "CssCounterStyleRule" = [ "CssRule" ]; + "CssFontFaceRule" = [ "CssRule" ]; + "CssFontFeatureValuesRule" = [ "CssRule" ]; + "CssGroupingRule" = [ "CssRule" ]; + "CssImportRule" = [ "CssRule" ]; + "CssKeyframeRule" = [ "CssRule" ]; + "CssKeyframesRule" = [ "CssRule" ]; + "CssMediaRule" = [ "CssConditionRule" "CssGroupingRule" "CssRule" ]; + "CssNamespaceRule" = [ "CssRule" ]; + "CssPageRule" = [ "CssRule" ]; + "CssStyleRule" = [ "CssRule" ]; + "CssStyleSheet" = [ "StyleSheet" ]; + "CssSupportsRule" = [ "CssConditionRule" "CssGroupingRule" "CssRule" ]; + "CssTransition" = [ "Animation" "EventTarget" ]; + "CustomEvent" = [ "Event" ]; + "DedicatedWorkerGlobalScope" = [ "EventTarget" "WorkerGlobalScope" ]; + "DelayNode" = [ "AudioNode" "EventTarget" ]; + "DeviceLightEvent" = [ "Event" ]; + "DeviceMotionEvent" = [ "Event" ]; + "DeviceOrientationEvent" = [ "Event" ]; + "DeviceProximityEvent" = [ "Event" ]; + "Document" = [ "EventTarget" "Node" ]; + "DocumentFragment" = [ "EventTarget" "Node" ]; + "DocumentTimeline" = [ "AnimationTimeline" ]; + "DocumentType" = [ "EventTarget" "Node" ]; + "DomMatrix" = [ "DomMatrixReadOnly" ]; + "DomPoint" = [ "DomPointReadOnly" ]; + "DomRect" = [ "DomRectReadOnly" ]; + "DomRequest" = [ "EventTarget" ]; + "DragEvent" = [ "Event" "MouseEvent" "UiEvent" ]; + "DynamicsCompressorNode" = [ "AudioNode" "EventTarget" ]; + "Element" = [ "EventTarget" "Node" ]; + "ErrorEvent" = [ "Event" ]; + "EventSource" = [ "EventTarget" ]; + "ExtendableEvent" = [ "Event" ]; + "ExtendableMessageEvent" = [ "Event" "ExtendableEvent" ]; + "FetchEvent" = [ "Event" "ExtendableEvent" ]; + "FetchObserver" = [ "EventTarget" ]; + "File" = [ "Blob" ]; + "FileReader" = [ "EventTarget" ]; + "FileSystemDirectoryEntry" = [ "FileSystemEntry" ]; + "FileSystemFileEntry" = [ "FileSystemEntry" ]; + "FocusEvent" = [ "Event" "UiEvent" ]; + "FontFaceSet" = [ "EventTarget" ]; + "FontFaceSetLoadEvent" = [ "Event" ]; + "GainNode" = [ "AudioNode" "EventTarget" ]; + "GamepadAxisMoveEvent" = [ "Event" "GamepadEvent" ]; + "GamepadButtonEvent" = [ "Event" "GamepadEvent" ]; + "GamepadEvent" = [ "Event" ]; + "GpuDevice" = [ "EventTarget" ]; + "GpuUncapturedErrorEvent" = [ "Event" ]; + "HashChangeEvent" = [ "Event" ]; + "Hid" = [ "EventTarget" ]; + "HidConnectionEvent" = [ "Event" ]; + "HidDevice" = [ "EventTarget" ]; + "HidInputReportEvent" = [ "Event" ]; + "HtmlAnchorElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlAreaElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlAudioElement" = [ "Element" "EventTarget" "HtmlElement" "HtmlMediaElement" "Node" ]; + "HtmlBaseElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlBodyElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlBrElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlButtonElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlCanvasElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlDListElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlDataElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlDataListElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlDetailsElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlDialogElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlDirectoryElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlDivElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlDocument" = [ "Document" "EventTarget" "Node" ]; + "HtmlElement" = [ "Element" "EventTarget" "Node" ]; + "HtmlEmbedElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlFieldSetElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlFontElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlFormControlsCollection" = [ "HtmlCollection" ]; + "HtmlFormElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlFrameElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlFrameSetElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlHeadElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlHeadingElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlHrElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlHtmlElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlIFrameElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlImageElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlInputElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlLabelElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlLegendElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlLiElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlLinkElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlMapElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlMediaElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlMenuElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlMenuItemElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlMetaElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlMeterElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlModElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlOListElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlObjectElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlOptGroupElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlOptionElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlOptionsCollection" = [ "HtmlCollection" ]; + "HtmlOutputElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlParagraphElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlParamElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlPictureElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlPreElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlProgressElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlQuoteElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlScriptElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlSelectElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlSlotElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlSourceElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlSpanElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlStyleElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTableCaptionElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTableCellElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTableColElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTableElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTableRowElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTableSectionElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTemplateElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTextAreaElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTimeElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTitleElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlTrackElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlUListElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlUnknownElement" = [ "Element" "EventTarget" "HtmlElement" "Node" ]; + "HtmlVideoElement" = [ "Element" "EventTarget" "HtmlElement" "HtmlMediaElement" "Node" ]; + "IdbCursorWithValue" = [ "IdbCursor" ]; + "IdbDatabase" = [ "EventTarget" ]; + "IdbFileHandle" = [ "EventTarget" ]; + "IdbFileRequest" = [ "DomRequest" "EventTarget" ]; + "IdbLocaleAwareKeyRange" = [ "IdbKeyRange" ]; + "IdbMutableFile" = [ "EventTarget" ]; + "IdbOpenDbRequest" = [ "EventTarget" "IdbRequest" ]; + "IdbRequest" = [ "EventTarget" ]; + "IdbTransaction" = [ "EventTarget" ]; + "IdbVersionChangeEvent" = [ "Event" ]; + "IirFilterNode" = [ "AudioNode" "EventTarget" ]; + "ImageCaptureErrorEvent" = [ "Event" ]; + "InputEvent" = [ "Event" "UiEvent" ]; + "KeyboardEvent" = [ "Event" "UiEvent" ]; + "KeyframeEffect" = [ "AnimationEffect" ]; + "LocalMediaStream" = [ "EventTarget" "MediaStream" ]; + "MediaDevices" = [ "EventTarget" ]; + "MediaElementAudioSourceNode" = [ "AudioNode" "EventTarget" ]; + "MediaEncryptedEvent" = [ "Event" ]; + "MediaKeyError" = [ "Event" ]; + "MediaKeyMessageEvent" = [ "Event" ]; + "MediaKeySession" = [ "EventTarget" ]; + "MediaQueryList" = [ "EventTarget" ]; + "MediaQueryListEvent" = [ "Event" ]; + "MediaRecorder" = [ "EventTarget" ]; + "MediaRecorderErrorEvent" = [ "Event" ]; + "MediaSource" = [ "EventTarget" ]; + "MediaStream" = [ "EventTarget" ]; + "MediaStreamAudioDestinationNode" = [ "AudioNode" "EventTarget" ]; + "MediaStreamAudioSourceNode" = [ "AudioNode" "EventTarget" ]; + "MediaStreamEvent" = [ "Event" ]; + "MediaStreamTrack" = [ "EventTarget" ]; + "MediaStreamTrackEvent" = [ "Event" ]; + "MessageEvent" = [ "Event" ]; + "MessagePort" = [ "EventTarget" ]; + "MidiAccess" = [ "EventTarget" ]; + "MidiConnectionEvent" = [ "Event" ]; + "MidiInput" = [ "EventTarget" "MidiPort" ]; + "MidiMessageEvent" = [ "Event" ]; + "MidiOutput" = [ "EventTarget" "MidiPort" ]; + "MidiPort" = [ "EventTarget" ]; + "MouseEvent" = [ "Event" "UiEvent" ]; + "MouseScrollEvent" = [ "Event" "MouseEvent" "UiEvent" ]; + "MutationEvent" = [ "Event" ]; + "NetworkInformation" = [ "EventTarget" ]; + "Node" = [ "EventTarget" ]; + "Notification" = [ "EventTarget" ]; + "NotificationEvent" = [ "Event" "ExtendableEvent" ]; + "OfflineAudioCompletionEvent" = [ "Event" ]; + "OfflineAudioContext" = [ "BaseAudioContext" "EventTarget" ]; + "OfflineResourceList" = [ "EventTarget" ]; + "OffscreenCanvas" = [ "EventTarget" ]; + "OscillatorNode" = [ "AudioNode" "AudioScheduledSourceNode" "EventTarget" ]; + "PageTransitionEvent" = [ "Event" ]; + "PaintWorkletGlobalScope" = [ "WorkletGlobalScope" ]; + "PannerNode" = [ "AudioNode" "EventTarget" ]; + "PaymentMethodChangeEvent" = [ "Event" "PaymentRequestUpdateEvent" ]; + "PaymentRequestUpdateEvent" = [ "Event" ]; + "Performance" = [ "EventTarget" ]; + "PerformanceMark" = [ "PerformanceEntry" ]; + "PerformanceMeasure" = [ "PerformanceEntry" ]; + "PerformanceNavigationTiming" = [ "PerformanceEntry" "PerformanceResourceTiming" ]; + "PerformanceResourceTiming" = [ "PerformanceEntry" ]; + "PermissionStatus" = [ "EventTarget" ]; + "PointerEvent" = [ "Event" "MouseEvent" "UiEvent" ]; + "PopStateEvent" = [ "Event" ]; + "PopupBlockedEvent" = [ "Event" ]; + "PresentationAvailability" = [ "EventTarget" ]; + "PresentationConnection" = [ "EventTarget" ]; + "PresentationConnectionAvailableEvent" = [ "Event" ]; + "PresentationConnectionCloseEvent" = [ "Event" ]; + "PresentationConnectionList" = [ "EventTarget" ]; + "PresentationRequest" = [ "EventTarget" ]; + "ProcessingInstruction" = [ "CharacterData" "EventTarget" "Node" ]; + "ProgressEvent" = [ "Event" ]; + "PromiseRejectionEvent" = [ "Event" ]; + "PublicKeyCredential" = [ "Credential" ]; + "PushEvent" = [ "Event" "ExtendableEvent" ]; + "RadioNodeList" = [ "NodeList" ]; + "RtcDataChannel" = [ "EventTarget" ]; + "RtcDataChannelEvent" = [ "Event" ]; + "RtcPeerConnection" = [ "EventTarget" ]; + "RtcPeerConnectionIceEvent" = [ "Event" ]; + "RtcTrackEvent" = [ "Event" ]; + "RtcdtmfSender" = [ "EventTarget" ]; + "RtcdtmfToneChangeEvent" = [ "Event" ]; + "Screen" = [ "EventTarget" ]; + "ScreenOrientation" = [ "EventTarget" ]; + "ScriptProcessorNode" = [ "AudioNode" "EventTarget" ]; + "ScrollAreaEvent" = [ "Event" "UiEvent" ]; + "SecurityPolicyViolationEvent" = [ "Event" ]; + "ServiceWorker" = [ "EventTarget" ]; + "ServiceWorkerContainer" = [ "EventTarget" ]; + "ServiceWorkerGlobalScope" = [ "EventTarget" "WorkerGlobalScope" ]; + "ServiceWorkerRegistration" = [ "EventTarget" ]; + "ShadowRoot" = [ "DocumentFragment" "EventTarget" "Node" ]; + "SharedWorker" = [ "EventTarget" ]; + "SharedWorkerGlobalScope" = [ "EventTarget" "WorkerGlobalScope" ]; + "SourceBuffer" = [ "EventTarget" ]; + "SourceBufferList" = [ "EventTarget" ]; + "SpeechRecognition" = [ "EventTarget" ]; + "SpeechRecognitionError" = [ "Event" ]; + "SpeechRecognitionEvent" = [ "Event" ]; + "SpeechSynthesis" = [ "EventTarget" ]; + "SpeechSynthesisErrorEvent" = [ "Event" "SpeechSynthesisEvent" ]; + "SpeechSynthesisEvent" = [ "Event" ]; + "SpeechSynthesisUtterance" = [ "EventTarget" ]; + "StereoPannerNode" = [ "AudioNode" "EventTarget" ]; + "StorageEvent" = [ "Event" ]; + "SvgAnimateElement" = [ "Element" "EventTarget" "Node" "SvgAnimationElement" "SvgElement" ]; + "SvgAnimateMotionElement" = [ "Element" "EventTarget" "Node" "SvgAnimationElement" "SvgElement" ]; + "SvgAnimateTransformElement" = [ "Element" "EventTarget" "Node" "SvgAnimationElement" "SvgElement" ]; + "SvgAnimationElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgCircleElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGeometryElement" "SvgGraphicsElement" ]; + "SvgClipPathElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgComponentTransferFunctionElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgDefsElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" ]; + "SvgDescElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgElement" = [ "Element" "EventTarget" "Node" ]; + "SvgEllipseElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGeometryElement" "SvgGraphicsElement" ]; + "SvgFilterElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgForeignObjectElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" ]; + "SvgGeometryElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" ]; + "SvgGradientElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgGraphicsElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgImageElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" ]; + "SvgLineElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGeometryElement" "SvgGraphicsElement" ]; + "SvgLinearGradientElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGradientElement" ]; + "SvgMarkerElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgMaskElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgMetadataElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgPathElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGeometryElement" "SvgGraphicsElement" ]; + "SvgPathSegArcAbs" = [ "SvgPathSeg" ]; + "SvgPathSegArcRel" = [ "SvgPathSeg" ]; + "SvgPathSegClosePath" = [ "SvgPathSeg" ]; + "SvgPathSegCurvetoCubicAbs" = [ "SvgPathSeg" ]; + "SvgPathSegCurvetoCubicRel" = [ "SvgPathSeg" ]; + "SvgPathSegCurvetoCubicSmoothAbs" = [ "SvgPathSeg" ]; + "SvgPathSegCurvetoCubicSmoothRel" = [ "SvgPathSeg" ]; + "SvgPathSegCurvetoQuadraticAbs" = [ "SvgPathSeg" ]; + "SvgPathSegCurvetoQuadraticRel" = [ "SvgPathSeg" ]; + "SvgPathSegCurvetoQuadraticSmoothAbs" = [ "SvgPathSeg" ]; + "SvgPathSegCurvetoQuadraticSmoothRel" = [ "SvgPathSeg" ]; + "SvgPathSegLinetoAbs" = [ "SvgPathSeg" ]; + "SvgPathSegLinetoHorizontalAbs" = [ "SvgPathSeg" ]; + "SvgPathSegLinetoHorizontalRel" = [ "SvgPathSeg" ]; + "SvgPathSegLinetoRel" = [ "SvgPathSeg" ]; + "SvgPathSegLinetoVerticalAbs" = [ "SvgPathSeg" ]; + "SvgPathSegLinetoVerticalRel" = [ "SvgPathSeg" ]; + "SvgPathSegMovetoAbs" = [ "SvgPathSeg" ]; + "SvgPathSegMovetoRel" = [ "SvgPathSeg" ]; + "SvgPatternElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgPolygonElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGeometryElement" "SvgGraphicsElement" ]; + "SvgPolylineElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGeometryElement" "SvgGraphicsElement" ]; + "SvgRadialGradientElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGradientElement" ]; + "SvgRectElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGeometryElement" "SvgGraphicsElement" ]; + "SvgScriptElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgSetElement" = [ "Element" "EventTarget" "Node" "SvgAnimationElement" "SvgElement" ]; + "SvgStopElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgStyleElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgSwitchElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" ]; + "SvgSymbolElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgTextContentElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" ]; + "SvgTextElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" "SvgTextContentElement" "SvgTextPositioningElement" ]; + "SvgTextPathElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" "SvgTextContentElement" ]; + "SvgTextPositioningElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" "SvgTextContentElement" ]; + "SvgTitleElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgUseElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" ]; + "SvgViewElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgaElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" ]; + "SvgfeBlendElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeColorMatrixElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeComponentTransferElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeCompositeElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeConvolveMatrixElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeDiffuseLightingElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeDisplacementMapElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeDistantLightElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeDropShadowElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeFloodElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeFuncAElement" = [ "Element" "EventTarget" "Node" "SvgComponentTransferFunctionElement" "SvgElement" ]; + "SvgfeFuncBElement" = [ "Element" "EventTarget" "Node" "SvgComponentTransferFunctionElement" "SvgElement" ]; + "SvgfeFuncGElement" = [ "Element" "EventTarget" "Node" "SvgComponentTransferFunctionElement" "SvgElement" ]; + "SvgfeFuncRElement" = [ "Element" "EventTarget" "Node" "SvgComponentTransferFunctionElement" "SvgElement" ]; + "SvgfeGaussianBlurElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeImageElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeMergeElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeMergeNodeElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeMorphologyElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeOffsetElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfePointLightElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeSpecularLightingElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeSpotLightElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeTileElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgfeTurbulenceElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvggElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" ]; + "SvgmPathElement" = [ "Element" "EventTarget" "Node" "SvgElement" ]; + "SvgsvgElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" ]; + "SvgtSpanElement" = [ "Element" "EventTarget" "Node" "SvgElement" "SvgGraphicsElement" "SvgTextContentElement" "SvgTextPositioningElement" ]; + "TcpServerSocket" = [ "EventTarget" ]; + "TcpServerSocketEvent" = [ "Event" ]; + "TcpSocket" = [ "EventTarget" ]; + "TcpSocketErrorEvent" = [ "Event" ]; + "TcpSocketEvent" = [ "Event" ]; + "Text" = [ "CharacterData" "EventTarget" "Node" ]; + "TextTrack" = [ "EventTarget" ]; + "TextTrackCue" = [ "EventTarget" ]; + "TextTrackList" = [ "EventTarget" ]; + "TimeEvent" = [ "Event" ]; + "TouchEvent" = [ "Event" "UiEvent" ]; + "TrackEvent" = [ "Event" ]; + "TransitionEvent" = [ "Event" ]; + "UiEvent" = [ "Event" ]; + "Usb" = [ "EventTarget" ]; + "UsbConnectionEvent" = [ "Event" ]; + "UsbPermissionResult" = [ "EventTarget" "PermissionStatus" ]; + "UserProximityEvent" = [ "Event" ]; + "ValueEvent" = [ "Event" ]; + "VideoStreamTrack" = [ "EventTarget" "MediaStreamTrack" ]; + "VideoTrackList" = [ "EventTarget" ]; + "VrDisplay" = [ "EventTarget" ]; + "VttCue" = [ "EventTarget" "TextTrackCue" ]; + "WakeLockSentinel" = [ "EventTarget" ]; + "WaveShaperNode" = [ "AudioNode" "EventTarget" ]; + "WebGlContextEvent" = [ "Event" ]; + "WebKitCssMatrix" = [ "DomMatrix" "DomMatrixReadOnly" ]; + "WebSocket" = [ "EventTarget" ]; + "WheelEvent" = [ "Event" "MouseEvent" "UiEvent" ]; + "Window" = [ "EventTarget" ]; + "WindowClient" = [ "Client" ]; + "Worker" = [ "EventTarget" ]; + "WorkerDebuggerGlobalScope" = [ "EventTarget" ]; + "WorkerGlobalScope" = [ "EventTarget" ]; + "XmlDocument" = [ "Document" "EventTarget" "Node" ]; + "XmlHttpRequest" = [ "EventTarget" "XmlHttpRequestEventTarget" ]; + "XmlHttpRequestEventTarget" = [ "EventTarget" ]; + "XmlHttpRequestUpload" = [ "EventTarget" "XmlHttpRequestEventTarget" ]; + "Xr" = [ "EventTarget" ]; + "XrBoundedReferenceSpace" = [ "EventTarget" "XrReferenceSpace" "XrSpace" ]; + "XrInputSourceEvent" = [ "Event" ]; + "XrInputSourcesChangeEvent" = [ "Event" ]; + "XrReferenceSpace" = [ "EventTarget" "XrSpace" ]; + "XrReferenceSpaceEvent" = [ "Event" ]; + "XrSession" = [ "EventTarget" ]; + "XrSessionEvent" = [ "Event" ]; + "XrSpace" = [ "EventTarget" ]; + "XrViewerPose" = [ "XrPose" ]; + }; + resolvedDefaultFeatures = [ "Crypto" "EventTarget" "Window" ]; + }; + "webpki" = rec { + crateName = "webpki"; + version = "0.22.0"; + edition = "2018"; + sha256 = "1gd1gxip5kgdwmrvhj5gjxij2mgg2mavq1ych4q1h272ja0xg5gh"; + authors = [ + "Brian Smith <brian@briansmith.org>" + ]; + dependencies = [ + { + name = "ring"; + packageId = "ring"; + usesDefaultFeatures = false; + } + { + name = "untrusted"; + packageId = "untrusted"; + } + ]; + features = { + "alloc" = [ "ring/alloc" ]; + "std" = [ "alloc" ]; + }; + resolvedDefaultFeatures = [ "alloc" "std" ]; + }; + "winapi" = rec { + crateName = "winapi"; + version = "0.3.9"; + edition = "2015"; + sha256 = "06gl025x418lchw1wxj64ycr7gha83m44cjr5sarhynd9xkrm0sw"; + authors = [ + "Peter Atashian <retep998@gmail.com>" + ]; + dependencies = [ + { + name = "winapi-i686-pc-windows-gnu"; + packageId = "winapi-i686-pc-windows-gnu"; + target = { target, features }: (stdenv.hostPlatform.config == "i686-pc-windows-gnu"); + } + { + name = "winapi-x86_64-pc-windows-gnu"; + packageId = "winapi-x86_64-pc-windows-gnu"; + target = { target, features }: (stdenv.hostPlatform.config == "x86_64-pc-windows-gnu"); + } + ]; + features = { + "debug" = [ "impl-debug" ]; + }; + resolvedDefaultFeatures = [ "ntsecapi" "wtypesbase" ]; + }; + "winapi-i686-pc-windows-gnu" = rec { + crateName = "winapi-i686-pc-windows-gnu"; + version = "0.4.0"; + edition = "2015"; + sha256 = "1dmpa6mvcvzz16zg6d5vrfy4bxgg541wxrcip7cnshi06v38ffxc"; + authors = [ + "Peter Atashian <retep998@gmail.com>" + ]; + + }; + "winapi-x86_64-pc-windows-gnu" = rec { + crateName = "winapi-x86_64-pc-windows-gnu"; + version = "0.4.0"; + edition = "2015"; + sha256 = "0gqq64czqb64kskjryj8isp62m2sgvx25yyj3kpc2myh85w24bki"; + authors = [ + "Peter Atashian <retep998@gmail.com>" + ]; + + }; + "x509-parser" = rec { + crateName = "x509-parser"; + version = "0.13.0"; + edition = "2018"; + sha256 = "0f3fqbv92q3a3s51md94sw3vgzs934agl4ii5a6ym364mkdlpwg5"; + authors = [ + "Pierre Chifflier <chifflier@wzdftpd.net>" + ]; + dependencies = [ + { + name = "asn1-rs"; + packageId = "asn1-rs"; + features = [ "datetime" ]; + } + { + name = "base64"; + packageId = "base64"; + } + { + name = "data-encoding"; + packageId = "data-encoding"; + } + { + name = "der-parser"; + packageId = "der-parser"; + features = [ "bigint" ]; + } + { + name = "lazy_static"; + packageId = "lazy_static"; + } + { + name = "nom"; + packageId = "nom"; + } + { + name = "oid-registry"; + packageId = "oid-registry"; + features = [ "crypto" "x509" ]; + } + { + name = "ring"; + packageId = "ring"; + optional = true; + } + { + name = "rusticata-macros"; + packageId = "rusticata-macros"; + } + { + name = "thiserror"; + packageId = "thiserror"; + } + { + name = "time"; + packageId = "time"; + features = [ "formatting" ]; + } + ]; + features = { + "ring" = [ "dep:ring" ]; + "verify" = [ "ring" ]; + }; + resolvedDefaultFeatures = [ "default" "ring" "verify" ]; + }; + "yasna" = rec { + crateName = "yasna"; + version = "0.5.0"; + edition = "2018"; + sha256 = "0k1gk11hq4rwlppv9f50bz8bnmgr73r66idpp7rybly96si38v9l"; + authors = [ + "Masaki Hara <ackie.h.gmai@gmail.com>" + ]; + dependencies = [ + { + name = "time"; + packageId = "time"; + optional = true; + usesDefaultFeatures = false; + features = [ "std" ]; + } + ]; + features = { + "bit-vec" = [ "dep:bit-vec" ]; + "num-bigint" = [ "dep:num-bigint" ]; + "time" = [ "dep:time" ]; + }; + resolvedDefaultFeatures = [ "default" "std" "time" ]; + }; + "zeroize" = rec { + crateName = "zeroize"; + version = "1.4.3"; + edition = "2018"; + sha256 = "068nvl3n5hk6lfn5y24grf2c7anzzqfzjjccscq3md7rqp79v3fn"; + authors = [ + "The RustCrypto Project Developers" + ]; + dependencies = [ + { + name = "zeroize_derive"; + packageId = "zeroize_derive"; + optional = true; + } + ]; + features = { + "default" = [ "alloc" ]; + "zeroize_derive" = [ "dep:zeroize_derive" ]; + }; + resolvedDefaultFeatures = [ "alloc" "default" "zeroize_derive" ]; + }; + "zeroize_derive" = rec { + crateName = "zeroize_derive"; + version = "1.3.1"; + edition = "2018"; + sha256 = "1nzdqyryjnqcrqz0vhddpkd8sybhn0bd8rbd6l33rdhhxwzz3s41"; + procMacro = true; + authors = [ + "The RustCrypto Project Developers" + ]; + dependencies = [ + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn"; + } + { + name = "synstructure"; + packageId = "synstructure"; + } + ]; + + }; + }; + + # +# crate2nix/default.nix (excerpt start) +# + + /* Target (platform) data for conditional dependencies. + This corresponds roughly to what buildRustCrate is setting. + */ + defaultTarget = { + unix = true; + windows = false; + fuchsia = true; + test = false; + + # This doesn't appear to be officially documented anywhere yet. + # See https://github.com/rust-lang-nursery/rust-forge/issues/101. + os = + if stdenv.hostPlatform.isDarwin + then "macos" + else stdenv.hostPlatform.parsed.kernel.name; + arch = stdenv.hostPlatform.parsed.cpu.name; + family = "unix"; + env = "gnu"; + endian = + if stdenv.hostPlatform.parsed.cpu.significantByte.name == "littleEndian" + then "little" else "big"; + pointer_width = toString stdenv.hostPlatform.parsed.cpu.bits; + vendor = stdenv.hostPlatform.parsed.vendor.name; + debug_assertions = false; + }; + + /* Filters common temp files and build files. */ + # TODO(pkolloch): Substitute with gitignore filter + sourceFilter = name: type: + let + baseName = builtins.baseNameOf (builtins.toString name); + in + ! ( + # Filter out git + baseName == ".gitignore" + || (type == "directory" && baseName == ".git") + + # Filter out build results + || ( + type == "directory" && ( + baseName == "target" + || baseName == "_site" + || baseName == ".sass-cache" + || baseName == ".jekyll-metadata" + || baseName == "build-artifacts" + ) + ) + + # Filter out nix-build result symlinks + || ( + type == "symlink" && lib.hasPrefix "result" baseName + ) + + # Filter out IDE config + || ( + type == "directory" && ( + baseName == ".idea" || baseName == ".vscode" + ) + ) || lib.hasSuffix ".iml" baseName + + # Filter out nix build files + || baseName == "Cargo.nix" + + # Filter out editor backup / swap files. + || lib.hasSuffix "~" baseName + || builtins.match "^\\.sw[a-z]$$" baseName != null + || builtins.match "^\\..*\\.sw[a-z]$$" baseName != null + || lib.hasSuffix ".tmp" baseName + || lib.hasSuffix ".bak" baseName + || baseName == "tests.nix" + ); + + /* Returns a crate which depends on successful test execution + of crate given as the second argument. + + testCrateFlags: list of flags to pass to the test executable + testInputs: list of packages that should be available during test execution + */ + crateWithTest = { crate, testCrate, testCrateFlags, testInputs, testPreRun, testPostRun }: + assert builtins.typeOf testCrateFlags == "list"; + assert builtins.typeOf testInputs == "list"; + assert builtins.typeOf testPreRun == "string"; + assert builtins.typeOf testPostRun == "string"; + let + # override the `crate` so that it will build and execute tests instead of + # building the actual lib and bin targets We just have to pass `--test` + # to rustc and it will do the right thing. We execute the tests and copy + # their log and the test executables to $out for later inspection. + test = + let + drv = testCrate.override + ( + _: { + buildTests = true; + } + ); + # If the user hasn't set any pre/post commands, we don't want to + # insert empty lines. This means that any existing users of crate2nix + # don't get a spurious rebuild unless they set these explicitly. + testCommand = pkgs.lib.concatStringsSep "\n" + (pkgs.lib.filter (s: s != "") [ + testPreRun + "$f $testCrateFlags 2>&1 | tee -a $out" + testPostRun + ]); + in + pkgs.runCommand "run-tests-${testCrate.name}" + { + inherit testCrateFlags; + buildInputs = testInputs; + } '' + set -ex + + export RUST_BACKTRACE=1 + + # recreate a file hierarchy as when running tests with cargo + + # the source for test data + ${pkgs.xorg.lndir}/bin/lndir ${crate.src} + + # build outputs + testRoot=target/debug + mkdir -p $testRoot + + # executables of the crate + # we copy to prevent std::env::current_exe() to resolve to a store location + for i in ${crate}/bin/*; do + cp "$i" "$testRoot" + done + chmod +w -R . + + # test harness executables are suffixed with a hash, like cargo does + # this allows to prevent name collision with the main + # executables of the crate + hash=$(basename $out) + for file in ${drv}/tests/*; do + f=$testRoot/$(basename $file)-$hash + cp $file $f + ${testCommand} + done + ''; + in + pkgs.runCommand "${crate.name}-linked" + { + inherit (crate) outputs crateName; + passthru = (crate.passthru or { }) // { + inherit test; + }; + } '' + echo tested by ${test} + ${lib.concatMapStringsSep "\n" (output: "ln -s ${crate.${output}} ${"$"}${output}") crate.outputs} + ''; + + /* A restricted overridable version of builtRustCratesWithFeatures. */ + buildRustCrateWithFeatures = + { packageId + , features ? rootFeatures + , crateOverrides ? defaultCrateOverrides + , buildRustCrateForPkgsFunc ? null + , runTests ? false + , testCrateFlags ? [ ] + , testInputs ? [ ] + # Any command to run immediatelly before a test is executed. + , testPreRun ? "" + # Any command run immediatelly after a test is executed. + , testPostRun ? "" + }: + lib.makeOverridable + ( + { features + , crateOverrides + , runTests + , testCrateFlags + , testInputs + , testPreRun + , testPostRun + }: + let + buildRustCrateForPkgsFuncOverriden = + if buildRustCrateForPkgsFunc != null + then buildRustCrateForPkgsFunc + else + ( + if crateOverrides == pkgs.defaultCrateOverrides + then buildRustCrateForPkgs + else + pkgs: (buildRustCrateForPkgs pkgs).override { + defaultCrateOverrides = crateOverrides; + } + ); + builtRustCrates = builtRustCratesWithFeatures { + inherit packageId features; + buildRustCrateForPkgsFunc = buildRustCrateForPkgsFuncOverriden; + runTests = false; + }; + builtTestRustCrates = builtRustCratesWithFeatures { + inherit packageId features; + buildRustCrateForPkgsFunc = buildRustCrateForPkgsFuncOverriden; + runTests = true; + }; + drv = builtRustCrates.crates.${packageId}; + testDrv = builtTestRustCrates.crates.${packageId}; + derivation = + if runTests then + crateWithTest + { + crate = drv; + testCrate = testDrv; + inherit testCrateFlags testInputs testPreRun testPostRun; + } + else drv; + in + derivation + ) + { inherit features crateOverrides runTests testCrateFlags testInputs testPreRun testPostRun; }; + + /* Returns an attr set with packageId mapped to the result of buildRustCrateForPkgsFunc + for the corresponding crate. + */ + builtRustCratesWithFeatures = + { packageId + , features + , crateConfigs ? crates + , buildRustCrateForPkgsFunc + , runTests + , target ? defaultTarget + } @ args: + assert (builtins.isAttrs crateConfigs); + assert (builtins.isString packageId); + assert (builtins.isList features); + assert (builtins.isAttrs target); + assert (builtins.isBool runTests); + let + rootPackageId = packageId; + mergedFeatures = mergePackageFeatures + ( + args // { + inherit rootPackageId; + target = target // { test = runTests; }; + } + ); + # Memoize built packages so that reappearing packages are only built once. + builtByPackageIdByPkgs = mkBuiltByPackageIdByPkgs pkgs; + mkBuiltByPackageIdByPkgs = pkgs: + let + self = { + crates = lib.mapAttrs (packageId: value: buildByPackageIdForPkgsImpl self pkgs packageId) crateConfigs; + build = mkBuiltByPackageIdByPkgs pkgs.buildPackages; + }; + in + self; + buildByPackageIdForPkgsImpl = self: pkgs: packageId: + let + features = mergedFeatures."${packageId}" or [ ]; + crateConfig' = crateConfigs."${packageId}"; + crateConfig = + builtins.removeAttrs crateConfig' [ "resolvedDefaultFeatures" "devDependencies" ]; + devDependencies = + lib.optionals + (runTests && packageId == rootPackageId) + (crateConfig'.devDependencies or [ ]); + dependencies = + dependencyDerivations { + inherit features target; + buildByPackageId = depPackageId: + # proc_macro crates must be compiled for the build architecture + if crateConfigs.${depPackageId}.procMacro or false + then self.build.crates.${depPackageId} + else self.crates.${depPackageId}; + dependencies = + (crateConfig.dependencies or [ ]) + ++ devDependencies; + }; + buildDependencies = + dependencyDerivations { + inherit features target; + buildByPackageId = depPackageId: + self.build.crates.${depPackageId}; + dependencies = crateConfig.buildDependencies or [ ]; + }; + filterEnabledDependenciesForThis = dependencies: filterEnabledDependencies { + inherit dependencies features target; + }; + dependenciesWithRenames = + lib.filter (d: d ? "rename") + ( + filterEnabledDependenciesForThis + ( + (crateConfig.buildDependencies or [ ]) + ++ (crateConfig.dependencies or [ ]) + ++ devDependencies + ) + ); + # Crate renames have the form: + # + # { + # crate_name = [ + # { version = "1.2.3"; rename = "crate_name01"; } + # ]; + # # ... + # } + crateRenames = + let + grouped = + lib.groupBy + (dependency: dependency.name) + dependenciesWithRenames; + versionAndRename = dep: + let + package = crateConfigs."${dep.packageId}"; + in + { inherit (dep) rename; version = package.version; }; + in + lib.mapAttrs (name: choices: builtins.map versionAndRename choices) grouped; + in + buildRustCrateForPkgsFunc pkgs + ( + crateConfig // { + src = crateConfig.src or ( + pkgs.fetchurl rec { + name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz"; + # https://www.pietroalbini.org/blog/downloading-crates-io/ + # Not rate-limited, CDN URL. + url = "https://static.crates.io/crates/${crateConfig.crateName}/${crateConfig.crateName}-${crateConfig.version}.crate"; + sha256 = + assert (lib.assertMsg (crateConfig ? sha256) "Missing sha256 for ${name}"); + crateConfig.sha256; + } + ); + extraRustcOpts = lib.lists.optional (targetFeatures != [ ]) "-C target-feature=${lib.concatMapStringsSep "," (x: "+${x}") targetFeatures}"; + inherit features dependencies buildDependencies crateRenames release; + } + ); + in + builtByPackageIdByPkgs; + + /* Returns the actual derivations for the given dependencies. */ + dependencyDerivations = + { buildByPackageId + , features + , dependencies + , target + }: + assert (builtins.isList features); + assert (builtins.isList dependencies); + assert (builtins.isAttrs target); + let + enabledDependencies = filterEnabledDependencies { + inherit dependencies features target; + }; + depDerivation = dependency: buildByPackageId dependency.packageId; + in + map depDerivation enabledDependencies; + + /* Returns a sanitized version of val with all values substituted that cannot + be serialized as JSON. + */ + sanitizeForJson = val: + if builtins.isAttrs val + then lib.mapAttrs (n: v: sanitizeForJson v) val + else if builtins.isList val + then builtins.map sanitizeForJson val + else if builtins.isFunction val + then "function" + else val; + + /* Returns various tools to debug a crate. */ + debugCrate = { packageId, target ? defaultTarget }: + assert (builtins.isString packageId); + let + debug = rec { + # The built tree as passed to buildRustCrate. + buildTree = buildRustCrateWithFeatures { + buildRustCrateForPkgsFunc = _: lib.id; + inherit packageId; + }; + sanitizedBuildTree = sanitizeForJson buildTree; + dependencyTree = sanitizeForJson + ( + buildRustCrateWithFeatures { + buildRustCrateForPkgsFunc = _: crate: { + "01_crateName" = crate.crateName or false; + "02_features" = crate.features or [ ]; + "03_dependencies" = crate.dependencies or [ ]; + }; + inherit packageId; + } + ); + mergedPackageFeatures = mergePackageFeatures { + features = rootFeatures; + inherit packageId target; + }; + diffedDefaultPackageFeatures = diffDefaultPackageFeatures { + inherit packageId target; + }; + }; + in + { internal = debug; }; + + /* Returns differences between cargo default features and crate2nix default + features. + + This is useful for verifying the feature resolution in crate2nix. + */ + diffDefaultPackageFeatures = + { crateConfigs ? crates + , packageId + , target + }: + assert (builtins.isAttrs crateConfigs); + let + prefixValues = prefix: lib.mapAttrs (n: v: { "${prefix}" = v; }); + mergedFeatures = + prefixValues + "crate2nix" + (mergePackageFeatures { inherit crateConfigs packageId target; features = [ "default" ]; }); + configs = prefixValues "cargo" crateConfigs; + combined = lib.foldAttrs (a: b: a // b) { } [ mergedFeatures configs ]; + onlyInCargo = + builtins.attrNames + (lib.filterAttrs (n: v: !(v ? "crate2nix") && (v ? "cargo")) combined); + onlyInCrate2Nix = + builtins.attrNames + (lib.filterAttrs (n: v: (v ? "crate2nix") && !(v ? "cargo")) combined); + differentFeatures = lib.filterAttrs + ( + n: v: + (v ? "crate2nix") + && (v ? "cargo") + && (v.crate2nix.features or [ ]) != (v."cargo".resolved_default_features or [ ]) + ) + combined; + in + builtins.toJSON { + inherit onlyInCargo onlyInCrate2Nix differentFeatures; + }; + + /* Returns an attrset mapping packageId to the list of enabled features. + + If multiple paths to a dependency enable different features, the + corresponding feature sets are merged. Features in rust are additive. + */ + mergePackageFeatures = + { crateConfigs ? crates + , packageId + , rootPackageId ? packageId + , features ? rootFeatures + , dependencyPath ? [ crates.${packageId}.crateName ] + , featuresByPackageId ? { } + , target + # Adds devDependencies to the crate with rootPackageId. + , runTests ? false + , ... + } @ args: + assert (builtins.isAttrs crateConfigs); + assert (builtins.isString packageId); + assert (builtins.isString rootPackageId); + assert (builtins.isList features); + assert (builtins.isList dependencyPath); + assert (builtins.isAttrs featuresByPackageId); + assert (builtins.isAttrs target); + assert (builtins.isBool runTests); + let + crateConfig = crateConfigs."${packageId}" or (builtins.throw "Package not found: ${packageId}"); + expandedFeatures = expandFeatures (crateConfig.features or { }) features; + enabledFeatures = enableFeatures (crateConfig.dependencies or [ ]) expandedFeatures; + depWithResolvedFeatures = dependency: + let + packageId = dependency.packageId; + features = dependencyFeatures enabledFeatures dependency; + in + { inherit packageId features; }; + resolveDependencies = cache: path: dependencies: + assert (builtins.isAttrs cache); + assert (builtins.isList dependencies); + let + enabledDependencies = filterEnabledDependencies { + inherit dependencies target; + features = enabledFeatures; + }; + directDependencies = map depWithResolvedFeatures enabledDependencies; + foldOverCache = op: lib.foldl op cache directDependencies; + in + foldOverCache + ( + cache: { packageId, features }: + let + cacheFeatures = cache.${packageId} or [ ]; + combinedFeatures = sortedUnique (cacheFeatures ++ features); + in + if cache ? ${packageId} && cache.${packageId} == combinedFeatures + then cache + else + mergePackageFeatures { + features = combinedFeatures; + featuresByPackageId = cache; + inherit crateConfigs packageId target runTests rootPackageId; + } + ); + cacheWithSelf = + let + cacheFeatures = featuresByPackageId.${packageId} or [ ]; + combinedFeatures = sortedUnique (cacheFeatures ++ enabledFeatures); + in + featuresByPackageId // { + "${packageId}" = combinedFeatures; + }; + cacheWithDependencies = + resolveDependencies cacheWithSelf "dep" + ( + crateConfig.dependencies or [ ] + ++ lib.optionals + (runTests && packageId == rootPackageId) + (crateConfig.devDependencies or [ ]) + ); + cacheWithAll = + resolveDependencies + cacheWithDependencies "build" + (crateConfig.buildDependencies or [ ]); + in + cacheWithAll; + + /* Returns the enabled dependencies given the enabled features. */ + filterEnabledDependencies = { dependencies, features, target }: + assert (builtins.isList dependencies); + assert (builtins.isList features); + assert (builtins.isAttrs target); + + lib.filter + ( + dep: + let + targetFunc = dep.target or (features: true); + in + targetFunc { inherit features target; } + && ( + !(dep.optional or false) + || builtins.any (doesFeatureEnableDependency dep) features + ) + ) + dependencies; + + /* Returns whether the given feature should enable the given dependency. */ + doesFeatureEnableDependency = dependency: feature: + let + name = dependency.rename or dependency.name; + prefix = "${name}/"; + len = builtins.stringLength prefix; + startsWithPrefix = builtins.substring 0 len feature == prefix; + in + feature == name || startsWithPrefix; + + /* Returns the expanded features for the given inputFeatures by applying the + rules in featureMap. + + featureMap is an attribute set which maps feature names to lists of further + feature names to enable in case this feature is selected. + */ + expandFeatures = featureMap: inputFeatures: + assert (builtins.isAttrs featureMap); + assert (builtins.isList inputFeatures); + let + expandFeature = feature: + assert (builtins.isString feature); + [ feature ] ++ (expandFeatures featureMap (featureMap."${feature}" or [ ])); + outFeatures = lib.concatMap expandFeature inputFeatures; + in + sortedUnique outFeatures; + + /* This function adds optional dependencies as features if they are enabled + indirectly by dependency features. This function mimics Cargo's behavior + described in a note at: + https://doc.rust-lang.org/nightly/cargo/reference/features.html#dependency-features + */ + enableFeatures = dependencies: features: + assert (builtins.isList features); + assert (builtins.isList dependencies); + let + additionalFeatures = lib.concatMap + ( + dependency: + assert (builtins.isAttrs dependency); + let + enabled = builtins.any (doesFeatureEnableDependency dependency) features; + in + if (dependency.optional or false) && enabled + then [ (dependency.rename or dependency.name) ] + else [ ] + ) + dependencies; + in + sortedUnique (features ++ additionalFeatures); + + /* + Returns the actual features for the given dependency. + + features: The features of the crate that refers this dependency. + */ + dependencyFeatures = features: dependency: + assert (builtins.isList features); + assert (builtins.isAttrs dependency); + let + defaultOrNil = + if dependency.usesDefaultFeatures or true + then [ "default" ] + else [ ]; + explicitFeatures = dependency.features or [ ]; + additionalDependencyFeatures = + let + dependencyPrefix = (dependency.rename or dependency.name) + "/"; + dependencyFeatures = + builtins.filter (f: lib.hasPrefix dependencyPrefix f) features; + in + builtins.map (lib.removePrefix dependencyPrefix) dependencyFeatures; + in + defaultOrNil ++ explicitFeatures ++ additionalDependencyFeatures; + + /* Sorts and removes duplicates from a list of strings. */ + sortedUnique = features: + assert (builtins.isList features); + assert (builtins.all builtins.isString features); + let + outFeaturesSet = lib.foldl (set: feature: set // { "${feature}" = 1; }) { } features; + outFeaturesUnique = builtins.attrNames outFeaturesSet; + in + builtins.sort (a: b: a < b) outFeaturesUnique; + + deprecationWarning = message: value: + if strictDeprecation + then builtins.throw "strictDeprecation enabled, aborting: ${message}" + else builtins.trace message value; + + # + # crate2nix/default.nix (excerpt end) + # + }; +} + diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix b/nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix new file mode 100644 index 000000000000..847e3580575b --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix @@ -0,0 +1,175 @@ +{ lib +, importCargoLock +, fetchCargoTarball +, stdenv +, callPackage +, cargoBuildHook +, cargoCheckHook +, cargoInstallHook +, cargoNextestHook +, cargoSetupHook +, cargo +, cargo-auditable +, buildPackages +, rustc +, libiconv +, windows +}: + +let + buildRustPackage = + { name ? "${args.pname}-${args.version}" + + # Name for the vendored dependencies tarball + , cargoDepsName ? name + + , src ? null + , srcs ? null + , preUnpack ? null + , unpackPhase ? null + , postUnpack ? null + , cargoPatches ? [] + , patches ? [] + , sourceRoot ? null + , logLevel ? "" + , buildInputs ? [] + , nativeBuildInputs ? [] + , cargoUpdateHook ? "" + , cargoDepsHook ? "" + , buildType ? "release" + , meta ? {} + , cargoLock ? null + , cargoVendorDir ? null + , checkType ? buildType + , buildNoDefaultFeatures ? false + , checkNoDefaultFeatures ? buildNoDefaultFeatures + , buildFeatures ? [ ] + , checkFeatures ? buildFeatures + , useNextest ? false + # Enable except on aarch64 pkgsStatic, where we use lld for reasons + , auditable ? !cargo-auditable.meta.broken && !(stdenv.hostPlatform.isStatic && stdenv.hostPlatform.isAarch64 && !stdenv.hostPlatform.isDarwin) + + , depsExtraArgs ? {} + + # Toggles whether a custom sysroot is created when the target is a .json file. + , __internal_dontAddSysroot ? false + + # Needed to `pushd`/`popd` into a subdir of a tarball if this subdir + # contains a Cargo.toml, but isn't part of a workspace (which is e.g. the + # case for `rustfmt`/etc from the `rust-sources). + # Otherwise, everything from the tarball would've been built/tested. + , buildAndTestSubdir ? null + , ... } @ args: + + assert cargoVendorDir == null && cargoLock == null + -> !(args ? cargoSha256 && args.cargoSha256 != null) && !(args ? cargoHash && args.cargoHash != null) + -> throw "cargoSha256, cargoHash, cargoVendorDir, or cargoLock must be set"; + + let + + cargoDeps = + if cargoVendorDir != null then null + else if cargoLock != null then importCargoLock cargoLock + else fetchCargoTarball ({ + inherit src srcs sourceRoot preUnpack unpackPhase postUnpack cargoUpdateHook; + name = cargoDepsName; + patches = cargoPatches; + } // lib.optionalAttrs (args ? cargoHash) { + hash = args.cargoHash; + } // lib.optionalAttrs (args ? cargoSha256) { + sha256 = args.cargoSha256; + } // depsExtraArgs); + + target = stdenv.hostPlatform.rust.rustcTargetSpec; + targetIsJSON = lib.hasSuffix ".json" target; + useSysroot = targetIsJSON && !__internal_dontAddSysroot; + + sysroot = callPackage ./sysroot { } { + inherit target; + shortTarget = stdenv.hostPlatform.rust.cargoShortTarget; + RUSTFLAGS = args.RUSTFLAGS or ""; + originalCargoToml = src + /Cargo.toml; # profile info is later extracted + }; + + in + + # Tests don't currently work for `no_std`, and all custom sysroots are currently built without `std`. + # See https://os.phil-opp.com/testing/ for more information. + assert useSysroot -> !(args.doCheck or true); + + stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "cargoLock" ]) // lib.optionalAttrs useSysroot { + RUSTFLAGS = "--sysroot ${sysroot} " + (args.RUSTFLAGS or ""); + } // { + inherit buildAndTestSubdir cargoDeps; + + cargoBuildType = buildType; + + cargoCheckType = checkType; + + cargoBuildNoDefaultFeatures = buildNoDefaultFeatures; + + cargoCheckNoDefaultFeatures = checkNoDefaultFeatures; + + cargoBuildFeatures = buildFeatures; + + cargoCheckFeatures = checkFeatures; + + patchRegistryDeps = ./patch-registry-deps; + + nativeBuildInputs = nativeBuildInputs ++ lib.optionals auditable [ + (buildPackages.cargo-auditable-cargo-wrapper.override { + inherit cargo cargo-auditable; + }) + ] ++ [ + cargoBuildHook + (if useNextest then cargoNextestHook else cargoCheckHook) + cargoInstallHook + cargoSetupHook + rustc + ]; + + buildInputs = buildInputs + ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ] + ++ lib.optionals stdenv.hostPlatform.isMinGW [ windows.pthreads ]; + + patches = cargoPatches ++ patches; + + PKG_CONFIG_ALLOW_CROSS = + if stdenv.buildPlatform != stdenv.hostPlatform then 1 else 0; + + postUnpack = '' + eval "$cargoDepsHook" + + export RUST_LOG=${logLevel} + '' + (args.postUnpack or ""); + + configurePhase = args.configurePhase or '' + runHook preConfigure + runHook postConfigure + ''; + + doCheck = args.doCheck or true; + + strictDeps = true; + + meta = { + # default to Rust's platforms + platforms = rustc.meta.platforms ++ [ + # Platforms without host tools from + # https://doc.rust-lang.org/nightly/rustc/platform-support.html + "armv7a-darwin" + "armv5tel-linux" "armv7a-linux" "m68k-linux" "mips-linux" + "mips64-linux" "mipsel-linux" "mips64el-linux" "riscv32-linux" + "armv6l-netbsd" "mipsel-netbsd" "riscv64-netbsd" + "x86_64-redox" + "wasm32-wasi" + ]; + badPlatforms = [ + # Rust is currently unable to target the n32 ABI + lib.systems.inspect.patterns.isMips64n32 + ]; + } // meta; + }) // { + overrideRustAttrs = f: buildRustPackage (args // (f args)); + }; +in buildRustPackage diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-package/patch-registry-deps/pkg-config b/nixpkgs/pkgs/build-support/rust/build-rust-package/patch-registry-deps/pkg-config new file mode 100644 index 000000000000..fbb094304587 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-package/patch-registry-deps/pkg-config @@ -0,0 +1,8 @@ +for dir in pkg-config-*; do + [ -d "$dir" ] || continue + + echo "Patching pkg-config registry dep" + + substituteInPlace "$dir/src/lib.rs" \ + --replace '"/usr"' '"'"$NIX_STORE"'/"' +done diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-package/sysroot/default.nix b/nixpkgs/pkgs/build-support/rust/build-rust-package/sysroot/default.nix new file mode 100644 index 000000000000..bb95b7bdc35c --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/build-rust-package/sysroot/default.nix @@ -0,0 +1,35 @@ +{ lib, stdenv, rustPlatform, buildPackages }: + +{ shortTarget, originalCargoToml, target, RUSTFLAGS }: + +let + cargoSrc = import ../../sysroot/src.nix { + inherit lib stdenv rustPlatform buildPackages originalCargoToml; + }; +in rustPlatform.buildRustPackage { + inherit target RUSTFLAGS; + + name = "custom-sysroot"; + src = cargoSrc; + + RUSTC_BOOTSTRAP = 1; + __internal_dontAddSysroot = true; + cargoSha256 = "sha256-zgkwevitxsu1C4OgGTsqNSc0gDxaNXYK1WPbfER48d0="; + + doCheck = false; + + installPhase = '' + export LIBS_DIR=$out/lib/rustlib/${shortTarget}/lib + mkdir -p $LIBS_DIR + for f in target/${shortTarget}/release/deps/*.{rlib,rmeta}; do + cp $f $LIBS_DIR + done + + export RUST_SYSROOT=$(rustc --print=sysroot) + host=${stdenv.buildPlatform.rust.rustcTarget} + cp -r $RUST_SYSROOT/lib/rustlib/$host $out + ''; + + # allows support for cross-compilation + meta.platforms = lib.platforms.all; +} diff --git a/nixpkgs/pkgs/build-support/rust/default-crate-overrides.nix b/nixpkgs/pkgs/build-support/rust/default-crate-overrides.nix new file mode 100644 index 000000000000..92c71dfc059c --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/default-crate-overrides.nix @@ -0,0 +1,311 @@ +{ lib +, stdenv +, atk +, pkg-config +, curl +, darwin +, libgit2 +, gtk3 +, libssh2 +, openssl +, sqlite +, zlib +, dbus +, dbus-glib +, gdk-pixbuf +, cairo +, python3 +, libsodium +, postgresql +, gmp +, gobject-introspection +, foundationdb +, capnproto +, nettle +, gtk4 +, clang +, llvmPackages +, linux-pam +, pango +, cmake +, glib +, freetype +, fontconfig +, rdkafka +, udev +, libevdev +, alsa-lib +, graphene +, protobuf +, autoconf +, automake +, libtool +, seatd # =libseat +, ... +}: + +let + inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; +in +{ + alsa-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ alsa-lib ]; + }; + + cairo-rs = attrs: { + buildInputs = [ cairo ]; + }; + + cairo-sys-rs = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ cairo ]; + }; + + capnp-rpc = attrs: { + nativeBuildInputs = [ capnproto ]; + }; + + cargo = attrs: { + buildInputs = [ openssl zlib curl ] + ++ lib.optionals stdenv.isDarwin [ CoreFoundation Security ]; + }; + + libz-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ zlib ]; + extraLinkFlags = [ "-L${zlib.out}/lib" ]; + }; + + curl-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ zlib curl ]; + propagatedBuildInputs = [ curl zlib ]; + extraLinkFlags = [ "-L${zlib.out}/lib" ]; + }; + + dbus = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ dbus ]; + }; + + evdev-sys = attrs: { + nativeBuildInputs = [ + pkg-config + ] ++ lib.optionals (stdenv.buildPlatform.config != stdenv.hostPlatform.config) [ + python3 autoconf automake libtool + ]; + buildInputs = [ libevdev ]; + + # This prevents libevdev's build.rs from trying to `git fetch` when HOST!=TARGET + prePatch = '' + touch libevdev/.git + ''; + }; + + expat-sys = attrs: { + nativeBuildInputs = [ cmake ]; + }; + + foundationdb-sys = attrs: { + buildInputs = [ foundationdb ]; + # needed for 0.4+ release, when the FFI bindings are auto-generated + # + # patchPhase = '' + # substituteInPlace ./foundationdb-sys/build.rs \ + # --replace /usr/local/include ${foundationdb.dev}/include + # ''; + }; + + foundationdb = attrs: { + buildInputs = [ foundationdb ]; + }; + + freetype-sys = attrs: { + nativeBuildInputs = [ cmake ]; + buildInputs = [ freetype ]; + }; + + glib-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ glib ]; + }; + + gobject-sys = attrs: { + buildInputs = [ dbus-glib ]; + }; + + gio-sys = attrs: { + buildInputs = [ dbus-glib ]; + }; + + gdk-pixbuf-sys = attrs: { + buildInputs = [ dbus-glib ]; + }; + + gdk-pixbuf = attrs: { + buildInputs = [ gdk-pixbuf ]; + }; + + gtk-sys = attrs: { + buildInputs = [ gtk3 ]; + nativeBuildInputs = [ pkg-config ]; + }; + + gtk4-sys = attrs: { + buildInputs = [ gtk4 ]; + nativeBuildInputs = [ pkg-config ]; + }; + + gdk4-sys = attrs: { + buildInputs = [ gtk4 ]; + nativeBuildInputs = [ pkg-config ]; + }; + + gsk4-sys = attrs: { + buildInputs = [ gtk4 ]; + nativeBuildInputs = [ pkg-config ]; + }; + + libgit2-sys = attrs: { + LIBGIT2_SYS_USE_PKG_CONFIG = true; + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ openssl zlib libgit2 ]; + }; + + libseat-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ seatd ]; + }; + + libsqlite3-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ sqlite ]; + }; + + libssh2-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ openssl zlib libssh2 ]; + }; + + libdbus-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ dbus ]; + }; + + libudev-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ udev ]; + }; + + graphene-sys = attrs: { + nativeBuildInputs = [ pkg-config gobject-introspection ]; + buildInputs = [ graphene ]; + }; + + nettle-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ nettle clang ]; + LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; + }; + + openssl = attrs: { + buildInputs = [ openssl ]; + }; + + openssl-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ openssl ]; + }; + + pam-sys = attr: { + buildInputs = [ linux-pam ]; + }; + + pango-sys = attr: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ pango ]; + }; + + pq-sys = attr: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ postgresql ]; + }; + + prost-build = attr: { + nativeBuildInputs = [ protobuf ]; + }; + + rdkafka-sys = attr: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ rdkafka ]; + }; + + rink = attrs: { + buildInputs = [ gmp ]; + crateBin = [{ name = "rink"; path = "src/bin/rink.rs"; }]; + }; + + security-framework-sys = attr: { + propagatedBuildInputs = lib.optional stdenv.isDarwin Security; + }; + + sequoia-openpgp = attrs: { + buildInputs = [ gmp ]; + }; + + sequoia-openpgp-ffi = attrs: { + buildInputs = [ gmp ]; + }; + + sequoia-ipc = attrs: { + buildInputs = [ gmp ]; + }; + + sequoia-guide = attrs: { + buildInputs = [ gmp ]; + }; + + pangocairo-sys = attr: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ pango ]; + }; + + sequoia-store = attrs: { + nativeBuildInputs = [ capnproto ]; + buildInputs = [ sqlite gmp ]; + }; + + sequoia-sq = attrs: { + buildInputs = [ sqlite gmp ]; + }; + + sequoia-tool = attrs: { + nativeBuildInputs = [ capnproto ]; + buildInputs = [ sqlite gmp ]; + }; + + serde_derive = attrs: { + buildInputs = lib.optional stdenv.isDarwin Security; + }; + + servo-fontconfig-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ freetype fontconfig ]; + }; + + thrussh-libsodium = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ libsodium ]; + }; + + xcb = attrs: { + buildInputs = [ python3 ]; + }; + + atk-sys = attrs: { + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ atk ]; + }; + +} diff --git a/nixpkgs/pkgs/build-support/rust/fetch-cargo-tarball/cargo-vendor-normalise.py b/nixpkgs/pkgs/build-support/rust/fetch-cargo-tarball/cargo-vendor-normalise.py new file mode 100755 index 000000000000..90933b089c92 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/fetch-cargo-tarball/cargo-vendor-normalise.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +import sys + +import toml + + +def quote(s: str) -> str: + escaped = s.replace('"', r"\"").replace("\n", r"\n").replace("\\", "\\\\") + return '"{}"'.format(escaped) + + +def main() -> None: + data = toml.load(sys.stdin) + + # There is no dependency to vendor in this project. + if not list(data.keys()) == ["source"]: + return + + # this value is non deterministic + data["source"]["vendored-sources"]["directory"] = "@vendor@" + + lines = [] + inner = data["source"] + for source, attrs in sorted(inner.items()): + lines.append("[source.{}]".format(quote(source))) + if source == "vendored-sources": + lines.append('"directory" = "@vendor@"\n') + else: + for key, value in sorted(attrs.items()): + attr = "{} = {}".format(quote(key), quote(value)) + lines.append(attr) + lines.append("") + + result = "\n".join(lines) + real = toml.loads(result) + assert real == data, "output = {} while input = {}".format(real, data) + + print(result) + + +if __name__ == "__main__": + main() diff --git a/nixpkgs/pkgs/build-support/rust/fetch-cargo-tarball/default.nix b/nixpkgs/pkgs/build-support/rust/fetch-cargo-tarball/default.nix new file mode 100644 index 000000000000..adbfe98d8103 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/fetch-cargo-tarball/default.nix @@ -0,0 +1,116 @@ +{ lib, stdenv, cacert, git, cargo, python3 }: +let cargo-vendor-normalise = stdenv.mkDerivation { + name = "cargo-vendor-normalise"; + src = ./cargo-vendor-normalise.py; + nativeBuildInputs = [ python3.pkgs.wrapPython ]; + dontUnpack = true; + installPhase = "install -D $src $out/bin/cargo-vendor-normalise"; + pythonPath = [ python3.pkgs.toml ]; + postFixup = "wrapPythonPrograms"; + doInstallCheck = true; + installCheckPhase = '' + # check that ../fetchcargo-default-config.toml is a fix point + reference=${../fetchcargo-default-config.toml} + < $reference $out/bin/cargo-vendor-normalise > test; + cmp test $reference + ''; + preferLocalBuild = true; +}; +in +{ name ? "cargo-deps" +, src ? null +, srcs ? [] +, patches ? [] +, sourceRoot ? "" +, cargoUpdateHook ? "" +, nativeBuildInputs ? [] +, ... +} @ args: + +let hash_ = + if args ? hash then + { + outputHashAlgo = if args.hash == "" then "sha256" else null; + outputHash = args.hash; + } + else if args ? sha256 then { outputHashAlgo = "sha256"; outputHash = args.sha256; } + else throw "fetchCargoTarball requires a hash for ${name}"; +in stdenv.mkDerivation ({ + name = "${name}-vendor.tar.gz"; + nativeBuildInputs = [ cacert git cargo-vendor-normalise cargo ] ++ nativeBuildInputs; + + buildPhase = '' + runHook preBuild + + # Ensure deterministic Cargo vendor builds + export SOURCE_DATE_EPOCH=1 + + if [[ ! -f Cargo.lock ]]; then + echo + echo "ERROR: The Cargo.lock file doesn't exist" + echo + echo "Cargo.lock is needed to make sure that cargoHash/cargoSha256 doesn't change" + echo "when the registry is updated." + echo + + exit 1 + fi + + # Keep the original around for copyLockfile + cp Cargo.lock Cargo.lock.orig + + export CARGO_HOME=$(mktemp -d cargo-home.XXX) + CARGO_CONFIG=$(mktemp cargo-config.XXXX) + + if [[ -n "$NIX_CRATES_INDEX" ]]; then + cat >$CARGO_HOME/config.toml <<EOF + [source.crates-io] + replace-with = 'mirror' + [source.mirror] + registry = "$NIX_CRATES_INDEX" + EOF + fi + + ${cargoUpdateHook} + + # Override the `http.cainfo` option usually specified in `.cargo/config`. + export CARGO_HTTP_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt + + if grep '^source = "git' Cargo.lock; then + echo + echo "ERROR: The Cargo.lock contains git dependencies" + echo + echo "This is currently not supported in the fixed-output derivation fetcher." + echo "Use cargoLock.lockFile / importCargoLock instead." + echo + + exit 1 + fi + + cargo vendor $name --respect-source-config | cargo-vendor-normalise > $CARGO_CONFIG + + # Create an empty vendor directory when there is no dependency to vendor + mkdir -p $name + # Add the Cargo.lock to allow hash invalidation + cp Cargo.lock.orig $name/Cargo.lock + + # Packages with git dependencies generate non-default cargo configs, so + # always install it rather than trying to write a standard default template. + install -D $CARGO_CONFIG $name/.cargo/config; + + runHook postBuild + ''; + + # Build a reproducible tar, per instructions at https://reproducible-builds.org/docs/archives/ + installPhase = '' + tar --owner=0 --group=0 --numeric-owner --format=gnu \ + --sort=name --mtime="@$SOURCE_DATE_EPOCH" \ + -czf $out $name + ''; + + inherit (hash_) outputHashAlgo outputHash; + + impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [ "NIX_CRATES_INDEX" ]; +} // (builtins.removeAttrs args [ + "name" "sha256" "cargoUpdateHook" "nativeBuildInputs" +])) diff --git a/nixpkgs/pkgs/build-support/rust/fetchcargo-default-config.toml b/nixpkgs/pkgs/build-support/rust/fetchcargo-default-config.toml new file mode 100755 index 000000000000..dd8ebbc32d31 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/fetchcargo-default-config.toml @@ -0,0 +1,7 @@ +[source."crates-io"] +"replace-with" = "vendored-sources" + +[source."vendored-sources"] +"directory" = "@vendor@" + + diff --git a/nixpkgs/pkgs/build-support/rust/fetchcrate.nix b/nixpkgs/pkgs/build-support/rust/fetchcrate.nix new file mode 100644 index 000000000000..423f4d786fde --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/fetchcrate.nix @@ -0,0 +1,20 @@ +{ lib, fetchzip, fetchurl }: + +{ crateName ? args.pname +, pname ? null + # The `dl` field of the registry's index configuration + # https://doc.rust-lang.org/cargo/reference/registry-index.html#index-configuration +, registryDl ? "https://crates.io/api/v1/crates" +, version +, unpack ? true +, ... +} @ args: + +assert pname == null || pname == crateName; + +(if unpack then fetchzip else fetchurl) ({ + name = "${crateName}-${version}.tar.gz"; + url = "${registryDl}/${crateName}/${version}/download"; +} // lib.optionalAttrs unpack { + extension = "tar.gz"; +} // removeAttrs args [ "crateName" "pname" "registryDl" "version" "unpack" ]) diff --git a/nixpkgs/pkgs/build-support/rust/hooks/cargo-build-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/cargo-build-hook.sh new file mode 100644 index 000000000000..26dde914f22a --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/hooks/cargo-build-hook.sh @@ -0,0 +1,60 @@ +declare -a cargoBuildFlags + +cargoBuildHook() { + echo "Executing cargoBuildHook" + + runHook preBuild + + # Let stdenv handle stripping, for consistency and to not break + # separateDebugInfo. + export "CARGO_PROFILE_${cargoBuildType@U}_STRIP"=false + + if [ ! -z "${buildAndTestSubdir-}" ]; then + # ensure the output doesn't end up in the subdirectory + export CARGO_TARGET_DIR="$(pwd)/target" + + pushd "${buildAndTestSubdir}" + fi + + if [ "${cargoBuildType}" != "debug" ]; then + cargoBuildProfileFlag="--profile ${cargoBuildType}" + fi + + if [ -n "${cargoBuildNoDefaultFeatures-}" ]; then + cargoBuildNoDefaultFeaturesFlag=--no-default-features + fi + + if [ -n "${cargoBuildFeatures-}" ]; then + if [ -n "$__structuredAttrs" ]; then + OLDIFS="$IFS" + IFS=','; cargoBuildFeaturesFlag="--features=${cargoBuildFeatures[*]}" + IFS="$OLDIFS" + unset OLDIFS + else + cargoBuildFeaturesFlag="--features=${cargoBuildFeatures// /,}" + fi + fi + + ( + set -x + @setEnv@ cargo build -j $NIX_BUILD_CORES \ + --target @rustHostPlatformSpec@ \ + --offline \ + ${cargoBuildProfileFlag} \ + ${cargoBuildNoDefaultFeaturesFlag} \ + ${cargoBuildFeaturesFlag} \ + ${cargoBuildFlags} + ) + + if [ ! -z "${buildAndTestSubdir-}" ]; then + popd + fi + + runHook postBuild + + echo "Finished cargoBuildHook" +} + +if [ -z "${dontCargoBuild-}" ] && [ -z "${buildPhase-}" ]; then + buildPhase=cargoBuildHook +fi diff --git a/nixpkgs/pkgs/build-support/rust/hooks/cargo-check-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/cargo-check-hook.sh new file mode 100644 index 000000000000..96b87dbf15b4 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/hooks/cargo-check-hook.sh @@ -0,0 +1,55 @@ +declare -a checkFlags +declare -a cargoTestFlags + +cargoCheckHook() { + echo "Executing cargoCheckHook" + + runHook preCheck + + if [[ -n "${buildAndTestSubdir-}" ]]; then + pushd "${buildAndTestSubdir}" + fi + + if [[ -z ${dontUseCargoParallelTests-} ]]; then + threads=$NIX_BUILD_CORES + else + threads=1 + fi + + if [ "${cargoCheckType}" != "debug" ]; then + cargoCheckProfileFlag="--profile ${cargoCheckType}" + fi + + if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then + cargoCheckNoDefaultFeaturesFlag=--no-default-features + fi + + if [ -n "${cargoCheckFeatures-}" ]; then + cargoCheckFeaturesFlag="--features=${cargoCheckFeatures// /,}" + fi + + argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag} + --target @rustHostPlatformSpec@ --offline ${cargoTestFlags}" + + ( + set -x + cargo test \ + -j $NIX_BUILD_CORES \ + ${argstr} -- \ + --test-threads=${threads} \ + ${checkFlags} \ + ${checkFlagsArray+"${checkFlagsArray[@]}"} + ) + + if [[ -n "${buildAndTestSubdir-}" ]]; then + popd + fi + + echo "Finished cargoCheckHook" + + runHook postCheck +} + +if [ -z "${dontCargoCheck-}" ] && [ -z "${checkPhase-}" ]; then + checkPhase=cargoCheckHook +fi diff --git a/nixpkgs/pkgs/build-support/rust/hooks/cargo-install-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/cargo-install-hook.sh new file mode 100644 index 000000000000..24a6e6fa9eb3 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/hooks/cargo-install-hook.sh @@ -0,0 +1,49 @@ +cargoInstallPostBuildHook() { + echo "Executing cargoInstallPostBuildHook" + + releaseDir=target/@targetSubdirectory@/$cargoBuildType + tmpDir="${releaseDir}-tmp"; + + mkdir -p $tmpDir + cp -r ${releaseDir}/* $tmpDir/ + bins=$(find $tmpDir \ + -maxdepth 1 \ + -type f \ + -executable ! \( -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \)) + + echo "Finished cargoInstallPostBuildHook" +} + +cargoInstallHook() { + echo "Executing cargoInstallHook" + + runHook preInstall + + # rename the output dir to a architecture independent one + + releaseDir=target/@targetSubdirectory@/$cargoBuildType + tmpDir="${releaseDir}-tmp"; + + mapfile -t targets < <(find "$NIX_BUILD_TOP" -type d | grep "${tmpDir}$") + for target in "${targets[@]}"; do + rm -rf "$target/../../${cargoBuildType}" + ln -srf "$target" "$target/../../" + done + mkdir -p $out/bin $out/lib + + xargs -r cp -t $out/bin <<< $bins + find $tmpDir \ + -maxdepth 1 \ + -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \ + -print0 | xargs -r -0 cp -t $out/lib + rmdir --ignore-fail-on-non-empty $out/lib $out/bin + runHook postInstall + + echo "Finished cargoInstallHook" +} + + +if [ -z "${dontCargoInstall-}" ] && [ -z "${installPhase-}" ]; then + installPhase=cargoInstallHook + postBuildHooks+=(cargoInstallPostBuildHook) +fi diff --git a/nixpkgs/pkgs/build-support/rust/hooks/cargo-nextest-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/cargo-nextest-hook.sh new file mode 100644 index 000000000000..16d32513a0d0 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/hooks/cargo-nextest-hook.sh @@ -0,0 +1,54 @@ +declare -a checkFlags +declare -a cargoTestFlags + +cargoNextestHook() { + echo "Executing cargoNextestHook" + + runHook preCheck + + if [[ -n "${buildAndTestSubdir-}" ]]; then + pushd "${buildAndTestSubdir}" + fi + + if [[ -z ${dontUseCargoParallelTests-} ]]; then + threads=$NIX_BUILD_CORES + else + threads=1 + fi + + if [ "${cargoCheckType}" != "debug" ]; then + cargoCheckProfileFlag="--cargo-profile ${cargoCheckType}" + fi + + if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then + cargoCheckNoDefaultFeaturesFlag=--no-default-features + fi + + if [ -n "${cargoCheckFeatures-}" ]; then + cargoCheckFeaturesFlag="--features=${cargoCheckFeatures// /,}" + fi + + argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag} + --target @rustHostPlatformSpec@ --offline ${cargoTestFlags}" + + ( + set -x + cargo nextest run \ + -j ${threads} \ + ${argstr} -- \ + ${checkFlags} \ + ${checkFlagsArray+"${checkFlagsArray[@]}"} + ) + + if [[ -n "${buildAndTestSubdir-}" ]]; then + popd + fi + + echo "Finished cargoNextestHook" + + runHook postCheck +} + +if [ -z "${dontCargoCheck-}" ] && [ -z "${checkPhase-}" ]; then + checkPhase=cargoNextestHook +fi diff --git a/nixpkgs/pkgs/build-support/rust/hooks/cargo-setup-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/cargo-setup-hook.sh new file mode 100644 index 000000000000..693c0b08759e --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/hooks/cargo-setup-hook.sh @@ -0,0 +1,93 @@ +cargoSetupPostUnpackHook() { + echo "Executing cargoSetupPostUnpackHook" + + # Some cargo builds include build hooks that modify their own vendor + # dependencies. This copies the vendor directory into the build tree and makes + # it writable. If we're using a tarball, the unpackFile hook already handles + # this for us automatically. + if [ -z $cargoVendorDir ]; then + if [ -d "$cargoDeps" ]; then + local dest=$(stripHash "$cargoDeps") + cp -Lr --reflink=auto -- "$cargoDeps" "$dest" + chmod -R +644 -- "$dest" + else + unpackFile "$cargoDeps" + fi + export cargoDepsCopy="$(realpath "$(stripHash $cargoDeps)")" + else + cargoDepsCopy="$(realpath "$(pwd)/$sourceRoot/${cargoRoot:+$cargoRoot/}${cargoVendorDir}")" + fi + + if [ ! -d .cargo ]; then + mkdir .cargo + fi + + config="$cargoDepsCopy/.cargo/config"; + if [[ ! -e $config ]]; then + config=@defaultConfig@ + fi; + + tmp_config=$(mktemp) + substitute $config $tmp_config \ + --subst-var-by vendor "$cargoDepsCopy" + cat ${tmp_config} >> .cargo/config + + cat >> .cargo/config <<'EOF' + @cargoConfig@ +EOF + + echo "Finished cargoSetupPostUnpackHook" +} + +# After unpacking and applying patches, check that the Cargo.lock matches our +# src package. Note that we do this after the patchPhase, because the +# patchPhase may create the Cargo.lock if upstream has not shipped one. +cargoSetupPostPatchHook() { + echo "Executing cargoSetupPostPatchHook" + + cargoDepsLockfile="$cargoDepsCopy/Cargo.lock" + srcLockfile="$(pwd)/${cargoRoot:+$cargoRoot/}Cargo.lock" + + echo "Validating consistency between $srcLockfile and $cargoDepsLockfile" + if ! @diff@ $srcLockfile $cargoDepsLockfile; then + + # If the diff failed, first double-check that the file exists, so we can + # give a friendlier error msg. + if ! [ -e $srcLockfile ]; then + echo "ERROR: Missing Cargo.lock from src. Expected to find it at: $srcLockfile" + echo "Hint: You can use the cargoPatches attribute to add a Cargo.lock manually to the build." + exit 1 + fi + + if ! [ -e $cargoDepsLockfile ]; then + echo "ERROR: Missing lockfile from cargo vendor. Expected to find it at: $cargoDepsLockfile" + exit 1 + fi + + echo + echo "ERROR: cargoHash or cargoSha256 is out of date" + echo + echo "Cargo.lock is not the same in $cargoDepsCopy" + echo + echo "To fix the issue:" + echo '1. Set cargoHash/cargoSha256 to an empty string: `cargoHash = "";`' + echo '2. Build the derivation and wait for it to fail with a hash mismatch' + echo '3. Copy the "got: sha256-..." value back into the cargoHash field' + echo ' You should have: cargoHash = "sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=";' + echo + + exit 1 + fi + + unset cargoDepsCopy + + echo "Finished cargoSetupPostPatchHook" +} + +if [ -z "${dontCargoSetupPostUnpack-}" ]; then + postUnpackHooks+=(cargoSetupPostUnpackHook) +fi + +if [ -z ${cargoVendorDir-} ]; then + postPatchHooks+=(cargoSetupPostPatchHook) +fi diff --git a/nixpkgs/pkgs/build-support/rust/hooks/default.nix b/nixpkgs/pkgs/build-support/rust/hooks/default.nix new file mode 100644 index 000000000000..874f23fe7ed3 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/hooks/default.nix @@ -0,0 +1,100 @@ +{ buildPackages +, callPackage +, cargo +, cargo-nextest +, clang +, lib +, makeSetupHook +, maturin +, rust +, rustc +, stdenv + +# This confusingly-named parameter indicates the *subdirectory of +# `target/` from which to copy the build artifacts. It is derived +# from a stdenv platform (or a JSON file). +, target ? stdenv.hostPlatform.rust.cargoShortTarget +}: + +{ + cargoBuildHook = callPackage ({ }: + makeSetupHook { + name = "cargo-build-hook.sh"; + propagatedBuildInputs = [ cargo ]; + substitutions = { + inherit (rust.envVars) rustHostPlatformSpec setEnv; + }; + } ./cargo-build-hook.sh) {}; + + cargoCheckHook = callPackage ({ }: + makeSetupHook { + name = "cargo-check-hook.sh"; + propagatedBuildInputs = [ cargo ]; + substitutions = { + inherit (rust.envVars) rustHostPlatformSpec; + }; + } ./cargo-check-hook.sh) {}; + + cargoInstallHook = callPackage ({ }: + makeSetupHook { + name = "cargo-install-hook.sh"; + propagatedBuildInputs = [ ]; + substitutions = { + targetSubdirectory = target; + }; + } ./cargo-install-hook.sh) {}; + + cargoNextestHook = callPackage ({ }: + makeSetupHook { + name = "cargo-nextest-hook.sh"; + propagatedBuildInputs = [ cargo cargo-nextest ]; + substitutions = { + inherit (rust.envVars) rustHostPlatformSpec; + }; + } ./cargo-nextest-hook.sh) {}; + + cargoSetupHook = callPackage ({ }: + makeSetupHook { + name = "cargo-setup-hook.sh"; + propagatedBuildInputs = [ ]; + substitutions = { + defaultConfig = ../fetchcargo-default-config.toml; + + # Specify the stdenv's `diff` by abspath to ensure that the user's build + # inputs do not cause us to find the wrong `diff`. + diff = "${lib.getBin buildPackages.diffutils}/bin/diff"; + + cargoConfig = '' + [target."${stdenv.buildPlatform.rust.rustcTarget}"] + "linker" = "${rust.envVars.linkerForBuild}" + ${lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) '' + [target."${stdenv.hostPlatform.rust.rustcTarget}"] + "linker" = "${rust.envVars.linkerForHost}" + ''} + "rustflags" = [ "-C", "target-feature=${if stdenv.hostPlatform.isStatic then "+" else "-"}crt-static" ] + ''; + }; + } ./cargo-setup-hook.sh) {}; + + maturinBuildHook = callPackage ({ pkgsHostTarget }: + makeSetupHook { + name = "maturin-build-hook.sh"; + propagatedBuildInputs = [ + pkgsHostTarget.maturin + pkgsHostTarget.cargo + pkgsHostTarget.rustc + ]; + substitutions = { + inherit (rust.envVars) rustTargetPlatformSpec setEnv; + }; + } ./maturin-build-hook.sh) {}; + + bindgenHook = callPackage ({}: makeSetupHook { + name = "rust-bindgen-hook"; + substitutions = { + libclang = clang.cc.lib; + inherit clang; + }; + } + ./rust-bindgen-hook.sh) {}; +} diff --git a/nixpkgs/pkgs/build-support/rust/hooks/maturin-build-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/maturin-build-hook.sh new file mode 100644 index 000000000000..b3cc1ced7964 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/hooks/maturin-build-hook.sh @@ -0,0 +1,36 @@ +maturinBuildHook() { + echo "Executing maturinBuildHook" + + runHook preBuild + + if [ ! -z "${buildAndTestSubdir-}" ]; then + pushd "${buildAndTestSubdir}" + fi + + ( + set -x + @setEnv@ maturin build \ + --jobs=$NIX_BUILD_CORES \ + --offline \ + --target @rustTargetPlatformSpec@ \ + --manylinux off \ + --strip \ + --release \ + ${maturinBuildFlags-} + ) + + if [ ! -z "${buildAndTestSubdir-}" ]; then + popd + fi + + # Move the wheel to dist/ so that regular Python tooling can find it. + mkdir -p dist + mv ${cargoRoot:+$cargoRoot/}target/wheels/*.whl dist/ + + # These are python build hooks and may depend on ./dist + runHook postBuild + + echo "Finished maturinBuildHook" +} + +buildPhase=maturinBuildHook diff --git a/nixpkgs/pkgs/build-support/rust/hooks/rust-bindgen-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/rust-bindgen-hook.sh new file mode 100644 index 000000000000..53624b124f2b --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/hooks/rust-bindgen-hook.sh @@ -0,0 +1,13 @@ +# populates LIBCLANG_PATH and BINDGEN_EXTRA_CLANG_ARGS for rust projects that +# depend on the bindgen crate + +# if you modify this, you probably also need to modify the wrapper for the cli +# of bindgen in pkgs/development/tools/rust/bindgen/wrapper.sh + +populateBindgenEnv () { + export LIBCLANG_PATH=@libclang@/lib + BINDGEN_EXTRA_CLANG_ARGS="$(< @clang@/nix-support/cc-cflags) $(< @clang@/nix-support/libc-cflags) $(< @clang@/nix-support/libcxx-cxxflags) $NIX_CFLAGS_COMPILE" + export BINDGEN_EXTRA_CLANG_ARGS +} + +postHook="${postHook:-}"$'\n'"populateBindgenEnv"$'\n' diff --git a/nixpkgs/pkgs/build-support/rust/import-cargo-lock.nix b/nixpkgs/pkgs/build-support/rust/import-cargo-lock.nix new file mode 100644 index 000000000000..e3fe57ef06da --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/import-cargo-lock.nix @@ -0,0 +1,262 @@ +{ fetchgit, fetchurl, lib, writers, python3Packages, runCommand, cargo, jq }: + +{ + # Cargo lock file + lockFile ? null + + # Cargo lock file contents as string +, lockFileContents ? null + + # Allow `builtins.fetchGit` to be used to not require hashes for git dependencies +, allowBuiltinFetchGit ? false + + # Additional registries to pull sources from + # { "https://<registry index URL>" = "https://<registry download URL>"; } + # where: + # - "index URL" is the "index" value of the configuration entry for that registry + # https://doc.rust-lang.org/cargo/reference/registries.html#using-an-alternate-registry + # - "download URL" is the "dl" value of its associated index configuration + # https://doc.rust-lang.org/cargo/reference/registry-index.html#index-configuration +, extraRegistries ? {} + + # Hashes for git dependencies. +, outputHashes ? {} +} @ args: + +assert (lockFile == null) != (lockFileContents == null); + +let + # Parse a git source into different components. + parseGit = src: + let + parts = builtins.match ''git\+([^?]+)(\?(rev|tag|branch)=(.*))?#(.*)'' src; + type = builtins.elemAt parts 2; # rev, tag or branch + value = builtins.elemAt parts 3; + in + if parts == null then null + else { + url = builtins.elemAt parts 0; + sha = builtins.elemAt parts 4; + } // lib.optionalAttrs (type != null) { inherit type value; }; + + # shadows args.lockFileContents + lockFileContents = + if lockFile != null + then builtins.readFile lockFile + else args.lockFileContents; + + parsedLockFile = builtins.fromTOML lockFileContents; + + packages = parsedLockFile.package; + + # There is no source attribute for the source package itself. But + # since we do not want to vendor the source package anyway, we can + # safely skip it. + depPackages = builtins.filter (p: p ? "source") packages; + + # Create dependent crates from packages. + # + # Force evaluation of the git SHA -> hash mapping, so that an error is + # thrown if there are stale hashes. We cannot rely on gitShaOutputHash + # being evaluated otherwise, since there could be no git dependencies. + depCrates = builtins.deepSeq gitShaOutputHash (builtins.map mkCrate depPackages); + + # Map package name + version to git commit SHA for packages with a git source. + namesGitShas = builtins.listToAttrs ( + builtins.map nameGitSha (builtins.filter (pkg: lib.hasPrefix "git+" pkg.source) depPackages) + ); + + nameGitSha = pkg: let gitParts = parseGit pkg.source; in { + name = "${pkg.name}-${pkg.version}"; + value = gitParts.sha; + }; + + # Convert the attrset provided through the `outputHashes` argument to a + # a mapping from git commit SHA -> output hash. + # + # There may be multiple different packages with different names + # originating from the same git repository (typically a Cargo + # workspace). By using the git commit SHA as a universal identifier, + # the user does not have to specify the output hash for every package + # individually. + gitShaOutputHash = lib.mapAttrs' (nameVer: hash: + let + unusedHash = throw "A hash was specified for ${nameVer}, but there is no corresponding git dependency."; + rev = namesGitShas.${nameVer} or unusedHash; in { + name = rev; + value = hash; + }) outputHashes; + + # We can't use the existing fetchCrate function, since it uses a + # recursive hash of the unpacked crate. + fetchCrate = pkg: downloadUrl: + let + checksum = pkg.checksum or parsedLockFile.metadata."checksum ${pkg.name} ${pkg.version} (${pkg.source})"; + in + assert lib.assertMsg (checksum != null) '' + Package ${pkg.name} does not have a checksum. + ''; + fetchurl { + name = "crate-${pkg.name}-${pkg.version}.tar.gz"; + url = "${downloadUrl}/${pkg.name}/${pkg.version}/download"; + sha256 = checksum; + }; + + registries = { + "https://github.com/rust-lang/crates.io-index" = "https://crates.io/api/v1/crates"; + } // extraRegistries; + + # Replaces values inherited by workspace members. + replaceWorkspaceValues = writers.writePython3 "replace-workspace-values" + { libraries = with python3Packages; [ tomli tomli-w ]; flakeIgnore = [ "E501" "W503" ]; } + (builtins.readFile ./replace-workspace-values.py); + + # Fetch and unpack a crate. + mkCrate = pkg: + let + gitParts = parseGit pkg.source; + registryIndexUrl = lib.removePrefix "registry+" pkg.source; + in + if lib.hasPrefix "registry+" pkg.source && builtins.hasAttr registryIndexUrl registries then + let + crateTarball = fetchCrate pkg registries.${registryIndexUrl}; + in runCommand "${pkg.name}-${pkg.version}" {} '' + mkdir $out + tar xf "${crateTarball}" -C $out --strip-components=1 + + # Cargo is happy with largely empty metadata. + printf '{"files":{},"package":"${crateTarball.outputHash}"}' > "$out/.cargo-checksum.json" + '' + else if gitParts != null then + let + missingHash = throw '' + No hash was found while vendoring the git dependency ${pkg.name}-${pkg.version}. You can add + a hash through the `outputHashes` argument of `importCargoLock`: + + outputHashes = { + "${pkg.name}-${pkg.version}" = "<hash>"; + }; + + If you use `buildRustPackage`, you can add this attribute to the `cargoLock` + attribute set. + ''; + tree = + if gitShaOutputHash ? ${gitParts.sha} then + fetchgit { + inherit (gitParts) url; + rev = gitParts.sha; # The commit SHA is always available. + sha256 = gitShaOutputHash.${gitParts.sha}; + } + else if allowBuiltinFetchGit then + builtins.fetchGit { + inherit (gitParts) url; + rev = gitParts.sha; + allRefs = true; + submodules = true; + } + else + missingHash; + in runCommand "${pkg.name}-${pkg.version}" {} '' + tree=${tree} + + # If the target package is in a workspace, or if it's the top-level + # crate, we should find the crate path using `cargo metadata`. + # Some packages do not have a Cargo.toml at the top-level, + # but only in nested directories. + # Only check the top-level Cargo.toml, if it actually exists + if [[ -f $tree/Cargo.toml ]]; then + crateCargoTOML=$(${cargo}/bin/cargo metadata --format-version 1 --no-deps --manifest-path $tree/Cargo.toml | \ + ${jq}/bin/jq -r '.packages[] | select(.name == "${pkg.name}") | .manifest_path') + fi + + # If the repository is not a workspace the package might be in a subdirectory. + if [[ -z $crateCargoTOML ]]; then + for manifest in $(find $tree -name "Cargo.toml"); do + echo Looking at $manifest + crateCargoTOML=$(${cargo}/bin/cargo metadata --format-version 1 --no-deps --manifest-path "$manifest" | ${jq}/bin/jq -r '.packages[] | select(.name == "${pkg.name}") | .manifest_path' || :) + if [[ ! -z $crateCargoTOML ]]; then + break + fi + done + + if [[ -z $crateCargoTOML ]]; then + >&2 echo "Cannot find path for crate '${pkg.name}-${pkg.version}' in the tree in: $tree" + exit 1 + fi + fi + + echo Found crate ${pkg.name} at $crateCargoTOML + tree=$(dirname $crateCargoTOML) + + cp -prvL "$tree/" $out + chmod u+w $out + + if grep -q workspace "$out/Cargo.toml"; then + chmod u+w "$out/Cargo.toml" + ${replaceWorkspaceValues} "$out/Cargo.toml" "$(${cargo}/bin/cargo metadata --format-version 1 --no-deps --manifest-path $crateCargoTOML | ${jq}/bin/jq -r .workspace_root)/Cargo.toml" + fi + + # Cargo is happy with empty metadata. + printf '{"files":{},"package":null}' > "$out/.cargo-checksum.json" + + # Set up configuration for the vendor directory. + cat > $out/.cargo-config <<EOF + [source."${gitParts.url}${lib.optionalString (gitParts ? type) "?${gitParts.type}=${gitParts.value}"}"] + git = "${gitParts.url}" + ${lib.optionalString (gitParts ? type) "${gitParts.type} = \"${gitParts.value}\""} + replace-with = "vendored-sources" + EOF + '' + else throw "Cannot handle crate source: ${pkg.source}"; + + vendorDir = runCommand "cargo-vendor-dir" + (if lockFile == null then { + inherit lockFileContents; + passAsFile = [ "lockFileContents" ]; + } else { + passthru = { + inherit lockFile; + }; + }) '' + mkdir -p $out/.cargo + + ${ + if lockFile != null + then "ln -s ${lockFile} $out/Cargo.lock" + else "cp $lockFileContentsPath $out/Cargo.lock" + } + + cat > $out/.cargo/config <<EOF +[source.crates-io] +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "cargo-vendor-dir" +EOF + + declare -A keysSeen + + for registry in ${toString (builtins.attrNames extraRegistries)}; do + cat >> $out/.cargo/config <<EOF + +[source."$registry"] +registry = "$registry" +replace-with = "vendored-sources" +EOF + done + + for crate in ${toString depCrates}; do + # Link the crate directory, removing the output path hash from the destination. + ln -s "$crate" $out/$(basename "$crate" | cut -c 34-) + + if [ -e "$crate/.cargo-config" ]; then + key=$(sed 's/\[source\."\(.*\)"\]/\1/; t; d' < "$crate/.cargo-config") + if [[ -z ''${keysSeen[$key]} ]]; then + keysSeen[$key]=1 + cat "$crate/.cargo-config" >> $out/.cargo/config + fi + fi + done + ''; +in + vendorDir diff --git a/nixpkgs/pkgs/build-support/rust/lib/default.nix b/nixpkgs/pkgs/build-support/rust/lib/default.nix new file mode 100644 index 000000000000..e09f913bfbd3 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/lib/default.nix @@ -0,0 +1,96 @@ +{ lib +, stdenv +, pkgsBuildHost +, pkgsBuildTarget +, pkgsTargetTarget +}: + +rec { + # These environment variables must be set when using `cargo-c` and + # several other tools which do not deal well with cross + # compilation. The symptom of the problem they fix is errors due + # to buildPlatform CFLAGS being passed to the + # hostPlatform-targeted compiler -- for example, `-m64` being + # passed on a build=x86_64/host=aarch64 compilation. + envVars = let + + # As a workaround for https://github.com/rust-lang/rust/issues/89626 use lld on pkgsStatic aarch64 + shouldUseLLD = platform: platform.isAarch64 && platform.isStatic && !stdenv.isDarwin; + + ccForBuild = "${pkgsBuildHost.stdenv.cc}/bin/${pkgsBuildHost.stdenv.cc.targetPrefix}cc"; + cxxForBuild = "${pkgsBuildHost.stdenv.cc}/bin/${pkgsBuildHost.stdenv.cc.targetPrefix}c++"; + linkerForBuild = ccForBuild; + + ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; + cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; + linkerForHost = if shouldUseLLD stdenv.targetPlatform + && !stdenv.cc.bintools.isLLVM + then "${pkgsBuildHost.llvmPackages.bintools}/bin/${stdenv.cc.targetPrefix}ld.lld" + else ccForHost; + + # Unfortunately we must use the dangerous `pkgsTargetTarget` here + # because hooks are artificially phase-shifted one slot earlier + # (they go in nativeBuildInputs, so the hostPlatform looks like + # a targetPlatform to them). + ccForTarget = "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc"; + cxxForTarget = "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}c++"; + linkerForTarget = if shouldUseLLD pkgsTargetTarget.stdenv.targetPlatform + && !pkgsTargetTarget.stdenv.cc.bintools.isLLVM # whether stdenv's linker is lld already + then "${pkgsBuildTarget.llvmPackages.bintools}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}ld.lld" + else ccForTarget; + + rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget; + rustBuildPlatformSpec = stdenv.buildPlatform.rust.rustcTargetSpec; + rustHostPlatform = stdenv.hostPlatform.rust.rustcTarget; + rustHostPlatformSpec = stdenv.hostPlatform.rust.rustcTargetSpec; + rustTargetPlatform = stdenv.targetPlatform.rust.rustcTarget; + rustTargetPlatformSpec = stdenv.targetPlatform.rust.rustcTargetSpec; + in { + inherit + ccForBuild cxxForBuild linkerForBuild rustBuildPlatform rustBuildPlatformSpec + ccForHost cxxForHost linkerForHost rustHostPlatform rustHostPlatformSpec + ccForTarget cxxForTarget linkerForTarget rustTargetPlatform rustTargetPlatformSpec; + + # Prefix this onto a command invocation in order to set the + # variables needed by cargo. + # + setEnv = '' + env \ + '' + # Due to a bug in how splicing and pkgsTargetTarget works, in + # situations where pkgsTargetTarget is irrelevant + # pkgsTargetTarget.stdenv.cc is often simply wrong. We must omit + # the following lines when rustTargetPlatform collides with + # rustHostPlatform. + + lib.optionalString (rustTargetPlatform != rustHostPlatform) '' + "CC_${stdenv.targetPlatform.rust.cargoEnvVarTarget}=${ccForTarget}" \ + "CXX_${stdenv.targetPlatform.rust.cargoEnvVarTarget}=${cxxForTarget}" \ + "CARGO_TARGET_${stdenv.targetPlatform.rust.cargoEnvVarTarget}_LINKER=${linkerForTarget}" \ + '' + '' + "CC_${stdenv.hostPlatform.rust.cargoEnvVarTarget}=${ccForHost}" \ + "CXX_${stdenv.hostPlatform.rust.cargoEnvVarTarget}=${cxxForHost}" \ + "CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_LINKER=${linkerForHost}" \ + '' + '' + "CC_${stdenv.buildPlatform.rust.cargoEnvVarTarget}=${ccForBuild}" \ + "CXX_${stdenv.buildPlatform.rust.cargoEnvVarTarget}=${cxxForBuild}" \ + "CARGO_TARGET_${stdenv.buildPlatform.rust.cargoEnvVarTarget}_LINKER=${linkerForBuild}" \ + "CARGO_BUILD_TARGET=${rustBuildPlatform}" \ + "HOST_CC=${pkgsBuildHost.stdenv.cc}/bin/cc" \ + "HOST_CXX=${pkgsBuildHost.stdenv.cc}/bin/c++" \ + ''; + }; +} // lib.mapAttrs (old: new: platform: + # TODO: enable warning after 23.05 is EOL. + # lib.warn "`rust.${old} platform` is deprecated. Use `platform.rust.${new}` instead." + lib.getAttrFromPath new platform.rust) +{ + toTargetArch = [ "platform" "arch" ]; + toTargetOs = [ "platform" "os" ]; + toTargetFamily = [ "platform" "target-family" ]; + toTargetVendor = [ "platform" "vendor" ]; + toRustTarget = [ "rustcTarget" ]; + toRustTargetSpec = [ "rustcTargetSpec" ]; + toRustTargetSpecShort = [ "cargoShortTarget" ]; + toRustTargetForUseInEnvVars = [ "cargoEnvVarTarget" ]; + IsNoStdTarget = [ "isNoStdTarget" ]; +} diff --git a/nixpkgs/pkgs/build-support/rust/replace-workspace-values.py b/nixpkgs/pkgs/build-support/rust/replace-workspace-values.py new file mode 100644 index 000000000000..003023ff2560 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/replace-workspace-values.py @@ -0,0 +1,126 @@ +# This script implements the workspace inheritance mechanism described +# here: https://doc.rust-lang.org/cargo/reference/workspaces.html#the-package-table +# +# Please run `mypy --strict`, `black`, and `isort --profile black` on this after editing, thanks! + +import sys +from typing import Any + +import tomli +import tomli_w + + +def load_file(path: str) -> dict[str, Any]: + with open(path, "rb") as f: + return tomli.load(f) + + +# This replicates the dependency merging logic from Cargo. +# See `inner_dependency_inherit_with`: +# https://github.com/rust-lang/cargo/blob/4de0094ac78743d2c8ff682489e35c8a7cafe8e4/src/cargo/util/toml/mod.rs#L982 +def replace_key( + workspace_manifest: dict[str, Any], table: dict[str, Any], section: str, key: str +) -> bool: + if ( + isinstance(table[key], dict) + and "workspace" in table[key] + and table[key]["workspace"] is True + ): + print("replacing " + key) + + local_dep = table[key] + del local_dep["workspace"] + + workspace_dep = workspace_manifest[section][key] + + if section == "dependencies": + if isinstance(workspace_dep, str): + workspace_dep = {"version": workspace_dep} + + final: dict[str, Any] = workspace_dep.copy() + + merged_features = local_dep.pop("features", []) + workspace_dep.get("features", []) + if merged_features: + final["features"] = merged_features + + local_default_features = local_dep.pop("default-features", None) + workspace_default_features = workspace_dep.get("default-features") + + if not workspace_default_features and local_default_features: + final["default-features"] = True + + optional = local_dep.pop("optional", False) + if optional: + final["optional"] = True + + if local_dep: + raise Exception(f"Unhandled keys in inherited dependency {key}: {local_dep}") + + table[key] = final + elif section == "package": + table[key] = workspace_dep + + return True + + return False + + +def replace_dependencies( + workspace_manifest: dict[str, Any], root: dict[str, Any] +) -> bool: + changed = False + + for key in ["dependencies", "dev-dependencies", "build-dependencies"]: + if key in root: + for k in root[key].keys(): + changed |= replace_key(workspace_manifest, root[key], "dependencies", k) + + return changed + + +def main() -> None: + top_cargo_toml = load_file(sys.argv[2]) + + if "workspace" not in top_cargo_toml: + # If top_cargo_toml is not a workspace manifest, then this script was probably + # ran on something that does not actually use workspace dependencies + print(f"{sys.argv[2]} is not a workspace manifest, doing nothing.") + return + + crate_manifest = load_file(sys.argv[1]) + workspace_manifest = top_cargo_toml["workspace"] + + if "workspace" in crate_manifest: + return + + changed = False + + for key in crate_manifest["package"].keys(): + changed |= replace_key( + workspace_manifest, crate_manifest["package"], "package", key + ) + + changed |= replace_dependencies(workspace_manifest, crate_manifest) + + if "target" in crate_manifest: + for key in crate_manifest["target"].keys(): + changed |= replace_dependencies( + workspace_manifest, crate_manifest["target"][key] + ) + + if ( + "lints" in crate_manifest + and "workspace" in crate_manifest["lints"] + and crate_manifest["lints"]["workspace"] is True + ): + crate_manifest["lints"] = workspace_manifest["lints"] + + if not changed: + return + + with open(sys.argv[1], "wb") as f: + tomli_w.dump(crate_manifest, f) + + +if __name__ == "__main__": + main() diff --git a/nixpkgs/pkgs/build-support/rust/rustc-wrapper/default.nix b/nixpkgs/pkgs/build-support/rust/rustc-wrapper/default.nix new file mode 100644 index 000000000000..0defa6355029 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/rustc-wrapper/default.nix @@ -0,0 +1,52 @@ +{ lib, runCommand, rustc-unwrapped, sysroot ? null }: + +runCommand "${rustc-unwrapped.pname}-wrapper-${rustc-unwrapped.version}" { + preferLocalBuild = true; + strictDeps = true; + inherit (rustc-unwrapped) outputs; + + env = { + sysroot = lib.optionalString (sysroot != null) "--sysroot ${sysroot}"; + + # Upstream rustc still assumes that musl = static[1]. The fix for + # this is to disable crt-static by default for non-static musl + # targets. + # + # Even though Cargo will build build.rs files for the build platform, + # cross-compiling _from_ musl appears to work fine, so we only need + # to do this when rustc's target platform is dynamically linked musl. + # + # [1]: https://github.com/rust-lang/compiler-team/issues/422 + # + # WARNING: using defaultArgs is dangerous, as it will apply to all + # targets used by this compiler (host and target). This means + # that it can't be used to set arguments that should only be + # applied to the target. It's fine to do this for -crt-static, + # because rustc does not support +crt-static host platforms + # anyway. + defaultArgs = lib.optionalString + (with rustc-unwrapped.stdenv.targetPlatform; isMusl && !isStatic) + "-C target-feature=-crt-static"; + }; + + passthru = { + inherit (rustc-unwrapped) pname version src llvm llvmPackages; + unwrapped = rustc-unwrapped; + }; + + meta = rustc-unwrapped.meta // { + description = "${rustc-unwrapped.meta.description} (wrapper script)"; + priority = 10; + }; +} '' + mkdir -p $out/bin + ln -s ${rustc-unwrapped}/bin/* $out/bin + rm $out/bin/{rustc,rustdoc} + prog=${rustc-unwrapped}/bin/rustc extraFlagsVar=NIX_RUSTFLAGS \ + substituteAll ${./rustc-wrapper.sh} $out/bin/rustc + prog=${rustc-unwrapped}/bin/rustdoc extraFlagsVar=NIX_RUSTDOCFLAGS \ + substituteAll ${./rustc-wrapper.sh} $out/bin/rustdoc + chmod +x $out/bin/{rustc,rustdoc} + ${lib.concatMapStrings (output: "ln -s ${rustc-unwrapped.${output}} \$${output}\n") + (lib.remove "out" rustc-unwrapped.outputs)} +'' diff --git a/nixpkgs/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh b/nixpkgs/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh new file mode 100644 index 000000000000..e33cc3e2a025 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh @@ -0,0 +1,29 @@ +#!@shell@ + +defaultSysroot=(@sysroot@) + +for arg; do + case "$arg" in + --sysroot|--sysroot=*) + defaultSysroot=() + ;; + --) + break + ;; + esac +done + +extraBefore=(@defaultArgs@ "${defaultSysroot[@]}") +extraAfter=($@extraFlagsVar@) + +# Optionally print debug info. +if (( "${NIX_DEBUG:-0}" >= 1 )); then + echo "extra flags before to @prog@:" >&2 + printf " %q\n" "${extraBefore[@]}" >&2 + echo "original flags to @prog@:" >&2 + printf " %q\n" "$@" >&2 + echo "extra flags after to @prog@:" >&2 + printf " %q\n" "${extraAfter[@]}" >&2 +fi + +exec @prog@ "${extraBefore[@]}" "$@" "${extraAfter[@]}" diff --git a/nixpkgs/pkgs/build-support/rust/sysroot/Cargo.lock b/nixpkgs/pkgs/build-support/rust/sysroot/Cargo.lock new file mode 100644 index 000000000000..d9b0c25d02f2 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/sysroot/Cargo.lock @@ -0,0 +1,44 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "alloc" +version = "0.0.0" +dependencies = [ + "compiler_builtins", + "core", +] + +[[package]] +name = "compiler_builtins" +version = "0.1.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f867ce54c09855ccd135ad4a50c777182a0c7af5ff20a8f537617bd648b10d50" +dependencies = [ + "rustc-std-workspace-core", +] + +[[package]] +name = "core" +version = "0.0.0" + +[[package]] +name = "nixpkgs-sysroot-stub-crate" +version = "0.0.0" +dependencies = [ + "alloc", + "compiler_builtins", + "core", +] + +[[package]] +name = "rustc-std-workspace-core" +version = "1.99.0" +dependencies = [ + "core", +] + +[[patch.unused]] +name = "rustc-std-workspace-alloc" +version = "1.99.0" diff --git a/nixpkgs/pkgs/build-support/rust/sysroot/cargo.py b/nixpkgs/pkgs/build-support/rust/sysroot/cargo.py new file mode 100644 index 000000000000..9d970eff79e8 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/sysroot/cargo.py @@ -0,0 +1,47 @@ +import os +import toml + +rust_src = os.environ['RUSTC_SRC'] +orig_cargo = os.environ['ORIG_CARGO'] if 'ORIG_CARGO' in os.environ else None + +base = { + 'package': { + 'name': 'nixpkgs-sysroot-stub-crate', + 'version': '0.0.0', + 'authors': ['The Rust Project Developers'], + 'edition': '2018', + }, + 'dependencies': { + 'compiler_builtins': { + 'version': '0.1.0', + 'features': ['rustc-dep-of-std', 'mem'], + }, + 'core': { + 'path': os.path.join(rust_src, 'core'), + }, + 'alloc': { + 'path': os.path.join(rust_src, 'alloc'), + }, + }, + 'patch': { + 'crates-io': { + 'rustc-std-workspace-core': { + 'path': os.path.join(rust_src, 'rustc-std-workspace-core'), + }, + 'rustc-std-workspace-alloc': { + 'path': os.path.join(rust_src, 'rustc-std-workspace-alloc'), + }, + }, + }, +} + +if orig_cargo is not None: + with open(orig_cargo, 'r') as f: + src = toml.loads(f.read()) + if 'profile' in src: + base['profile'] = src['profile'] + +out = toml.dumps(base) + +with open('Cargo.toml', 'x') as f: + f.write(out) diff --git a/nixpkgs/pkgs/build-support/rust/sysroot/src.nix b/nixpkgs/pkgs/build-support/rust/sysroot/src.nix new file mode 100644 index 000000000000..664702e82c31 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/sysroot/src.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, rustPlatform, buildPackages +, originalCargoToml ? null +}: + +stdenv.mkDerivation { + name = "cargo-src"; + preferLocalBuild = true; + + unpackPhase = "true"; + dontConfigure = true; + dontBuild = true; + + installPhase = '' + export RUSTC_SRC=${rustPlatform.rustLibSrc.override { }} + '' + + lib.optionalString (originalCargoToml != null) '' + export ORIG_CARGO=${originalCargoToml} + '' + + '' + ${buildPackages.python3.withPackages (ps: with ps; [ toml ])}/bin/python3 ${./cargo.py} + mkdir -p $out/src + echo '#![no_std]' > $out/src/lib.rs + cp Cargo.toml $out/Cargo.toml + cp ${./Cargo.lock} $out/Cargo.lock + ''; +} diff --git a/nixpkgs/pkgs/build-support/rust/sysroot/update-lockfile.sh b/nixpkgs/pkgs/build-support/rust/sysroot/update-lockfile.sh new file mode 100755 index 000000000000..d0596d1e5a62 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/sysroot/update-lockfile.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p python3 python3.pkgs.toml cargo + +set -eu pipefile + +HERE=$(readlink -e $(dirname "${BASH_SOURCE[0]}")) +NIXPKGS_ROOT="$HERE/../../../.." + +# https://unix.stackexchange.com/a/84980/390173 +tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'update-lockfile') +cd "$tempdir" +mkdir -p src +touch src/lib.rs + +RUSTC_SRC=$(nix-build "${NIXPKGS_ROOT}" -A pkgs.rustPlatform.rustLibSrc --no-out-link) + +ln -s $RUSTC_SRC/{core,alloc} ./ + +export RUSTC_SRC +python3 "$HERE/cargo.py" + +export RUSTC_BOOTSTRAP=1 +cargo generate-lockfile + +cp Cargo.lock "$HERE" + +rm -rf "$tempdir" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/Cargo.lock b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/Cargo.lock new file mode 100644 index 000000000000..522f9c260fa3 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/Cargo.lock @@ -0,0 +1,83 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "basic-dynamic" +version = "0.1.0" +dependencies = [ + "rand", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "getrandom" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "libc" +version = "0.2.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2a5ac8f984bfcf3a823267e5fde638acc3325f6496633a5da6bb6eb2171e103" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "rand" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +dependencies = [ + "rand_core", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/Cargo.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/Cargo.toml new file mode 100644 index 000000000000..851024c82e94 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "basic-dynamic" +version = "0.1.0" +authors = ["Daniël de Kok <me@danieldk.eu>"] +edition = "2018" + +[dependencies] +rand = "0.8" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/default.nix b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/default.nix new file mode 100644 index 000000000000..105303201617 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/default.nix @@ -0,0 +1,25 @@ +{ lib, rustPlatform }: +let + fs = lib.fileset; +in +rustPlatform.buildRustPackage { + pname = "basic-dynamic"; + version = "0.1.0"; + + src = fs.toSource { + root = ./.; + fileset = fs.unions [ + ./Cargo.toml + ./Cargo.lock + ./src + ]; + }; + + cargoLock.lockFileContents = builtins.readFile ./Cargo.lock; + + doInstallCheck = true; + + installCheckPhase = '' + $out/bin/basic-dynamic + ''; +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/src/main.rs b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/src/main.rs new file mode 100644 index 000000000000..50b4ed799e43 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic-dynamic/src/main.rs @@ -0,0 +1,9 @@ +use rand::Rng; + +fn main() { + let mut rng = rand::thread_rng(); + + // Always draw zero :). + let roll: u8 = rng.gen_range(0..1); + assert_eq!(roll, 0); +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/Cargo.lock b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/Cargo.lock new file mode 100644 index 000000000000..fd1b5e42ad30 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/Cargo.lock @@ -0,0 +1,83 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "basic" +version = "0.1.0" +dependencies = [ + "rand", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "libc" +version = "0.2.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/Cargo.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/Cargo.toml new file mode 100644 index 000000000000..f555bb0de62e --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "basic" +version = "0.1.0" +authors = ["Daniël de Kok <me@danieldk.eu>"] +edition = "2018" + +[dependencies] +rand = "0.8" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/default.nix b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/default.nix new file mode 100644 index 000000000000..325380977b88 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/default.nix @@ -0,0 +1,27 @@ +{ lib, rustPlatform }: +let + fs = lib.fileset; +in +rustPlatform.buildRustPackage { + pname = "basic"; + version = "0.1.0"; + + src = fs.toSource { + root = ./.; + fileset = fs.unions [ + ./Cargo.toml + ./Cargo.lock + ./src + ]; + }; + + cargoLock = { + lockFile = ./Cargo.lock; + }; + + doInstallCheck = true; + + installCheckPhase = '' + $out/bin/basic + ''; +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/src/main.rs b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/src/main.rs new file mode 100644 index 000000000000..50b4ed799e43 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/basic/src/main.rs @@ -0,0 +1,9 @@ +use rand::Rng; + +fn main() { + let mut rng = rand::thread_rng(); + + // Always draw zero :). + let roll: u8 = rng.gen_range(0..1); + assert_eq!(roll, 0); +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/default.nix b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/default.nix new file mode 100644 index 000000000000..26e6487989c4 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/default.nix @@ -0,0 +1,20 @@ +{ callPackage, maturin, writers, python3Packages }: + +# Build like this from nixpkgs root: +# $ nix-build -A tests.importCargoLock +{ + basic = callPackage ./basic { }; + basicDynamic = callPackage ./basic-dynamic { }; + gitDependency = callPackage ./git-dependency { }; + gitDependencyRev = callPackage ./git-dependency-rev { }; + gitDependencyRevNonWorkspaceNestedCrate = callPackage ./git-dependency-rev-non-workspace-nested-crate { }; + gitDependencyTag = callPackage ./git-dependency-tag { }; + gitDependencyBranch = callPackage ./git-dependency-branch { }; + maturin = maturin.tests.pyo3; + v1 = callPackage ./v1 { }; + gitDependencyWorkspaceInheritance = callPackage ./git-dependency-workspace-inheritance { + replaceWorkspaceValues = writers.writePython3 "replace-workspace-values" + { libraries = with python3Packages; [ tomli tomli-w ]; flakeIgnore = [ "E501" "W503" ]; } + (builtins.readFile ../../replace-workspace-values.py); + }; +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/Cargo.lock b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/Cargo.lock new file mode 100644 index 000000000000..e832b2e5ba4f --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/Cargo.lock @@ -0,0 +1,72 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "git-dependency-branch" +version = "0.1.0" +dependencies = [ + "rand", +] + +[[package]] +name = "libc" +version = "0.2.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "rand" +version = "0.8.4" +source = "git+https://github.com/rust-random/rand.git?branch=master#fcc5baf31565a94f63dce41c2e739e6f182475f4" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "git+https://github.com/rust-random/rand.git?branch=master#fcc5baf31565a94f63dce41c2e739e6f182475f4" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "git+https://github.com/rust-random/rand.git?branch=master#fcc5baf31565a94f63dce41c2e739e6f182475f4" +dependencies = [ + "getrandom", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/Cargo.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/Cargo.toml new file mode 100644 index 000000000000..0702c5ad8a07 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "git-dependency-branch" +version = "0.1.0" +authors = ["Daniël de Kok <me@danieldk.eu>"] +edition = "2018" + +[dependencies] +rand = { git = "https://github.com/rust-random/rand.git", branch = "master" } diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/default.nix b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/default.nix new file mode 100644 index 000000000000..3111c747d372 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/default.nix @@ -0,0 +1,30 @@ +{ lib, rustPlatform }: +let + fs = lib.fileset; +in +rustPlatform.buildRustPackage { + pname = "git-dependency-branch"; + version = "0.1.0"; + + src = fs.toSource { + root = ./.; + fileset = fs.unions [ + ./Cargo.toml + ./Cargo.lock + ./src + ]; + }; + + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { + "rand-0.8.4" = "1ilk9wvfw3mdm57g199ys8f5nrgdrh0n3a4c8b7nz6lgnqvfrv6z"; + }; + }; + + doInstallCheck = true; + + installCheckPhase = '' + $out/bin/git-dependency-branch + ''; +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/src/main.rs b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/src/main.rs new file mode 100644 index 000000000000..50b4ed799e43 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-branch/src/main.rs @@ -0,0 +1,9 @@ +use rand::Rng; + +fn main() { + let mut rng = rand::thread_rng(); + + // Always draw zero :). + let roll: u8 = rng.gen_range(0..1); + assert_eq!(roll, 0); +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/Cargo.lock b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/Cargo.lock new file mode 100644 index 000000000000..63ff1b3c113c --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/Cargo.lock @@ -0,0 +1,638 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "anyhow" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1" + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cargo-test-macro" +version = "0.1.0" +source = "git+https://github.com/rust-lang/cargo?branch=rust-1.53.0#4369396ce7d270972955d876eaa4954bea56bcd9" + +[[package]] +name = "cargo-test-support" +version = "0.1.0" +source = "git+https://github.com/rust-lang/cargo?branch=rust-1.53.0#4369396ce7d270972955d876eaa4954bea56bcd9" +dependencies = [ + "anyhow", + "cargo-test-macro", + "cargo-util", + "filetime", + "flate2", + "git2", + "glob", + "lazy_static", + "remove_dir_all", + "serde_json", + "tar", + "toml", + "url", +] + +[[package]] +name = "cargo-util" +version = "0.1.0" +source = "git+https://github.com/rust-lang/cargo?branch=rust-1.53.0#4369396ce7d270972955d876eaa4954bea56bcd9" +dependencies = [ + "anyhow", + "core-foundation", + "crypto-hash", + "filetime", + "hex 0.4.3", + "jobserver", + "libc", + "log", + "miow", + "same-file", + "shell-escape", + "tempfile", + "walkdir", + "winapi", +] + +[[package]] +name = "cc" +version = "1.0.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" +dependencies = [ + "jobserver", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "commoncrypto" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007" +dependencies = [ + "commoncrypto-sys", +] + +[[package]] +name = "commoncrypto-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2" +dependencies = [ + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "crc32fast" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-hash" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a77162240fd97248d19a564a565eb563a3f592b386e4136fb300909e67dddca" +dependencies = [ + "commoncrypto", + "hex 0.3.2", + "openssl", + "winapi", +] + +[[package]] +name = "filetime" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi", +] + +[[package]] +name = "flate2" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" +dependencies = [ + "cfg-if", + "crc32fast", + "libc", + "libz-sys", + "miniz_oxide", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "getrandom" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "git-dependency-rev-non-workspace-nested-crate" +version = "0.1.0" +dependencies = [ + "cargo-test-support", +] + +[[package]] +name = "git2" +version = "0.13.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a8057932925d3a9d9e4434ea016570d37420ddb1ceed45a174d577f24ed6700" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "openssl-probe", + "openssl-sys", + "url", +] + +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + +[[package]] +name = "hex" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "itoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" + +[[package]] +name = "jobserver" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +dependencies = [ + "libc", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "869d572136620d55835903746bcb5cdc54cb2851fd0aeec53220b4bb65ef3013" + +[[package]] +name = "libgit2-sys" +version = "0.12.24+1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddbd6021eef06fb289a8f54b3c2acfdd85ff2a585dfbb24b8576325373d2152c" +dependencies = [ + "cc", + "libc", + "libssh2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", +] + +[[package]] +name = "libssh2-sys" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" +dependencies = [ + "cc", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-sys" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + +[[package]] +name = "miniz_oxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "once_cell" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" + +[[package]] +name = "openssl" +version = "0.10.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-sys", +] + +[[package]] +name = "openssl-probe" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" + +[[package]] +name = "openssl-sys" +version = "0.9.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pkg-config" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10e2fcbb64ecbe64c8e040a386c3104d384583af58b956d870aaaf229df6e66d" + +[[package]] +name = "ppv-lite86" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ca011bd0129ff4ae15cd04c4eef202cadf6c51c21e47aba319b4e0501db741" + +[[package]] +name = "rand" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +dependencies = [ + "bitflags", +] + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "serde" +version = "1.0.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" + +[[package]] +name = "serde_json" +version = "1.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shell-escape" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" + +[[package]] +name = "tar" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f5515d3add52e0bbdcad7b83c388bb36ba7b754dda3b5f5bc2d38640cdba5c" +dependencies = [ + "filetime", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +dependencies = [ + "cfg-if", + "libc", + "rand", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "tinyvec" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" + +[[package]] +name = "unicode-normalization" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/Cargo.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/Cargo.toml new file mode 100644 index 000000000000..61f1a08dbe4f --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "git-dependency-rev-non-workspace-nested-crate" +version = "0.1.0" +authors = ["Stefan Junker <mail@stefanjunker.de>"] +edition = "2018" + +[dependencies] +cargo-test-support = { git = "https://github.com/rust-lang/cargo", branch = "rust-1.53.0" } diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/default.nix b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/default.nix new file mode 100644 index 000000000000..63e3bea3ca1f --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/default.nix @@ -0,0 +1,40 @@ +{ rustPlatform, pkg-config, openssl, lib, darwin, stdenv }: +let + fs = lib.fileset; +in +rustPlatform.buildRustPackage { + pname = "git-dependency-rev-non-workspace-nested-crate"; + version = "0.1.0"; + + src = fs.toSource { + root = ./.; + fileset = fs.unions [ + ./Cargo.toml + ./Cargo.lock + ./src + ]; + }; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + openssl + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Security + ]; + + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { + "cargo-test-macro-0.1.0" = "1yy1y1d523xdzwg1gc77pigbcwsbawmy4b7vw8v21m7q957sk0c4"; + }; + }; + + doInstallCheck = true; + + installCheckPhase = '' + $out/bin/git-dependency-rev-non-workspace-nested-crate + ''; +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/src/main.rs b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/src/main.rs new file mode 100644 index 000000000000..cb4bfb5d928b --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev-non-workspace-nested-crate/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("{}", cargo_test_support::t!(Result::<&str, &str>::Ok("msg"))); +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/Cargo.lock b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/Cargo.lock new file mode 100644 index 000000000000..684d9419479d --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/Cargo.lock @@ -0,0 +1,81 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "git-dependency-rev" +version = "0.1.0" +dependencies = [ + "rand", +] + +[[package]] +name = "libc" +version = "0.2.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "rand" +version = "0.8.3" +source = "git+https://github.com/rust-random/rand.git?rev=0.8.3#6ecbe2626b2cc6110a25c97b1702b347574febc7" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "git+https://github.com/rust-random/rand.git?rev=0.8.3#6ecbe2626b2cc6110a25c97b1702b347574febc7" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.1" +source = "git+https://github.com/rust-random/rand.git?rev=0.8.3#6ecbe2626b2cc6110a25c97b1702b347574febc7" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "git+https://github.com/rust-random/rand.git?rev=0.8.3#6ecbe2626b2cc6110a25c97b1702b347574febc7" +dependencies = [ + "rand_core", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/Cargo.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/Cargo.toml new file mode 100644 index 000000000000..3500325ae579 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "git-dependency-rev" +version = "0.1.0" +authors = ["Daniël de Kok <me@danieldk.eu>"] +edition = "2018" + +[dependencies] +rand = { git = "https://github.com/rust-random/rand.git", rev = "0.8.3" } diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/default.nix b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/default.nix new file mode 100644 index 000000000000..d3cb0fa7df81 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/default.nix @@ -0,0 +1,30 @@ +{ lib, rustPlatform }: +let + fs = lib.fileset; +in +rustPlatform.buildRustPackage { + pname = "git-dependency-rev"; + version = "0.1.0"; + + src = fs.toSource { + root = ./.; + fileset = fs.unions [ + ./Cargo.toml + ./Cargo.lock + ./src + ]; + }; + + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { + "rand-0.8.3" = "0l3p174bpwia61vcvxz5mw65a13ri3wy94z04xrnyy5lzciykz4f"; + }; + }; + + doInstallCheck = true; + + installCheckPhase = '' + $out/bin/git-dependency-rev + ''; +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/src/main.rs b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/src/main.rs new file mode 100644 index 000000000000..50b4ed799e43 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-rev/src/main.rs @@ -0,0 +1,9 @@ +use rand::Rng; + +fn main() { + let mut rng = rand::thread_rng(); + + // Always draw zero :). + let roll: u8 = rng.gen_range(0..1); + assert_eq!(roll, 0); +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/Cargo.lock b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/Cargo.lock new file mode 100644 index 000000000000..9f8ec19a366a --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/Cargo.lock @@ -0,0 +1,81 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "git-dependency-tag" +version = "0.1.0" +dependencies = [ + "rand", +] + +[[package]] +name = "libc" +version = "0.2.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "rand" +version = "0.8.3" +source = "git+https://github.com/rust-random/rand.git?tag=0.8.3#6ecbe2626b2cc6110a25c97b1702b347574febc7" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "git+https://github.com/rust-random/rand.git?tag=0.8.3#6ecbe2626b2cc6110a25c97b1702b347574febc7" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.1" +source = "git+https://github.com/rust-random/rand.git?tag=0.8.3#6ecbe2626b2cc6110a25c97b1702b347574febc7" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "git+https://github.com/rust-random/rand.git?tag=0.8.3#6ecbe2626b2cc6110a25c97b1702b347574febc7" +dependencies = [ + "rand_core", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/Cargo.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/Cargo.toml new file mode 100644 index 000000000000..1bda7336c263 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "git-dependency-tag" +version = "0.1.0" +authors = ["Daniël de Kok <me@danieldk.eu>"] +edition = "2018" + +[dependencies] +rand = { git = "https://github.com/rust-random/rand.git", tag = "0.8.3" } diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/default.nix b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/default.nix new file mode 100644 index 000000000000..dfaa1e3028da --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/default.nix @@ -0,0 +1,30 @@ +{ lib, rustPlatform }: +let + fs = lib.fileset; +in +rustPlatform.buildRustPackage { + pname = "git-dependency-tag"; + version = "0.1.0"; + + src = fs.toSource { + root = ./.; + fileset = fs.unions [ + ./Cargo.toml + ./Cargo.lock + ./src + ]; + }; + + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { + "rand-0.8.3" = "0l3p174bpwia61vcvxz5mw65a13ri3wy94z04xrnyy5lzciykz4f"; + }; + }; + + doInstallCheck = true; + + installCheckPhase = '' + $out/bin/git-dependency-tag + ''; +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/src/main.rs b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/src/main.rs new file mode 100644 index 000000000000..50b4ed799e43 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-tag/src/main.rs @@ -0,0 +1,9 @@ +use rand::Rng; + +fn main() { + let mut rng = rand::thread_rng(); + + // Always draw zero :). + let roll: u8 = rng.gen_range(0..1); + assert_eq!(roll, 0); +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/crate.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/crate.toml new file mode 100644 index 000000000000..f7b62aed3514 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/crate.toml @@ -0,0 +1,13 @@ +[package] +name = "im_using_workspaces" +version = { workspace = true } +publish = false +keywords = [ + "workspace", + "other_thing", + "third_thing", +] + +[dependencies] +foo = { workspace = true, features = ["cat"] } +bar = "1.0.0" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/default.nix b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/default.nix new file mode 100644 index 000000000000..138b7179b95f --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/default.nix @@ -0,0 +1,7 @@ +{ replaceWorkspaceValues, runCommand }: + +runCommand "git-dependency-workspace-inheritance-test" { } '' + cp --no-preserve=mode ${./crate.toml} "$out" + ${replaceWorkspaceValues} "$out" ${./workspace.toml} + diff -u "$out" ${./want.toml} +'' diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/want.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/want.toml new file mode 100644 index 000000000000..ec1331455bec --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/want.toml @@ -0,0 +1,19 @@ +[package] +name = "im_using_workspaces" +version = "1.0.0" +publish = false +keywords = [ + "workspace", + "other_thing", + "third_thing", +] + +[dependencies] +bar = "1.0.0" + +[dependencies.foo] +features = [ + "cat", + "meow", +] +version = "1.0.0" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/workspace.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/workspace.toml new file mode 100644 index 000000000000..c58112a782d0 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency-workspace-inheritance/workspace.toml @@ -0,0 +1,5 @@ +[workspace.package] +version = "1.0.0" + +[workspace.dependencies] +foo = { version = "1.0.0", features = ["meow"] } diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/Cargo.lock b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/Cargo.lock new file mode 100644 index 000000000000..fa71865b3e5f --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/Cargo.lock @@ -0,0 +1,81 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "git-dependency" +version = "0.1.0" +dependencies = [ + "rand", +] + +[[package]] +name = "libc" +version = "0.2.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "rand" +version = "0.8.3" +source = "git+https://github.com/rust-random/rand.git#f0e01ee0a7257753cc51b291f62666f4765923ef" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "git+https://github.com/rust-random/rand.git#f0e01ee0a7257753cc51b291f62666f4765923ef" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "git+https://github.com/rust-random/rand.git#f0e01ee0a7257753cc51b291f62666f4765923ef" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "git+https://github.com/rust-random/rand.git#f0e01ee0a7257753cc51b291f62666f4765923ef" +dependencies = [ + "rand_core", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/Cargo.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/Cargo.toml new file mode 100644 index 000000000000..a902dea9fcd0 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "git-dependency" +version = "0.1.0" +authors = ["Daniël de Kok <me@danieldk.eu>"] +edition = "2018" + +[dependencies] +rand = { git = "https://github.com/rust-random/rand.git" } diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/default.nix b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/default.nix new file mode 100644 index 000000000000..98aa35bf8e1d --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/default.nix @@ -0,0 +1,30 @@ +{ lib, rustPlatform }: +let + fs = lib.fileset; +in +rustPlatform.buildRustPackage { + pname = "git-dependency"; + version = "0.1.0"; + + src = fs.toSource { + root = ./.; + fileset = fs.unions [ + ./Cargo.toml + ./Cargo.lock + ./src + ]; + }; + + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { + "rand-0.8.3" = "0ya2hia3cn31qa8894s3av2s8j5bjwb6yq92k0jsnlx7jid0jwqa"; + }; + }; + + doInstallCheck = true; + + installCheckPhase = '' + $out/bin/git-dependency + ''; +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/src/main.rs b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/src/main.rs new file mode 100644 index 000000000000..50b4ed799e43 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/git-dependency/src/main.rs @@ -0,0 +1,9 @@ +use rand::Rng; + +fn main() { + let mut rng = rand::thread_rng(); + + // Always draw zero :). + let roll: u8 = rng.gen_range(0..1); + assert_eq!(roll, 0); +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/Cargo.lock b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/Cargo.lock new file mode 100644 index 000000000000..fe976f090aac --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/Cargo.lock @@ -0,0 +1,85 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.94 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.10.2+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libc" +version = "0.2.94" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.94 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "v1" +version = "0.1.0" +dependencies = [ + "rand 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum cfg-if 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +"checksum getrandom 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +"checksum libc 0.2.94 (registry+https://github.com/rust-lang/crates.io-index)" = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e" +"checksum ppv-lite86 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +"checksum rand 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +"checksum rand_chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +"checksum rand_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +"checksum rand_hc 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +"checksum wasi 0.10.2+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/Cargo.toml b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/Cargo.toml new file mode 100644 index 000000000000..4b825c45cadc --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "v1" +version = "0.1.0" +authors = ["Daniël de Kok <me@danieldk.eu>"] +edition = "2018" + +[dependencies] +rand = "0.8" diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/default.nix b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/default.nix new file mode 100644 index 000000000000..b53b7113590c --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/default.nix @@ -0,0 +1,27 @@ +{ lib, rustPlatform }: +let + fs = lib.fileset; +in +rustPlatform.buildRustPackage { + pname = "v1"; + version = "0.1.0"; + + src = fs.toSource { + root = ./.; + fileset = fs.unions [ + ./Cargo.toml + ./Cargo.lock + ./src + ]; + }; + + cargoLock = { + lockFile = ./Cargo.lock; + }; + + doInstallCheck = true; + + installCheckPhase = '' + $out/bin/v1 + ''; +} diff --git a/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/src/main.rs b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/src/main.rs new file mode 100644 index 000000000000..50b4ed799e43 --- /dev/null +++ b/nixpkgs/pkgs/build-support/rust/test/import-cargo-lock/v1/src/main.rs @@ -0,0 +1,9 @@ +use rand::Rng; + +fn main() { + let mut rng = rand::thread_rng(); + + // Always draw zero :). + let roll: u8 = rng.gen_range(0..1); + assert_eq!(roll, 0); +} |