forked from icewind1991/steam-vent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
95 lines (91 loc) · 2.52 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
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
naersk.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.inputs.flake-utils.follows = "utils";
};
outputs = {
self,
nixpkgs,
utils,
naersk,
rust-overlay,
}:
utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = (import nixpkgs) {
inherit system overlays;
};
inherit (builtins) listToAttrs fromTOML readFile;
lib = pkgs.lib;
naersk' = pkgs.callPackage naersk {};
srcFilters = ["Cargo.*" "(src|derive|benches|tests|examples|crypto|protobuf)(/.*)?"];
src = lib.sources.sourceByRegex ./. srcFilters;
buildDeps = with pkgs; [
pkg-config
openssl
];
msrv = (fromTOML (readFile ./Cargo.toml)).package.rust-version;
msrvToolchain = pkgs.rust-bin.stable."${msrv}".default;
naerskMsrv = let
toolchain = msrvToolchain;
in
pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
};
nearskOpt = {
inherit src;
pname = "steam-vent";
nativeBuildInputs = buildDeps;
};
in rec {
packages = {
check = naersk'.buildPackage (nearskOpt
// {
mode = "check";
});
clippy = naersk'.buildPackage (nearskOpt
// {
mode = "clippy";
});
test = naersk'.buildPackage (nearskOpt
// {
release = false;
mode = "test";
});
test-crypto = naersk'.buildPackage (nearskOpt
// {
release = false;
mode = "test";
cargoTestOptions = x: x ++ ["-p" "steam-vent-crypto"];
});
msrv = naerskMsrv.buildPackage (nearskOpt
// {
mode = "check";
});
proto-builder = naersk'.buildPackage {
src = lib.sources.sourceByRegex ./protobuf/build srcFilters;
};
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs;
[
rust-bin.stable.latest.default
bacon
cargo-edit
cargo-outdated
clippy
cargo-audit
cargo-msrv
cargo-fuzz
cargo-semver-checks
]
++ buildDeps;
};
});
}