-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathflake.nix
More file actions
78 lines (71 loc) · 2.2 KB
/
flake.nix
File metadata and controls
78 lines (71 loc) · 2.2 KB
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
72
73
74
75
76
77
78
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
crane,
flake-utils,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
rustToolchainFor =
p:
p.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
targets = [ "wasm32-unknown-unknown" ];
};
rustToolchain = rustToolchainFor pkgs;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchainFor;
src = ./.;
in
{
packages.default = craneLib.buildPackage {
src = src;
pname = "pop-cli";
strictDeps = true;
cargoVendorDir = craneLib.vendorMultipleCargoDeps {
inherit (craneLib.findCargoFiles src) cargoConfigs;
cargoLockList = [
./Cargo.lock
# Unfortunately this approach requires IFD (import-from-derivation)
# otherwise Nix will refuse to read the Cargo.lock from our toolchain
# (unless we build with `--impure`).
#
# Another way around this is to manually copy the rustlib `Cargo.lock`
# to the repo and import it with `./path/to/rustlib/Cargo.lock` which
# will avoid IFD entirely but will require manually keeping the file
# up to date!
"${rustToolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock"
];
};
nativeBuildInputs = with pkgs; [
protobuf
perl
];
# Disabled cause some tests doesn't pass and make the build fail (?)
doCheck = false;
};
}
)
// {
overlays.default = final: prev: {
pop-cli = self.packages.${final.system}.default;
};
};
}