@@ -0,0 +1,20 @@
1+#!/usr/bin/env nix-shell
2+#!nix-shell -i bash -p curl common-updater-scripts jq
3+
4+set -eu -o pipefail
5+
6+oldVersion="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.version or (builtins.parseDrvName oh-my-zsh.name).version" | tr -d '"')"
7+latestSha="$(curl -L -s https://api.github.com/repos/robbyrussell/oh-my-zsh/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')"
8+url="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.src.url" | tr -d '"')"
9+
10+if [ ! "null" = "${latestSha}" ]; then
11+ latestDate="$(curl -L -s https://api.github.com/repos/robbyrussell/oh-my-zsh/commits/${latestSha} | jq '.commit.author.date' | sed 's|"\(.*\)T.*|\1|g')"
12+ update-source-version oh-my-zsh "${latestSha}" --version-key=rev
13+ update-source-version oh-my-zsh "${latestDate}" --ignore-same-hash
14+ nixpkgs="$(git rev-parse --show-toplevel)"
15+ default_nix="$nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix"
16+ git add "${default_nix}"
17+ git commit -m "oh-my-zsh: ${oldVersion} -> ${latestDate}"
18+else
19+ echo "oh-my-zsh is already up-to-date"
20+fi