nixpkgs-update/ups.sh
Matthew Justin Bauer fc02d11a8c
Automatically clone 'nixpkgs'
nixpkgs cache is stored in $HOME/.cache/nixpkgs. Will setup upstream and origin correctly to be used later on with 'hub'.
2018-03-17 12:18:32 -05:00

43 lines
876 B
Bash
Executable File

#! /usr/bin/env bash
set -euxo pipefail
LOG_FILE=~/.nix-update/ups.log
mkdir -p "$(dirname $LOG_FILE)"
touch $LOG_FILE
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ARGUMENTS=""
NIXPKGS=$HOME/.cache/nixpkgs
if ! [ -d "$NIXPKGS" ]
then
hub clone nixpkgs $NIXPKGS # requires that user has forked nixpkgs
cd $NIXPKGS
git remote add upstream https://github.com/NixOS/nixpkgs
git fetch upstream
git fetch origin staging
git fetch upstream staging
fi
cd $NIXPKGS
export DRY_RUN=true
echo "
$(date -Iseconds) New run of ups.sh" >> $LOG_FILE
IFS=$'\n'
for a in $ARGUMENTS
do
unset IFS
echo "$(date -Iseconds) $a" >> $LOG_FILE
if eval "$SCRIPT_DIR/up.sh $a 3>>$LOG_FILE"
then
echo "$(date -Iseconds) SUCCESS" >> $LOG_FILE
sleep 900
else
echo "$(date -Iseconds) FAIL" >> $LOG_FILE
fi
done