Merge pull request #96532 from flokli/ohmyzsh-cleanups

oh-my-zsh: cleanups, don't require perl in pygmalion theme anymore

authored by Tim Steinbach and committed by GitHub f076cd76 873a7768

+41 -44
+41 -44
pkgs/shells/zsh/oh-my-zsh/default.nix
··· 1 # This script was inspired by the ArchLinux User Repository package: 2 # 3 # https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=oh-my-zsh-git 4 - { stdenv, fetchgit }: 5 6 stdenv.mkDerivation rec { 7 version = "2020-08-28"; 8 pname = "oh-my-zsh"; 9 - rev = "4ed6fd2b8b6a0efb2f84f00a64503282aca260e7"; 10 11 - src = fetchgit { inherit rev; 12 - url = "https://github.com/ohmyzsh/ohmyzsh"; 13 sha256 = "0f2f1k6s28lgxpjdgl4s7jisw6dgva9mcsqlsq0wg6041p246nai"; 14 }; 15 16 - pathsToLink = [ "/share/oh-my-zsh" ]; 17 - 18 - phases = "installPhase"; 19 - 20 installPhase = '' 21 - outdir=$out/share/oh-my-zsh 22 - template=templates/zshrc.zsh-template 23 24 - mkdir -p $outdir 25 - cp -r $src/* $outdir 26 - cd $outdir 27 28 - rm LICENSE.txt 29 - rm -rf .git* 30 31 - chmod -R +w templates 32 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 37 38 - chmod +w oh-my-zsh.sh 39 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 43 44 - # Undefine functions that don't work on Nix. 45 - unfunction uninstall_oh_my_zsh 46 - unfunction upgrade_oh_my_zsh 47 - EOF 48 49 - # Look for .zsh_variables, .zsh_aliases, and .zsh_funcs, and source 50 - # them, if found. 51 - cat >> $template <<- EOF 52 53 - # Load the variables. 54 - if [ -f ~/.zsh_variables ]; then 55 - . ~/.zsh_variables 56 - fi 57 58 - # Load the functions. 59 - if [ -f ~/.zsh_funcs ]; then 60 - . ~/.zsh_funcs 61 - fi 62 63 - # Load the aliases. 64 - if [ -f ~/.zsh_aliases ]; then 65 - . ~/.zsh_aliases 66 - fi 67 - EOF 68 ''; 69 70 meta = with stdenv.lib; {
··· 1 # This script was inspired by the ArchLinux User Repository package: 2 # 3 # https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=oh-my-zsh-git 4 + { stdenv, fetchFromGitHub }: 5 6 stdenv.mkDerivation rec { 7 version = "2020-08-28"; 8 pname = "oh-my-zsh"; 9 10 + src = fetchFromGitHub { 11 + owner = "ohmyzsh"; 12 + repo = "ohmyzsh"; 13 + rev = "4ed6fd2b8b6a0efb2f84f00a64503282aca260e7"; 14 sha256 = "0f2f1k6s28lgxpjdgl4s7jisw6dgva9mcsqlsq0wg6041p246nai"; 15 }; 16 17 installPhase = '' 18 + outdir=$out/share/oh-my-zsh 19 + template=templates/zshrc.zsh-template 20 21 + mkdir -p $outdir 22 + cp -r * $outdir 23 + cd $outdir 24 25 + rm LICENSE.txt 26 + rm -rf .git* 27 28 + chmod -R +w templates 29 30 + # Change the path to oh-my-zsh dir and disable auto-updating. 31 + sed -i -e "s#ZSH=\$HOME/.oh-my-zsh#ZSH=$outdir#" \ 32 + -e 's/\# \(DISABLE_AUTO_UPDATE="true"\)/\1/' \ 33 + $template 34 35 + chmod +w oh-my-zsh.sh 36 37 + # Both functions expect oh-my-zsh to be in ~/.oh-my-zsh and try to 38 + # modify the directory. 39 + cat >> oh-my-zsh.sh <<- EOF 40 41 + # Undefine functions that don't work on Nix. 42 + unfunction uninstall_oh_my_zsh 43 + unfunction upgrade_oh_my_zsh 44 + EOF 45 46 + # Look for .zsh_variables, .zsh_aliases, and .zsh_funcs, and source 47 + # them, if found. 48 + cat >> $template <<- EOF 49 50 + # Load the variables. 51 + if [ -f ~/.zsh_variables ]; then 52 + . ~/.zsh_variables 53 + fi 54 55 + # Load the functions. 56 + if [ -f ~/.zsh_funcs ]; then 57 + . ~/.zsh_funcs 58 + fi 59 60 + # Load the aliases. 61 + if [ -f ~/.zsh_aliases ]; then 62 + . ~/.zsh_aliases 63 + fi 64 + EOF 65 ''; 66 67 meta = with stdenv.lib; {