-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathflake.nix
More file actions
80 lines (72 loc) · 2.7 KB
/
flake.nix
File metadata and controls
80 lines (72 loc) · 2.7 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
69
70
71
72
73
74
75
76
77
78
79
80
{
description = "Development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
flakelight.url = "github:nix-community/flakelight";
crane.url = "github:ipetkov/crane";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { flakelight, ... } @ inputs: flakelight ./. {
inherit inputs;
withOverlays = [
inputs.rust-overlay.overlays.default
(final: { rust-bin, ... }:
let
craneLib = (inputs.crane.mkLib final).overrideToolchain rust-bin.nightly.latest.default;
commonArgs = {
src = ./lib;
pname = "antithesis-sdk-rust-workspace";
version = "0.0.0";
};
workspaceDeps = craneLib.buildDepsOnly commonArgs;
workspace = craneLib.buildPackage (commonArgs // {
cargoArtifacts = workspaceDeps;
});
workspaceEmptyFeature = craneLib.buildPackage (commonArgs // {
cargoArtifacts = workspaceDeps;
cargoExtraArgs = "--no-default-features"; # Disable the default `full` feature for builds.
cargoTestExtraArgs = "-F full -F rand_v0_8"; # But enable the `full` and `rand_v0_8` feature when running `cargo test`.
});
clippy = craneLib.cargoClippy (commonArgs // {
cargoArtifacts = workspaceDeps;
cargoClippyExtraArgs = "--all-targets -- -D warnings";
});
test = craneLib.cargoTest (commonArgs // {
cargoArtifacts = workspaceDeps;
});
doc = craneLib.cargoDoc (commonArgs // {
cargoArtifacts = workspaceDeps;
});
in
{
antithesis-sdk-rust = {
inherit workspace workspaceEmptyFeature clippy test doc;
};
})
];
packages = rec {
default = workspace;
workspace = pkgs: pkgs.antithesis-sdk-rust.workspace;
doc = pkgs: pkgs.antithesis-sdk-rust.doc;
};
apps = rec {
default = simple;
simple = pkgs: "${pkgs.antithesis-sdk-rust-workspace}/bin/simple";
};
devShells.default = pkgs: {
inputsFrom = with pkgs; [ antithesis-sdk-rust.workspace ];
packages = with pkgs; [ rust-analyzer cargo-msrv cargo-semver-checks ];
};
# TODO: Perform semver check.
checks = { antithesis-sdk-rust, ... }: {
inherit (antithesis-sdk-rust) workspaceEmptyFeature clippy test;
};
# TODO: Decide whether we want auto formatting.
# formatters = pkgs: {
# "*.rs" = "${pkgs.rustfmt}/bin/rustfmt";
# "*.nix" = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt";
# };
flakelight.builtinFormatters = false;
};
}