forked from cargo2nix/cargo2nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
47 lines (39 loc) · 1.41 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
rust-overlay:
let
# Overlay is what provides all of Cargo2nix's modifications to nixpkgs
cargo2nixOverlay = final: prev:
let
inherit (final) lib newScope;
pkgs = final;
scope = final:
let
inherit (final) callPackage;
in
{
rustLib = callPackage ./lib { };
makePackageSetInternal = callPackage ./make-package-set/internal.nix { };
makePackageSet = pkgs.callPackage ./make-package-set/user-facing.nix { };
mkRustCrate = import ./mkcrate.nix;
mkRustCrateNoBuild = callPackage ./mkcrate-nobuild.nix;
overrides = callPackage ./overrides.nix { };
runTests = callPackage ./run-tests.nix { };
workspaceShell = import ./workspace-shell.nix;
};
in
{
# The single top-level attribute that user-facing API's are exposed through
rustBuilder = lib.makeScope newScope scope;
};
in rec {
# These three overlays are exposed in the cargo2nix flake as cargo2nix.overlays
# The combined overlay is the most conveient to use.
inherit rust-overlay;
cargo2nix = cargo2nixOverlay;
default = combined;
combined = final: prev:
let
composeOverlays = overlays: final: prev:
prev.lib.foldl' (prev.lib.flip prev.lib.extends) (prev.lib.const prev) overlays final;
in
composeOverlays [ rust-overlay cargo2nixOverlay ] final prev;
}