-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathdefault.nix
71 lines (60 loc) · 2.48 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Overlay interface for non-flake Nix.
final: prev:
let
inherit (builtins) mapAttrs readFile;
inherit (final) lib rust-bin;
inherit (rust-bin._internal) toolchainFromManifest selectManifest;
# Same as `toolchainFromManifest` but read from a manifest file.
toolchainFromManifestFile = path: toolchainFromManifest (fromTOML (readFile path));
# Override all pkgs of a toolchain set.
overrideToolchain = attrs: mapAttrs (name: pkg: pkg.override attrs);
# This is eagerly evaluated and disallow overriding. Get this from `final`
# will easily encounter infinite recursion without manually expand all attrs
# from `rust-bin.nix` output like `mkIf` does.
# This is considered internal anyway.
manifests = import ./lib/manifests.nix {
inherit lib;
inherit (rust-bin) distRoot;
};
in {
rust-bin = (prev.rust-bin or { }) // {
# The overridable dist url for fetching.
distRoot = import ./lib/dist-root.nix;
} // import ./lib/rust-bin.nix {
inherit lib manifests;
inherit (rust-bin) nightly;
pkgs = final;
};
# All attributes below are for compatibility with mozilla overlay.
lib = (prev.lib or { }) // {
rustLib = (prev.lib.rustLib or { }) // {
manifest_v2_url = throw ''
`manifest_v2_url` is not supported.
Select a toolchain from `rust-bin` or using `rustChannelOf` instead.
See also README at https://github.com/oxalica/rust-overlay
'';
fromManifest = throw ''
`fromManifest` is not supported due to network access during evaluation.
Select a toolchain from `rust-bin` or using `rustChannelOf` instead.
See also README at https://github.com/oxalica/rust-overlay
'';
fromManifestFile = manifestFilePath: { stdenv, fetchurl, patchelf }@deps: builtins.trace ''
`fromManifestFile` is deprecated.
Select a toolchain from `rust-bin` or using `rustChannelOf` instead.
See also README at https://github.com/oxalica/rust-overlay
'' (overrideToolchain deps (toolchainFromManifestFile manifestFilePath));
};
};
rustChannelOf = manifestArgs: toolchainFromManifest (selectManifest manifestArgs);
latest = (prev.latest or {}) // {
rustChannels = {
stable = rust-bin.stable.latest;
beta = rust-bin.beta.latest;
nightly = rust-bin.nightly.latest;
};
};
rustChannelOfTargets = channel: date: targets:
(final.rustChannelOf { inherit channel date; })
.rust.override { inherit targets; };
rustChannels = final.latest.rustChannels;
}