summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fetchgit (renamed from bin/nixos-fetch-git)15
-rwxr-xr-xbin/new-nixos-query8
-rwxr-xr-xbin/nixos-build13
3 files changed, 24 insertions, 12 deletions
diff --git a/bin/nixos-fetch-git b/bin/fetchgit
index 7002208b5..b9fe90854 100755
--- a/bin/nixos-fetch-git
+++ b/bin/fetchgit
@@ -1,17 +1,10 @@
#! /bin/sh
-#
-# nixos-fetch-git : nixos-config -> ...
-#
+# usage: fetchgit REVISION URL WORKTREE
set -euf
-host=$1
-
-target=root@$host
-
-git_rev=$(nixos-query "$host" nixpkgs.rev)
-git_url=$(nixos-query "$host" nixpkgs.url)
-
-worktree=$nixpkgs_root/$host
+git_rev=$1
+git_url=$2
+worktree=$3
if [ ! -d "$worktree" ]; then
mkdir -p "$worktree"
diff --git a/bin/new-nixos-query b/bin/new-nixos-query
new file mode 100755
index 000000000..57761b520
--- /dev/null
+++ b/bin/new-nixos-query
@@ -0,0 +1,8 @@
+#! /bin/sh
+set -euf
+nix-instantiate \
+ -A config."$1" \
+ --eval \
+ --json \
+ '<nixos>' \
+ | jq -r .
diff --git a/bin/nixos-build b/bin/nixos-build
index 79b052654..94f3dc1f4 100755
--- a/bin/nixos-build
+++ b/bin/nixos-build
@@ -14,7 +14,18 @@ nixos_config=$config_root/modules/$host
secrets_nix=$secrets_root/$host/nix
secrets_rsync=$secrets_root/$host/rsync
-nixos-fetch-git "$host"
+(
+ # Notice NIX_PATH used from host
+ # Notice secrets required to evaluate configuration
+ NIX_PATH=$NIX_PATH:nixos-config=$nixos_config
+ NIX_PATH=$NIX_PATH:secrets=$secrets_nix
+ export NIX_PATH
+
+ rev=$(new-nixos-query nixpkgs.rev)
+ url=$(new-nixos-query nixpkgs.url)
+
+ fetchgit "$rev" "$url" tmp/nixpkgs/$host
+)
nix-build \
-I "$nixpkgs" \