-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathflake.nix
40 lines (33 loc) · 928 Bytes
/
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
{
description = "RustBookEs flake";
inputs = {
crane.url = "github:ipetkov/crane";
fenix.url = "github:nix-community/fenix";
};
outputs = { nixpkgs, fenix, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
crane = inputs.crane.mkLib pkgs;
toolchain = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain;
sha256 = "sha256-opUgs6ckUQCyDxcB9Wy51pqhd0MPGHUVbwRKKPGiwZU=";
};
craneLib = crane.overrideToolchain toolchain;
commonArgs = {
doCheck = false;
src = lib.cleanSourceWith {
src = craneLib.path ./..;
};
};
book = craneLib.buildPackage (commonArgs // {
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
});
in
{
devShells.${system}.default = craneLib.devShell {
packages = with pkgs; [ toolchain mdbook ];
};
};
}