forked from JakeWharton/gitout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
107 lines (90 loc) · 3.01 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
96
97
98
99
100
101
102
103
104
105
106
107
{
description = "package definition and devshell for gitout";
inputs.nixpkgs.url = "github:msfjarvis/nixpkgs/nixpkgs-unstable";
inputs.systems.url = "github:msfjarvis/flake-systems";
inputs.advisory-db.url = "github:rustsec/advisory-db";
inputs.advisory-db.flake = false;
inputs.crane.url = "github:ipetkov/crane";
inputs.devshell.url = "github:numtide/devshell";
inputs.devshell.inputs.nixpkgs.follows = "nixpkgs";
inputs.fenix.url = "github:nix-community/fenix";
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-utils.inputs.systems.follows = "systems";
inputs.flake-compat.url = "github:nix-community/flake-compat";
inputs.flake-compat.flake = false;
outputs = {
nixpkgs,
advisory-db,
crane,
devshell,
fenix,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [devshell.overlays.default];
};
rustStable = (import fenix {inherit pkgs;}).fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk=";
};
graphqlFilter = path: builtins.match ".*graphql$" path != null;
filter = path: type: (graphqlFilter path) || (craneLib.filterCargoSources path type);
craneLib = (crane.mkLib pkgs).overrideToolchain rustStable;
commonArgs = {
src = pkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
inherit filter;
};
buildInputs = [];
nativeBuildInputs = with pkgs;[perl pkg-config];
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
};
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {doCheck = false;});
gitout = craneLib.buildPackage (commonArgs // {doCheck = false;});
gitout-clippy = craneLib.cargoClippy (commonArgs
// {
inherit cargoArtifacts;
});
gitout-fmt = craneLib.cargoFmt (commonArgs // {});
gitout-audit = craneLib.cargoAudit (commonArgs // {inherit advisory-db;});
gitout-nextest = craneLib.cargoNextest (commonArgs
// {
inherit cargoArtifacts;
src = ./.;
partitions = 1;
partitionType = "count";
});
in {
checks = {
inherit gitout;
# There are some deprecated dependencies that need to be replaced
#inherit gitout-audit;
inherit gitout-clippy;
inherit gitout-fmt;
inherit gitout-nextest;
};
packages.default = gitout;
apps.default = flake-utils.lib.mkApp {drv = gitout;};
devShells.default = pkgs.devshell.mkShell {
bash = {interactive = "";};
env = [
{
name = "DEVSHELL_NO_MOTD";
value = 1;
}
];
packages = with pkgs; [
cargo-nextest
cargo-release
gnumake
perl
rustStable
stdenv.cc
];
};
});
}