-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
68 lines (61 loc) · 2.17 KB
/
flake.nix
File metadata and controls
68 lines (61 loc) · 2.17 KB
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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
crane.url = "github:ipetkov/crane";
devshell.url = "github:numtide/devshell";
};
outputs = { nixpkgs, rust-overlay, devshell, flake-utils, crane, ... }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
(import rust-overlay)
devshell.overlays.default
];
};
toolchain_fn = p: p.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [ "rust-src" "rust-analyzer" ];
});
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain_fn;
js_filter = path: _type: builtins.match ".*js$" path != null;
md_filter = path: _type: builtins.match ".*md$" path != null;
filter = path: type:
(js_filter path type) || (md_filter path type) || (craneLib.filterCargoSources path type);
src = pkgs.lib.cleanSourceWith {
src = ./.;
inherit filter;
name = "source";
};
columbo_meta = craneLib.crateNameFromCargoToml {
cargoToml = ./crates/columbo/Cargo.toml;
};
columbo_args = {
inherit src;
inherit (columbo_meta) pname version;
strictDeps = true;
doCheck = false;
};
cargoArtifacts = craneLib.buildDepsOnly columbo_args;
columbo = craneLib.buildPackage (columbo_args // { inherit cargoArtifacts; });
in {
devShells.default = pkgs.devshell.mkShell {
packages = [ (toolchain_fn pkgs) pkgs.gcc ];
motd = "\n Welcome to the {2}columbo{reset} shell.\n";
};
checks = {
inherit columbo;
columbo-clippy = craneLib.cargoClippy (columbo_args // {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
});
my-crate-nextest = craneLib.cargoNextest (columbo_args // {
inherit cargoArtifacts;
doCheck = true;
partitions = 1;
partitionType = "count";
cargoNextestPartitionsExtraArgs = "--no-tests=pass";
});
};
});
}