diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 55 |
1 files changed, 48 insertions, 7 deletions
@@ -1,12 +1,16 @@ | |||
1 | { | 1 | { |
2 | inputs = { | 2 | inputs = { |
3 | nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.*.tar.gz"; | 3 | nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.*.tar.gz"; |
4 | flake-utils.url = "https://flakehub.com/f/numtide/flake-utils/0.1.88.tar.gz"; | 4 | flake-utils.url = "https://flakehub.com/f/numtide/flake-utils/0.1.90.tar.gz"; |
5 | crane.url = "https://flakehub.com/f/ipetkov/crane/0.15.1.tar.gz"; | 5 | crane.url = "https://flakehub.com/f/ipetkov/crane/0.16.0.tar.gz"; |
6 | crane.inputs.nixpkgs.follows = "nixpkgs"; | 6 | crane.inputs.nixpkgs.follows = "nixpkgs"; |
7 | advisory-db = { | ||
8 | url = "github:rustsec/advisory-db"; | ||
9 | flake = false; | ||
10 | }; | ||
7 | }; | 11 | }; |
8 | 12 | ||
9 | outputs = { self, crane, nixpkgs, flake-utils, ... }@inputs: | 13 | outputs = { self, nixpkgs, flake-utils, crane, advisory-db, ... }@inputs: |
10 | flake-utils.lib.eachDefaultSystem | 14 | flake-utils.lib.eachDefaultSystem |
11 | (system: | 15 | (system: |
12 | let | 16 | let |
@@ -16,19 +20,56 @@ | |||
16 | }; | 20 | }; |
17 | 21 | ||
18 | craneLib = crane.lib.${system}; | 22 | craneLib = crane.lib.${system}; |
23 | src = craneLib.cleanCargoSource (craneLib.path ./.); | ||
19 | 24 | ||
20 | gitolfs3 = craneLib.buildPackage { | 25 | commonArgs = { |
26 | inherit src; | ||
27 | strictDeps = true; | ||
21 | pname = "gitolfs3"; | 28 | pname = "gitolfs3"; |
22 | version = "0.1.0"; | 29 | version = "0.1.0"; |
23 | src = craneLib.cleanCargoSource (craneLib.path ./.); | ||
24 | }; | 30 | }; |
31 | |||
32 | cargoArtifacts = craneLib.buildDepsOnly commonArgs; | ||
33 | |||
34 | gitolfs3 = craneLib.buildPackage (commonArgs // { | ||
35 | # We already have the gitolfs3-nextest check | ||
36 | doCheck = false; | ||
37 | }); | ||
25 | in | 38 | in |
26 | { | 39 | { |
40 | checks = { | ||
41 | inherit gitolfs3; | ||
42 | |||
43 | gitolfs3-clippy = craneLib.cargoClippy (commonArgs // { | ||
44 | inherit cargoArtifacts; | ||
45 | cargoClippyExtraArgs = "--all-targets -- --deny warnings"; | ||
46 | }); | ||
47 | |||
48 | gitolfs3-doc = craneLib.cargoDoc (commonArgs // { | ||
49 | inherit cargoArtifacts; | ||
50 | }); | ||
51 | |||
52 | # Check formatting | ||
53 | gitolfs3-fmt = craneLib.cargoFmt commonArgs; | ||
54 | |||
55 | # Audit dependencies | ||
56 | gitolfs3-audit = craneLib.cargoAudit (commonArgs // { | ||
57 | inherit advisory-db; | ||
58 | }); | ||
59 | |||
60 | # Run tests with cargo-nextest | ||
61 | gitolfs3-nextest = craneLib.cargoNextest (commonArgs // { | ||
62 | inherit cargoArtifacts; | ||
63 | partitions = 1; | ||
64 | partitionType = "count"; | ||
65 | }); | ||
66 | }; | ||
67 | |||
27 | packages.gitolfs3 = gitolfs3; | 68 | packages.gitolfs3 = gitolfs3; |
28 | packages.default = self.packages.${system}.gitolfs3; | 69 | packages.default = self.packages.${system}.gitolfs3; |
29 | 70 | ||
30 | devShells.default = pkgs.mkShell { | 71 | devShells.default = craneLib.devShell { |
31 | inputsFrom = [ gitolfs3 ]; | 72 | checks = self.checks.${system}; |
32 | }; | 73 | }; |
33 | 74 | ||
34 | formatter = pkgs.nixpkgs-fmt; | 75 | formatter = pkgs.nixpkgs-fmt; |