This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
flake.nix
67 lines (61 loc) · 1.54 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
utils.url = "github:numtide/flake-utils";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
utils,
naersk,
fenix,
...
}:
utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}";
toolchain = with fenix.packages."${system}";
combine [
latest.rustc
latest.cargo
latest.clippy
latest.rustfmt
latest.rust-analyzer
latest.rust-src
];
naersk-lib = naersk.lib."${system}".override {
cargo = toolchain;
rustc = toolchain;
clippy = toolchain;
rustfmt = toolchain;
rust-analyzer = toolchain;
rust-src = toolchain;
};
in rec
{
packages.jade = naersk-lib.buildPackage {
pname = "Jade";
root = ./.;
};
packages.default = packages.jade;
apps.jade = utils.lib.mkApp {
drv = packages.jade;
};
apps.default = apps.jade;
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
toolchain
];
# For rust-analyzer
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
formatter = pkgs.alejandra;
});
}