This repository has been archived by the owner on Apr 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
76 lines (70 loc) · 2.72 KB
/
flake.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
72
73
74
75
76
{ inputs =
{ cargo2nix.url = "github:cargo2nix/cargo2nix";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { cargo2nix, flake-utils, nixpkgs, rust-overlay, ... }:
with builtins;
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs =
import nixpkgs
{ overlays =
[ (import "${cargo2nix}/overlay")
rust-overlay.overlay
];
inherit system;
};
rustChannel = "1.58.1";
rustPkgs =
pkgs.rustBuilder.makePackageSet'
{ inherit rustChannel;
packageFun = import ./Cargo.nix;
packageOverrides =
let
expat-sys = pkgs.rustBuilder.rustLib.makeOverride {
name = "expat-sys";
overrideAttrs = drv: {
propagatedBuildInputs = drv.propagatedBuildInputs or [ ] ++ [ pkgs.expat ];
};
};
freetype-sys = pkgs.rustBuilder.rustLib.makeOverride {
name = "freetype-sys";
overrideAttrs = drv: {
propagatedBuildInputs = drv.propagatedBuildInputs or [ ] ++ [ pkgs.freetype ];
};
};
in
pkgs: pkgs.rustBuilder.overrides.all ++ [ expat-sys freetype-sys ];
};
in
{ # defaultPackage = rustPkgs.workspace.halo2-example {};
devShell =
let
rust-toolchain =
(pkgs.formats.toml {}).generate "rust-toolchain.toml"
{ toolchain =
{ channel = rustChannel;
components =
[ "rustc"
"rust-src"
"cargo"
"clippy"
"rust-docs"
];
};
};
in
rustPkgs.workspaceShell {
nativeBuildInputs = with pkgs; [ rust-analyzer rustup cargo2nix.defaultPackage.${system} ];
shellHook =
''
cp --no-preserve=mode ${rust-toolchain} rust-toolchain.toml
export RUST_SRC_PATH=~/.rustup/toolchains/${rustChannel}-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/
'';
};
}
);
}