From 0c75ea5ba56f58823000e3eab807d491e9195f7c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 4 Dec 2015 18:15:39 +0100 Subject: [PATCH] Push nixpkgs-unstable branch to nixpkgs-channels Fixes https://github.com/NixOS/nixpkgs/issues/11427. --- mirror-nixpkgs.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mirror-nixpkgs.sh b/mirror-nixpkgs.sh index e0c12c3..c5cc0e9 100755 --- a/mirror-nixpkgs.sh +++ b/mirror-nixpkgs.sh @@ -4,6 +4,7 @@ releaseUrl=http://hydra.nixos.org/job/nixpkgs/trunk/unstable/latest-finished releasesDir=/data/releases/nixpkgs channelsDir=/data/releases/channels channelName=nixpkgs-unstable +export GIT_DIR=/home/hydra-mirror/nixpkgs-channels curl="curl --silent --show-error --fail" json=$($curl -L -H 'Accept: application/json' $releaseUrl) @@ -21,6 +22,13 @@ releaseDir=$releasesDir/$release echo "release is ‘$release’ (build $releaseId), eval is ‘$url’, dir is ‘$releaseDir’" >&2 +# Figure out the Git revision from which this release was +# built. FIXME: get this from Hydra directly. +git remote update nixpkgs >&2 +shortRev=$(echo "$release" | sed 's/.*\.//') +rev=$(git rev-parse "$shortRev") +echo "revision is $rev" >&2 + if [ -d $releaseDir ]; then echo "release already exists" >&2 else @@ -61,3 +69,6 @@ cat $channelsDir/.htaccess-nix* > $channelsDir/.htaccess cd "$channelsDir" rsync -avR . hydra-mirror@nixos.org:"$channelsDir" --delete >&2 + +# Update the nixpkgs-channels repo. +git push nixpkgs-channels "$rev:refs/heads/nixpkgs-unstable" >&2