aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix
diff options
context:
space:
mode:
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.nix45
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 = ''