-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
58 lines (53 loc) · 1.44 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
mdbook-theme = {
url = "github:zjp-CN/mdbook-theme";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, crane, mdbook-theme }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
rev = if (self ? rev) then self.rev else self.dirtyRev;
book = import ./docs {
inherit pkgs crane mdbook-theme;
};
rustemo = import ./. {
inherit crane pkgs rev;
};
shellPkgs = [ pkgs.cargo-nextest rustemo.packages.compiler ];
in
{
devShells.default = pkgs.mkShell {
buildInputs = book.buildInputs ++ rustemo.buildInputs ++ shellPkgs;
};
devShells.beta = pkgs.mkShell {
buildInputs = book.buildInputs ++ [ pkgs.rust-bin.beta.latest.default ] ++ shellPkgs;
};
devShells.nightly = pkgs.mkShell {
buildInputs = book.buildInputs ++ [ pkgs.rust-bin.nightly.latest.default ] ++ shellPkgs;
};
inherit (rustemo) checks;
packages = rustemo.packages // book.packages;
}
);
nixConfig = {
bash-prompt-prefix = "rustemo-dev:";
};
}