diff options
author | Mx Kookie <kookie@spacekookie.de> | 2020-12-09 18:55:19 +0000 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-12-09 18:55:19 +0000 |
commit | 80d90d9b204f7c17912740f9f414fe5d59f293ba (patch) | |
tree | 5f2065a06e724270610760d59d01c6888b375a46 /infra/libkookie/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix | |
parent | 3a31a84c7d3e589035ad08499206aac44a81f424 (diff) | |
parent | 83cbad92d73216bb0d9187c56cce0b91f9121d5a (diff) |
Merge commit '83cbad92d73216bb0d9187c56cce0b91f9121d5a' into main
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix')
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix b/infra/libkookie/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix index 73fd6ceeb061..8fbbfd47fb95 100644 --- a/infra/libkookie/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix +++ b/infra/libkookie/nixpkgs/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-15"; + version = "2020-11-26"; pname = "oh-my-zsh"; - rev = "5b717ab3e4bfb627a936d7c04367a39867734d63"; + rev = "05e2956dc61198d4767b96d97c5d10c93cedd6e3"; src = fetchFromGitHub { inherit rev; owner = "ohmyzsh"; repo = "ohmyzsh"; - sha256 = "0qm0mdvcvf5s6ypbq7z1x286sdv6ii2yfqvv1dss7zqjbg5j08gz"; + sha256 = "1Eh6L92hvSHcQeQL+1bCDrg/2FKaZshKTTF2PeVGhLs="; }; 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.committer.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 = '' |