forked from nlewo/hydra-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
42 lines (37 loc) · 1.26 KB
/
default.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
{ pkgs ? import ./nix/nixpkgs.nix {} }:
with pkgs;
let
# TODO: fix gitignore and replace this by gitignre
# See https://github.com/NixOS/nixpkgs/issues/69138
sources = builtins.path {
name = "hydra-cli-filtered-source";
path = ./.;
filter = (path: type:
baseNameOf path != ".git" &&
baseNameOf path != "default.nix" &&
baseNameOf path != "ci" &&
baseNameOf path != "tests" &&
baseNameOf path != "target" &&
baseNameOf path != "result" &&
(! (pkgs.lib.hasSuffix ".rs.bk" path)) &&
(! (pkgs.lib.hasSuffix "~" path))
);
};
buildReadme = "${mdsh}/bin/mdsh --input ${sources}/README.md --output $out";
verifyReadme = "${buildReadme} --frozen && echo 'OK' > $out";
in
rec {
hydra-cli = ((callPackage ./Cargo.nix {}).rootCrate.build).overrideDerivation(_: {
src = sources;
doCheck = true;
checkPhase = ''
echo "Checking formatting with 'rustfmt'"
find . -name "*.rs" | xargs ${rustfmt}/bin/rustfmt --check
'';
});
readme = pkgs.runCommand "build-readme" { buildInputs = [ hydra-cli ]; } "${buildReadme}";
tests = {
readme = pkgs.runCommand "test-readme" { buildInputs = [ hydra-cli ]; } "${verifyReadme}";
vm = pkgs.callPackage ./tests/vm.nix { inherit hydra-cli; };
};
}