diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2020-11-06 12:51:56 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2020-11-06 12:51:56 +0100 |
commit | 99fb79ae843e9bc29513365e17418d4f1aee4ce0 (patch) | |
tree | 95fe1827d215ad2d101d15590332a8b46c09dc4c /pkgs/shells | |
parent | c7176d55ac8a801a0368014a3c76c4ebbd5eacaa (diff) | |
parent | da04a8e39741bbf336344b75b9842f2a7dc76ac1 (diff) |
Merge master into staging-next
Diffstat (limited to 'pkgs/shells')
-rw-r--r-- | pkgs/shells/zsh/oh-my-zsh/default.nix | 45 | ||||
-rwxr-xr-x | pkgs/shells/zsh/oh-my-zsh/update.sh | 19 |
2 files changed, 41 insertions, 23 deletions
diff --git a/pkgs/shells/zsh/oh-my-zsh/default.nix b/pkgs/shells/zsh/oh-my-zsh/default.nix index e7433e2de0b83..7c402b4733f55 100644 --- a/pkgs/shells/zsh/oh-my-zsh/default.nix +++ b/pkgs/shells/zsh/oh-my-zsh/default.nix @@ -1,18 +1,19 @@ # This script was inspired by the ArchLinux User Repository package: # # https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=oh-my-zsh-git -{ stdenv, fetchFromGitHub }: +{ stdenv, fetchFromGitHub, nixosTests, writeScript, common-updater-scripts, git +, nix, nixfmt, jq, coreutils, gnused, curl, cacert }: stdenv.mkDerivation rec { - version = "2020-10-29"; + version = "2020-11-04"; pname = "oh-my-zsh"; - rev = "852a44094a3bb4df39f8f778bc7ada2ddda09727"; + rev = "3e6ee85a161c8089955c19364728e167025a911d"; src = fetchFromGitHub { inherit rev; owner = "ohmyzsh"; repo = "ohmyzsh"; - sha256 = "0021rayw5wiwgjfwy7d6g577xidws58vk7y9xxhidnmk9sr4vri7"; + sha256 = "/8ySf5ulSx2HtPG/tzPzOI1ljksxF+hGwjXFhGIseBk="; }; installPhase = '' @@ -65,6 +66,42 @@ stdenv.mkDerivation rec { EOF ''; + passthru = { + tests = { inherit (nixosTests) oh-my-zsh; }; + + updateScript = writeScript "update.sh" '' + #!${stdenv.shell} + set -o errexit + PATH=${ + stdenv.lib.makeBinPath [ + common-updater-scripts + curl + cacert + git + nixfmt + nix + jq + coreutils + gnused + ] + } + + oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion oh-my-zsh" | tr -d '"')" + latestSha="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits\?sha\=master\&since\=$oldVersion | jq -r '.[0].sha')" + + if [ ! "null" = "$latestSha" ]; then + nixpkgs="$(git rev-parse --show-toplevel)" + default_nix="$nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix" + latestDate="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits/$latestSha | jq '.commit.author.date' | sed 's|"\(.*\)T.*|\1|g')" + update-source-version oh-my-zsh "$latestSha" --version-key=rev + update-source-version oh-my-zsh "$latestDate" --ignore-same-hash + nixfmt "$default_nix" + else + echo "${pname} is already up-to-date" + fi + ''; + }; + meta = with stdenv.lib; { description = "A framework for managing your zsh configuration"; longDescription = '' diff --git a/pkgs/shells/zsh/oh-my-zsh/update.sh b/pkgs/shells/zsh/oh-my-zsh/update.sh deleted file mode 100755 index 738c0810737ae..0000000000000 --- a/pkgs/shells/zsh/oh-my-zsh/update.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p curl common-updater-scripts jq - -set -eu -o pipefail - -oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion oh-my-zsh" | tr -d '"')" -latestSha="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')" - -if [ ! "null" = "${latestSha}" ]; then - latestDate="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits/${latestSha} | jq '.commit.author.date' | sed 's|"\(.*\)T.*|\1|g')" - update-source-version oh-my-zsh "${latestSha}" --version-key=rev - update-source-version oh-my-zsh "${latestDate}" --ignore-same-hash - nixpkgs="$(git rev-parse --show-toplevel)" - default_nix="$nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix" - git add "${default_nix}" - git commit -m "oh-my-zsh: ${oldVersion} -> ${latestDate}" -else - echo "oh-my-zsh is already up-to-date" -fi |