blob: 0b471d0ffdeb88e9c7b83d1dfe44209f5126e2b5 (
plain) (
blame)
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
108
109
110
111
112
113
114
115
|
{
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2405.*.tar.gz";
flake-utils.url = "https://flakehub.com/f/numtide/flake-utils/0.1.101.tar.gz";
crane = {
url = "https://flakehub.com/f/ipetkov/crane/0.19.1.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
advisory-db = {
url = "github:rustsec/advisory-db";
flake = false;
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};
outputs = { self, nixpkgs, flake-utils, crane, rust-overlay, advisory-db, ... }@inputs:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
};
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
src =
let docsFilter = path: _type: builtins.match ".*docs/man/.*\.[1-9]$" path != null;
docsOrCargo = path: type:
(docsFilter path type) || (craneLib.filterCargoSources path type);
in pkgs.lib.cleanSourceWith {
src = craneLib.path ./.;
filter = docsOrCargo;
};
commonArgs = {
inherit src;
strictDeps = true;
pname = "gitolfs3";
version = "0.1.0";
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
gitolfs3 = (craneLib.buildPackage (commonArgs // {
# We already have the gitolfs3-nextest check
doCheck = false;
})).overrideAttrs(old: old // {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [
pkgs.installShellFiles
];
postInstall = (old.postInstall or "") + ''
installManPage docs/man/gitolfs3-authenticate.1
installManPage docs/man/gitolfs3-server.1
installManPage docs/man/gitolfs3-shell.1
'';
outputs = [ "out" ];
});
in
{
checks = {
inherit gitolfs3;
gitolfs3-clippy = craneLib.cargoClippy (commonArgs // {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
});
gitolfs3-doc = craneLib.cargoDoc (commonArgs // {
inherit cargoArtifacts;
});
# Check formatting
gitolfs3-fmt = craneLib.cargoFmt commonArgs;
# Audit dependencies
gitolfs3-audit = craneLib.cargoAudit (commonArgs // {
inherit advisory-db;
});
# Run tests with cargo-nextest
gitolfs3-nextest = craneLib.cargoNextest (commonArgs // {
inherit cargoArtifacts;
partitions = 1;
partitionType = "count";
});
};
packages.gitolfs3 = gitolfs3;
packages.default = self.packages.${system}.gitolfs3;
devShells.default = craneLib.devShell {
checks = self.checks.${system};
packages = [ rustToolchain pkgs.rust-analyzer ];
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
};
formatter = pkgs.nixpkgs-fmt;
});
}
|