diff options
Diffstat (limited to 'nixos/modules/installer/tools/nixos-typecheck.sh')
-rw-r--r-- | nixos/modules/installer/tools/nixos-typecheck.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/nixos/modules/installer/tools/nixos-typecheck.sh b/nixos/modules/installer/tools/nixos-typecheck.sh new file mode 100644 index 00000000000..f9557be0c50 --- /dev/null +++ b/nixos/modules/installer/tools/nixos-typecheck.sh @@ -0,0 +1,52 @@ +#! /bin/sh +#! @shell@ + +if [ -x "@shell@" ]; then export SHELL="@shell@"; fi; + +set -e + +showSyntax() { +cat >&1 << EOF +nixos-typecheck +usage: + nixos-typecheck [action] [args] +where: + action = silent | printAll | printUnspecified | getSpecs + with default action: printUnspecified + args = any argument supported by nix-build +EOF +} + + +# Parse the command line. +extraArgs=() +action=printUnspecified + +while [ "$#" -gt 0 ]; do + i="$1"; shift 1 + case "$i" in + --help) + showSyntax + ;; + silent|printAll|printUnspecified|getSpecs) + action="$i" + ;; + *) + extraArgs="$extraArgs $i" + ;; + esac +done + + +if [ "$action" = silent ]; then + nix-build --no-out-link '<nixpkgs/nixos>' -A typechecker.silent $extraArgs +elif [ "$action" = printAll ]; then + nix-build --no-out-link '<nixpkgs/nixos>' -A typechecker.printAll $extraArgs +elif [ "$action" = printUnspecified ]; then + nix-build --no-out-link '<nixpkgs/nixos>' -A typechecker.printUnspecified $extraArgs +elif [ "$action" = getSpecs ]; then + ln -s $(nix-build --no-out-link '<nixpkgs/nixos>' -A typechecker.specifications $extraArgs)/share/doc/nixos/options-specs.json specifications.json +else + showSyntax + exit 1 +fi |