infest-cac-CentOS-7-64bit: fetchgit
This commit is contained in:
parent
bea25b5640
commit
0fa8921e80
@ -4,6 +4,19 @@ set -xeuf
|
||||
serverspec=$1
|
||||
systemname=$2
|
||||
|
||||
(
|
||||
# Notice NIX_PATH used from host
|
||||
# Notice secrets required to evaluate configuration
|
||||
NIX_PATH=$NIX_PATH:nixos-config=$PWD/modules/$systemname
|
||||
NIX_PATH=$NIX_PATH:secrets=$PWD/secrets/$systemname/nix
|
||||
export NIX_PATH
|
||||
|
||||
rev=$(newbin/nixos-query nixpkgs.rev)
|
||||
url=$(newbin/nixos-query nixpkgs.url)
|
||||
|
||||
newbin/fetchgit "$rev" "$url" tmp/nixpkgs/$systemname
|
||||
)
|
||||
|
||||
./cac poll 10s 2>/dev/null &
|
||||
pollpid=$!
|
||||
trap "kill $pollpid; trap - EXIT" EXIT
|
||||
|
25
newbin/fetchgit
Executable file
25
newbin/fetchgit
Executable file
@ -0,0 +1,25 @@
|
||||
#! /bin/sh
|
||||
# usage: fetchgit REVISION URL WORKTREE
|
||||
set -euf
|
||||
|
||||
git_rev=$1
|
||||
git_url=$2
|
||||
worktree=$3
|
||||
|
||||
if [ ! -d "$worktree" ]; then
|
||||
mkdir -p "$worktree"
|
||||
fi
|
||||
|
||||
cd "$worktree"
|
||||
|
||||
git init -q
|
||||
|
||||
if ! current_url=$(git config remote.src.url); then
|
||||
git remote add src "$git_url"
|
||||
elif [ "$current_url" != "$git_url" ]; then
|
||||
git remote set-url src "$git_url"
|
||||
fi
|
||||
|
||||
git fetch src
|
||||
|
||||
git checkout "$git_rev"
|
8
newbin/nixos-query
Executable file
8
newbin/nixos-query
Executable file
@ -0,0 +1,8 @@
|
||||
#! /bin/sh
|
||||
set -euf
|
||||
nix-instantiate \
|
||||
-A config."$1" \
|
||||
--eval \
|
||||
--json \
|
||||
'<nixos>' \
|
||||
| jq -r .
|
Loading…
Reference in New Issue
Block a user