diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-06-17 10:26:52 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-06-17 10:26:52 +0200 |
commit | 1524752c17ee8753467f068c23fbe1d994aa8f75 (patch) | |
tree | c802ca482e2461765dcbdcef5cc6fa38c9d1c42b /flake.nix | |
parent | 7db879e65e83b1c65206b490d36a69e97c5a877a (diff) | |
parent | 29542865cee37ab22efe1bd142900b69f6c59f0d (diff) |
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 68 |
1 files changed, 1 insertions, 67 deletions
@@ -78,7 +78,6 @@ then nlohmann_json else nlohmann_json.override { multipleHeaders = true; }) nlohmann_json - rustc cargo # Tests git @@ -134,8 +133,6 @@ chmod u+w $out/lib/*.so.* patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* ''} - - ln -sfn ${final.nixVendoredCrates}/vendor/ nix-rust/vendor ''; configureFlags = configureFlags ++ @@ -190,68 +187,10 @@ }; - # Create a "vendor" directory that contains the crates listed in - # Cargo.lock, and include it in the Nix tarball. This allows Nix - # to be built without network access. - nixVendoredCrates = - let - lockFile = builtins.fromTOML (builtins.readFile nix-rust/Cargo.lock); - - files = map (pkg: import <nix/fetchurl.nix> { - url = "https://crates.io/api/v1/crates/${pkg.name}/${pkg.version}/download"; - sha256 = lockFile.metadata."checksum ${pkg.name} ${pkg.version} (registry+https://github.com/rust-lang/crates.io-index)"; - }) (builtins.filter (pkg: pkg.source or "" == "registry+https://github.com/rust-lang/crates.io-index") lockFile.package); - - in final.runCommand "cargo-vendor-dir" {} - '' - mkdir -p $out/vendor - - cat > $out/vendor/config <<EOF - [source.crates-io] - replace-with = "vendored-sources" - - [source.vendored-sources] - directory = "vendor" - EOF - - ${toString (builtins.map (file: '' - mkdir $out/vendor/tmp - tar xvf ${file} -C $out/vendor/tmp - dir=$(echo $out/vendor/tmp/*) - - # Add just enough metadata to keep Cargo happy. - printf '{"files":{},"package":"${file.outputHash}"}' > "$dir/.cargo-checksum.json" - - # Clean up some cruft from the winapi crates. FIXME: find - # a way to remove winapi* from our dependencies. - if [[ $dir =~ /winapi ]]; then - find $dir -name "*.a" -print0 | xargs -0 rm -f -- - fi - - mv "$dir" $out/vendor/ - - rm -rf $out/vendor/tmp - '') files)} - ''; - }; hydraJobs = { - vendoredCrates = - with nixpkgsFor.x86_64-linux; - - runCommand "vendored-crates" {} - '' - mkdir -p $out/nix-support - name=nix-vendored-crates-${version} - fn=$out/$name.tar.xz - tar cvfJ $fn -C ${nixVendoredCrates} vendor \ - --owner=0 --group=0 --mode=u+rw,uga+r \ - --transform "s,vendor,$name," - echo "file crates-tarball $fn" >> $out/nix-support/hydra-build-products - ''; - # Binary package for various platforms. build = nixpkgs.lib.genAttrs systems (system: nixpkgsFor.${system}.nix); @@ -360,11 +299,6 @@ src = self; - preConfigure = - '' - ln -sfn ${nixVendoredCrates}/vendor/ nix-rust/vendor - ''; - enableParallelBuilding = true; buildInputs = buildDeps ++ propagatedDeps; @@ -487,7 +421,7 @@ stdenv.mkDerivation { name = "nix"; - buildInputs = buildDeps ++ propagatedDeps ++ perlDeps ++ [ pkgs.rustfmt ]; + buildInputs = buildDeps ++ propagatedDeps ++ perlDeps; inherit configureFlags; |