about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-06-22T15·12+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-06-22T15·12+0000
commit3093af58a7e9d3f0315a1a1040d3cfeaea051ba6 (patch)
treeeb4c6475a907dedc5d6a9b35b5e29b760e9150f9
parentb302e5f63b96c945fa66d391c2d3165d7003a297 (diff)
* A utility script `nix-build' that builds Nix expressions and prints
  their output paths (and only that) on standard output.

-rw-r--r--scripts/Makefile.am13
-rwxr-xr-xscripts/nix-build.in23
2 files changed, 30 insertions, 6 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 7e429aabe8e5..d4fa169bd25f 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,6 +1,6 @@
 bin_SCRIPTS = nix-collect-garbage \
- nix-pull nix-push nix-prefetch-url \
- nix-install-package nix-channel
+  nix-pull nix-push nix-prefetch-url \
+  nix-install-package nix-channel nix-build
 
 noinst_SCRIPTS = nix-profile.sh
 
@@ -18,7 +18,8 @@ install-exec-local: readmanifest.pm
 include ../substitute.mk
 
 EXTRA_DIST = nix-collect-garbage.in \
- nix-pull.in nix-push.in nix-profile.sh.in \
- nix-prefetch-url.in nix-install-package.in \
- nix-channel.in \
- prebuilts.conf readmanifest.pm.in
+  nix-pull.in nix-push.in nix-profile.sh.in \
+  nix-prefetch-url.in nix-install-package.in \
+  nix-channel.in \
+  prebuilts.conf readmanifest.pm.in \
+  nix-build.in
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
new file mode 100755
index 000000000000..a50901135ed6
--- /dev/null
+++ b/scripts/nix-build.in
@@ -0,0 +1,23 @@
+#! @shell@ -e
+
+nixExpr=$1
+
+if test -z "$nixExpr"; then
+    echo "syntax: $0 NIX-EXPR..." >&2
+    exit 1
+fi
+
+extraArgs=
+
+for i in "$@"; do
+    case "$i" in
+        -*)
+            extraArgs="$extraArgs $i"
+            ;;
+        *)
+            storeExpr=$(nix-instantiate "$i")
+            echo "store expression is $storeExpr" >&2
+            nix-store -qnfv $extraArgs $storeExpr
+            ;;
+    esac
+done