blob: d967759a7cec88458812716545ad04c9392b8fbb (
plain)
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
|
let
sources = import ./npins;
in
# Dogfood the library
import ./default.nix { inherit sources; } (
{ lib, pkgs, ... }:
let
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.gitTracked ./.;
};
# Check a minimal example
basicTest = import ./default.nix { inherit sources; } {
outputs = {
foo = "bar";
};
};
# Make sure extending outputs works
extendedTest = basicTest.extendCores (
{ lib, ... }:
{
outputs.foo = lib.mkForce "baz";
}
);
in
assert basicTest.foo == "bar";
assert extendedTest.foo == "baz";
{
outputs = {
deadnix = pkgs.runCommand "check-deadnix" { nativeBuildInputs = [ pkgs.deadnix ]; } ''
deadnix --exclude ${src}/npins/default.nix --fail ${src}
touch $out
'';
nixfmt = pkgs.runCommand "check-nixfmt" { nativeBuildInputs = [ pkgs.nixfmt-rfc-style ]; } ''
nixfmt --check ${src}/**.nix
touch $out
'';
statix = pkgs.runCommand "check-statix" { nativeBuildInputs = [ pkgs.statix ]; } ''
statix check --ignore 'npins/default.nix' ${src}
touch $out
'';
# Make sure our demo works too
demo-hello = ((import ./demo/default.nix).extendCores { inherit sources; }).hello;
};
}
)
|