Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 51f2519a68b5
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3a6feb7ec7a3
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Nov 4, 2020

  1. oh-my-zsh: Update script

    NeQuissimus committed Nov 4, 2020
    Copy the full SHA
    9907a2d View commit details

Commits on Nov 5, 2020

  1. oh-my-zsh: Add test

    NeQuissimus committed Nov 5, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9813539 View commit details
  2. Merge pull request #102850 from NeQuissimus/oh-my-zsh_update

    oh-my-zsh: Update script, test
    NeQuissimus authored Nov 5, 2020
    Copy the full SHA
    3a6feb7 View commit details
Showing with 58 additions and 21 deletions.
  1. +1 −0 nixos/tests/all-tests.nix
  2. +18 −0 nixos/tests/oh-my-zsh.nix
  3. +39 −2 pkgs/shells/zsh/oh-my-zsh/default.nix
  4. +0 −19 pkgs/shells/zsh/oh-my-zsh/update.sh
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
@@ -255,6 +255,7 @@ in
novacomd = handleTestOn ["x86_64-linux"] ./novacomd.nix {};
nsd = handleTest ./nsd.nix {};
nzbget = handleTest ./nzbget.nix {};
oh-my-zsh = handleTest ./oh-my-zsh.nix {};
openarena = handleTest ./openarena.nix {};
openldap = handleTest ./openldap.nix {};
opensmtpd = handleTest ./opensmtpd.nix {};
18 changes: 18 additions & 0 deletions nixos/tests/oh-my-zsh.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import ./make-test-python.nix ({ pkgs, ... }: {
name = "oh-my-zsh";

machine = { pkgs, ... }:

{
programs.zsh = {
enable = true;
ohMyZsh.enable = true;
};
};

testScript = ''
start_all()
machine.succeed("touch ~/.zshrc")
machine.succeed("zsh -c 'source /etc/zshrc && echo $ZSH | grep oh-my-zsh-${pkgs.oh-my-zsh.version}'")
'';
})
41 changes: 39 additions & 2 deletions pkgs/shells/zsh/oh-my-zsh/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# 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";
@@ -12,7 +13,7 @@ stdenv.mkDerivation rec {
inherit rev;
owner = "ohmyzsh";
repo = "ohmyzsh";
sha256 = "0021rayw5wiwgjfwy7d6g577xidws58vk7y9xxhidnmk9sr4vri7";
sha256 = "J+ZNsk6z2hZh78mfuVHRvMV+TnmmHc+dfDzywr3KQQA=";
};

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 = ''
19 changes: 0 additions & 19 deletions pkgs/shells/zsh/oh-my-zsh/update.sh

This file was deleted.