-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
98 lines (86 loc) · 2.24 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
description = "Basic Rust dev environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = github:edolstra/flake-compat;
flake = false;
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
flake-compat,
fenix,
}:
flake-utils.lib.eachDefaultSystem
(
system: let
overlays = [fenix.overlays.default];
pkgs = import nixpkgs {inherit system overlays;};
projectConfig = builtins.fromTOML (builtins.readFile ./Cargo.toml);
package = let
toolchain = fenix.packages.${system}.stable.toolchain;
in
(pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
})
.buildRustPackage {
pname = projectConfig.package.name;
version = projectConfig.package.version;
src = ./.;
doCheck = false;
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs = with pkgs; [
icu
];
cargoLock = {
lockFile = ./Cargo.lock;
};
};
in {
packages = flake-utils.lib.flattenTree {
main = package;
};
defaultPackage = package;
devShell =
pkgs.mkShell
{
buildInputs = with pkgs; [
(
with fenix.packages.${system};
combine [
stable.rustc
stable.cargo
stable.rust-src
stable.rustfmt
]
)
cargo-edit
cargo-update
cargo-geiger
cargo-outdated
cargo-audit
cargo-expand
cocogitto
pkg-config
icu
clang
llvmPackages.libclang.lib
];
shellHook = with pkgs; ''
export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib"
'';
};
}
);
}