summaryrefslogtreecommitdiff
path: root/archived/projt-launcher/ci/parse.nix
blob: 96652c7a95b202b9f3e90efbeab9f3a59cb5d9af (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
# ProjT Launcher Nix File Parser
# Validates all .nix files in the project for syntax errors

{
  lib,
  nix,
  runCommand,
}:
let
  nixFiles = lib.fileset.toSource {
    root = ../.;
    fileset = lib.fileset.fileFilter (file: file.hasExt "nix") ../.;
  };
in
runCommand "projt-nix-parse-${nix.name}"
  {
    nativeBuildInputs = [
      nix
    ];
  }
  ''
    export NIX_STORE_DIR=$TMPDIR/store
    export NIX_STATE_DIR=$TMPDIR/state
    nix-store --init

    cd "${nixFiles}"

    echo "Parsing Nix files in ProjT Launcher..."

    # Parse all .nix files to check for syntax errors
    find . -type f -iname '*.nix' | while read file; do
      echo "Checking: $file"
      nix-instantiate --parse "$file" >/dev/null
    done

    echo "All Nix files parsed successfully!"
    touch $out
  ''