nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 nix,
4 runCommand,
5}:
6let
7 nixpkgs =
8 with lib.fileset;
9 toSource {
10 root = ../.;
11 fileset = (fileFilter (file: file.hasExt "nix") ../.);
12 };
13in
14runCommand "nix-parse-${nix.name}"
15 {
16 nativeBuildInputs = [
17 nix
18 ];
19 }
20 ''
21 export NIX_STORE_DIR=$TMPDIR/store
22 export NIX_STATE_DIR=$TMPDIR/state
23 nix-store --init
24
25 cd "${nixpkgs}"
26
27 # This will only show the first parse error, not all of them. That's fine, because
28 # the other CI jobs will report in more detail. This job is about checking parsing
29 # across different implementations / versions, not about providing the best DX.
30 # Returning all parse errors requires significantly more resources.
31 find . -type f -iname '*.nix' | xargs -P $(nproc) nix-instantiate --parse >/dev/null
32
33 touch $out
34 ''