Provide `rust-bin` and clean-up

wip/nixpkgs-raku
oxalica 3 years ago
parent 91b5c82bd8
commit 4c09255aeb
No known key found for this signature in database
GPG Key ID: CED392DE0C483D00
  1. 11
      all.nix
  2. 2
      default.nix
  3. 22
      manifest.nix
  4. 48
      rust-overlay.nix

@ -1,11 +0,0 @@
# For test.
with import <nixpkgs> {
overlays = [ (import ./.) ];
}; {
stable = lib.mapAttrs
(channel: _: (rustChannelOf { inherit channel; }).rust)
(removeAttrs (import ./manifests/stable) ["latest"]);
nightly = lib.mapAttrs
(date: _: (rustChannelOf { channel = "nightly"; inherit date; }).rust)
(removeAttrs (import ./manifests/nightly) ["latest"]);
}

@ -0,0 +1,2 @@
final: prev:
(import ./rust-overlay.nix final) (prev // (import ./manifest.nix final prev))

@ -4,7 +4,7 @@ with builtins;
let
targets = import ./manifests/targets.nix // { _ = "*"; };
distServer = "https://static.rust-lang.org";
inherit (final.rust-bin) distRoot;
# Extensions for mixed `rust` pkg.
components = [
@ -60,7 +60,7 @@ let
in {
name = target;
value = {
xz_url = "${distServer}/dist/${date}/${pkgNameStripped}-${urlVersion}${targetTail}.tar.xz";
xz_url = "${distRoot}/${date}/${pkgNameStripped}-${urlVersion}${targetTail}.tar.xz";
xz_hash = hash;
} // (if pkgName == "rust" then rustPkgExtra pkg target else {});
}) (removeAttrs hashes ["v" "k"]);
@ -71,10 +71,16 @@ let
ret = mapAttrs (uncompressManifest nightly) (removeAttrs set ["latest"]);
in ret // { latest = ret.${set.latest}; };
manifests = {
stable = uncompressManifestSet false (import ./manifests/stable);
nightly = uncompressManifestSet true (import ./manifests/nightly);
};
in {
rust-bin = (prev.rust-bin or {}) // {
# The dist url for fetching.
# Override it if you want to use a mirror server.
distRoot = "https://static.rust-lang.org/dist";
# in { inherit manifests; }
in import ./rust-overlay.nix final prev manifests
# For internal usage.
manifests = {
stable = uncompressManifestSet false (import ./manifests/stable);
nightly = uncompressManifestSet true (import ./manifests/nightly);
};
};
}

@ -3,12 +3,12 @@
# This file provide a Rust overlay, which provides pre-packaged bleeding edge versions of rustc
# and cargo.
self: super:
manifests:
let
# Manifest selector.
fromManifest = { channel ? null, date ? null }: { stdenv, fetchurl, patchelf }: let
inherit (self.rust-bin) manifests;
assertWith = cond: msg: body: if cond then body else throw msg;
ret =
@ -269,43 +269,53 @@ let
in
rec {
# For each channel:
# rust-bin.stable.latest.cargo
# rust-bin.stable.latest.rust # Aggregate all others. (recommended)
# rust-bin.stable.latest.rustc
# rust-bin.stable.latest.rust-analysis
# rust-bin.stable.latest.rust-docs
# rust-bin.stable.latest.rust-src
# rust-bin.stable.latest.rust-std
#
# For a specific version of stable:
# rust-bin.stable."1.47.0".rust
#
# For a specific date of nightly:
# rust-bin.nightly."2020-01-01".rust
rust-bin = with builtins; (super.rust-bin or {}) //
mapAttrs (channel: manifests:
mapAttrs (version: manifest:
fromManifestFile manifest { inherit (self) stdenv fetchurl patchelf; }
) manifests
) super.rust-bin.manifests;
# Compat with mozilla overlay.
lib = super.lib // {
rustLib = {
rustLib = super.lib.rustLib {
inherit fromManifest fromManifestFile;
};
};
# Compat with mozilla overlay.
rustChannelOf = manifest_args: fromManifest
manifest_args
{ inherit (self) stdenv fetchurl patchelf; };
# Set of packages which are automagically updated. Do not rely on these for
# reproducible builds.
# Compat with mozilla overlay.
latest = (super.latest or {}) // {
rustChannels = {
nightly = rustChannelOf { channel = "nightly"; };
beta = rustChannelOf { channel = "beta"; };
# beta = rustChannelOf { channel = "beta"; };
stable = rustChannelOf { channel = "stable"; };
};
};
# Helper builder
# Compat with mozilla overlay.
rustChannelOfTargets = channel: date: targets:
(rustChannelOf { inherit channel date; })
.rust.override { inherit targets; };
# For backward compatibility
# Compat with mozilla overlay.
rustChannels = latest.rustChannels;
# For each channel:
# latest.rustChannels.nightly.cargo
# latest.rustChannels.nightly.rust # Aggregate all others. (recommended)
# latest.rustChannels.nightly.rustc
# latest.rustChannels.nightly.rust-analysis
# latest.rustChannels.nightly.rust-docs
# latest.rustChannels.nightly.rust-src
# latest.rustChannels.nightly.rust-std
# For a specific date:
# (rustChannelOf { date = "2017-06-06"; channel = "beta"; }).rust
}

Loading…
Cancel
Save