about summary refs log tree commit diff
path: root/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-10 07:13:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-12 14:07:16 +0000
commite2698550456abba83c6dcd5d5e5a9990a0b96f8a (patch)
tree79a56f0df3fa55e470d84b4dff6059fbf487ec18 /nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix
parent1cdc42df888dc98c347e03bd942ed9825a55bcb3 (diff)
parent84d74ae9c9cbed73274b8e4e00be14688ffc93fe (diff)
downloadnixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.gz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.bz2
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.lz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.xz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.zst
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.zip
Merge commit '84d74ae9c9cbed73274b8e4e00be14688ffc93fe'
Diffstat (limited to 'nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix')
-rw-r--r--nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix99
1 files changed, 54 insertions, 45 deletions
diff --git a/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix b/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix
index 37374900a4ec..cc4c7903360f 100644
--- a/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix
+++ b/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix
@@ -1,59 +1,68 @@
 # 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, fetchgit }:
+{ stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
-  version = "2020-06-18";
+  version = "2020-09-20";
   pname = "oh-my-zsh";
-  rev = "5ffc0d036c587741fd25092e7809dad2b00b3677";
+  rev = "93c837fec8e9fe61509b9dff9e909e84f7ebe32d";
 
-  src = fetchgit { inherit rev;
-    url = "https://github.com/ohmyzsh/ohmyzsh";
-    sha256 = "04a9zg3l824wywk0qcm0pc4n4522cqljyix7kh3frc4psqnhh8qr";
+  src = fetchFromGitHub {
+    inherit rev;
+    owner = "ohmyzsh";
+    repo = "ohmyzsh";
+    sha256 = "1ww50c1xf64z1m0sy30xaf2adr87cqr5yyv9jrqr227j97vrwj04";
   };
 
-  pathsToLink = [ "/share/oh-my-zsh" ];
+  installPhase = ''
+    outdir=$out/share/oh-my-zsh
+    template=templates/zshrc.zsh-template
 
-  phases = "installPhase";
+    mkdir -p $outdir
+    cp -r * $outdir
+    cd $outdir
 
-  installPhase = ''
-  outdir=$out/share/oh-my-zsh
-  template=templates/zshrc.zsh-template
-
-  mkdir -p $outdir
-  cp -r $src/* $outdir
-  cd $outdir
-
-  rm LICENSE.txt
-  rm -rf .git*
-
-  chmod -R +w templates
-
-  # Change the path to oh-my-zsh dir and disable auto-updating.
-  sed -i -e "s#ZSH=\$HOME/.oh-my-zsh#ZSH=$outdir#" \
-         -e 's/\# \(DISABLE_AUTO_UPDATE="true"\)/\1/' \
-   $template
-
-  # Look for .zsh_variables, .zsh_aliases, and .zsh_funcs, and source
-  # them, if found.
-  cat >> $template <<- EOF
-
-  # Load the variables.
-  if [ -f ~/.zsh_variables ]; then
-      . ~/.zsh_variables
-  fi
-
-  # Load the functions.
-  if [ -f ~/.zsh_funcs ]; then
-    . ~/.zsh_funcs
-  fi
-
-  # Load the aliases.
-  if [ -f ~/.zsh_aliases ]; then
-      . ~/.zsh_aliases
-  fi
-  EOF
+    rm LICENSE.txt
+    rm -rf .git*
+
+    chmod -R +w templates
+
+    # Change the path to oh-my-zsh dir and disable auto-updating.
+    sed -i -e "s#ZSH=\$HOME/.oh-my-zsh#ZSH=$outdir#" \
+           -e 's/\# \(DISABLE_AUTO_UPDATE="true"\)/\1/' \
+     $template
+
+    chmod +w oh-my-zsh.sh
+
+    # Both functions expect oh-my-zsh to be in ~/.oh-my-zsh and try to
+    # modify the directory.
+    cat >> oh-my-zsh.sh <<- EOF
+
+    # Undefine functions that don't work on Nix.
+    unfunction uninstall_oh_my_zsh
+    unfunction upgrade_oh_my_zsh
+    EOF
+
+    # Look for .zsh_variables, .zsh_aliases, and .zsh_funcs, and source
+    # them, if found.
+    cat >> $template <<- EOF
+
+    # Load the variables.
+    if [ -f ~/.zsh_variables ]; then
+        . ~/.zsh_variables
+    fi
+
+    # Load the functions.
+    if [ -f ~/.zsh_funcs ]; then
+      . ~/.zsh_funcs
+    fi
+
+    # Load the aliases.
+    if [ -f ~/.zsh_aliases ]; then
+        . ~/.zsh_aliases
+    fi
+    EOF
   '';
 
   meta = with stdenv.lib; {