git.iko.soy/typeable/nixpkgs
on master help sign in
oh-my-zsh: cleanup

- use fetchFromGitHub instead of fetchgit - indent the `installPhase` properly - remove unused `pathsToLink` - don't hardcode `phases` to allow patching - don't copy from $src, but . to allow patching

commitf1e667234daebed9c74895bd2b78e59fd8bd825d authorFlorian Klink <flokli@flokli.de> dateFri 28 Aug 2020, 12:28 (6 years ago) parentdb77fb7
1 file changed+41−43
pkgs/shells/zsh/oh-my-zsh/default.nix+41−43
pkgs/shells/zsh/oh-my-zsh/default.nix+41−43
@@ -1,70 +1,68 @@
11# This script was inspired by the ArchLinux User Repository package:
22#
33# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=oh-my-zsh-git
4−{ stdenv, fetchgit }:
4+{ stdenv, fetchFromGitHub }:
55
66stdenv.mkDerivation rec {
77 version = "2020-08-24";
88 pname = "oh-my-zsh";
9− rev = "cfb86cd08d3b24fd4b59d0d35b3af1f589c891fa";
109
11− src = fetchgit { inherit rev;
12− url = "https://github.com/ohmyzsh/ohmyzsh";
10+ src = fetchFromGitHub {
11+ owner = "ohmyzsh";
12+ repo = "ohmyzsh";
13+ rev = "cfb86cd08d3b24fd4b59d0d35b3af1f589c891fa";
1314 sha256 = "0af37smv0bqw37bng2halzgszf8y3m2sxahdff54m16asm0py2cr";
1415 };
1516
16− pathsToLink = [ "/share/oh-my-zsh" ];
17−
18− phases = "installPhase";
1917
2018 installPhase = ''
21− outdir=$out/share/oh-my-zsh
22− template=templates/zshrc.zsh-template
19+ outdir=$out/share/oh-my-zsh
20+ template=templates/zshrc.zsh-template
2321
24− mkdir -p $outdir
25− cp -r $src/* $outdir
26− cd $outdir
22+ mkdir -p $outdir
23+ cp -r * $outdir
24+ cd $outdir
2725
28− rm LICENSE.txt
29− rm -rf .git*
26+ rm LICENSE.txt
27+ rm -rf .git*
3028
31− chmod -R +w templates
29+ chmod -R +w templates
3230
33− # Change the path to oh-my-zsh dir and disable auto-updating.
34− sed -i -e "s#ZSH=\$HOME/.oh-my-zsh#ZSH=$outdir#" \
35− -e 's/\# \(DISABLE_AUTO_UPDATE="true"\)/\1/' \
36− $template
31+ # Change the path to oh-my-zsh dir and disable auto-updating.
32+ sed -i -e "s#ZSH=\$HOME/.oh-my-zsh#ZSH=$outdir#" \
33+ -e 's/\# \(DISABLE_AUTO_UPDATE="true"\)/\1/' \
34+ $template
3735
38− chmod +w oh-my-zsh.sh
36+ chmod +w oh-my-zsh.sh
3937
40− # Both functions expect oh-my-zsh to be in ~/.oh-my-zsh and try to
41− # modify the directory.
42− cat >> oh-my-zsh.sh <<- EOF
38+ # Both functions expect oh-my-zsh to be in ~/.oh-my-zsh and try to
39+ # modify the directory.
40+ cat >> oh-my-zsh.sh <<- EOF
4341
44− # Undefine functions that don't work on Nix.
45− unfunction uninstall_oh_my_zsh
46− unfunction upgrade_oh_my_zsh
47− EOF
42+ # Undefine functions that don't work on Nix.
43+ unfunction uninstall_oh_my_zsh
44+ unfunction upgrade_oh_my_zsh
45+ EOF
4846
49− # Look for .zsh_variables, .zsh_aliases, and .zsh_funcs, and source
50− # them, if found.
51− cat >> $template <<- EOF
47+ # Look for .zsh_variables, .zsh_aliases, and .zsh_funcs, and source
48+ # them, if found.
49+ cat >> $template <<- EOF
5250
53− # Load the variables.
54− if [ -f ~/.zsh_variables ]; then
55− . ~/.zsh_variables
56− fi
51+ # Load the variables.
52+ if [ -f ~/.zsh_variables ]; then
53+ . ~/.zsh_variables
54+ fi
5755
58− # Load the functions.
59− if [ -f ~/.zsh_funcs ]; then
60− . ~/.zsh_funcs
61− fi
56+ # Load the functions.
57+ if [ -f ~/.zsh_funcs ]; then
58+ . ~/.zsh_funcs
59+ fi
6260
63− # Load the aliases.
64− if [ -f ~/.zsh_aliases ]; then
65− . ~/.zsh_aliases
66− fi
67− EOF
61+ # Load the aliases.
62+ if [ -f ~/.zsh_aliases ]; then
63+ . ~/.zsh_aliases
64+ fi
65+ EOF
6866 '';
6967
7068 meta = with stdenv.lib; {