-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decouple self-dependencies and impl
lib.mkRustBin
interface (#177)
- Loading branch information
Showing
16 changed files
with
422 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ target | |
result | ||
result-* | ||
*.tmp | ||
|
||
examples/cross-aarch64/flake.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,72 @@ | ||
# Overlay interface for non-flake Nix. | ||
final: prev: | ||
(import ./rust-overlay.nix final) (prev // (import ./manifest.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 (final.rust) toRustTarget; | ||
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.