diff options
author | tv <tv@shackspace.de> | 2015-06-24 20:10:41 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-06-24 20:11:02 +0200 |
commit | d4ca5907d67c4f2374b6231ff03d8ed36b39ec96 (patch) | |
tree | adaaca4d329501aeafb20d6cec6afaf81d0bdfe1 /bin | |
parent | 0fa8921e803876d85e1a0d49d925c2919714ee56 (diff) |
s/nixos-fetch-git/fetchgit/
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fetchgit (renamed from bin/nixos-fetch-git) | 15 | ||||
-rwxr-xr-x | bin/new-nixos-query | 8 | ||||
-rwxr-xr-x | bin/nixos-build | 13 |
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" \ |