From 10f01ded353d5a76c6acbecaa0ac5e5063f60c13 Mon Sep 17 00:00:00 2001 From: Luigi Sartor Piucco Date: Fri, 16 Oct 2020 19:41:03 -0300 Subject: [PATCH] zsh plugins: use omz-compatible paths The `programs.zsh.ohMyZsh.customPkgs` option expects that arguments passed to it will have a zsh plugin/theme/completion in a path like `$out/share/zsh/{plugins,themes,completions}`, and copies whatever is inside those to `$ZSH_CUSTOM`. However, some packages actually unpacked to `$out/share`, without the proper folder structure, so they never got copied to `$ZSH_CUSTOM` and caused "not found" errors on zsh startup. This commit fixes that, and maintains compatibility with other packages that might still expect a flattened structure. This is done though a symlink. --- pkgs/by-name/zs/zsh-autosuggestions/package.nix | 6 +++++- pkgs/by-name/zs/zsh-bd/package.nix | 14 ++++++++++---- .../zs/zsh-fast-syntax-highlighting/package.nix | 2 +- .../zs/zsh-history-substring-search/package.nix | 6 +++++- pkgs/by-name/zs/zsh-nix-shell/package.nix | 5 +++-- pkgs/by-name/zs/zsh-powerlevel10k/package.nix | 11 ++++++----- pkgs/by-name/zs/zsh-powerlevel9k/package.nix | 5 +++-- 7 files changed, 33 insertions(+), 16 deletions(-) diff --git a/pkgs/by-name/zs/zsh-autosuggestions/package.nix b/pkgs/by-name/zs/zsh-autosuggestions/package.nix index 9afe6b870916..1710b482d7b8 100644 --- a/pkgs/by-name/zs/zsh-autosuggestions/package.nix +++ b/pkgs/by-name/zs/zsh-autosuggestions/package.nix @@ -20,8 +20,12 @@ stdenv.mkDerivation rec { strictDeps = true; installPhase = '' + install -D zsh-autosuggestions.plugin.zsh \ + $out/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh install -D zsh-autosuggestions.zsh \ - $out/share/zsh-autosuggestions/zsh-autosuggestions.zsh + $out/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh + ln -s $out/share/zsh/plugins/zsh-autosuggestions \ + $out/share/zsh-autosuggestions ''; meta = with lib; { diff --git a/pkgs/by-name/zs/zsh-bd/package.nix b/pkgs/by-name/zs/zsh-bd/package.nix index 843ffc135ca5..24d1d8c390c0 100644 --- a/pkgs/by-name/zs/zsh-bd/package.nix +++ b/pkgs/by-name/zs/zsh-bd/package.nix @@ -19,10 +19,16 @@ stdenv.mkDerivation { dontBuild = true; installPhase = '' - mkdir -p $out/share/zsh-bd - cp {.,$out/share/zsh-bd}/bd.zsh - cd $out/share/zsh-bd - ln -s bd{,.plugin}.zsh + runHook preInstall + + install -D bd.zsh \ + $out/share/plugins/zsh-bd/bd.zsh + ln -s $out/share/plugins/zsh-bd/bd.zsh \ + $out/share/plugins/zsh-bd/bd.plugin.zsh + ln -s $out/share/plugins/zsh-bd \ + $out/share/zsh-bd + + runHook postInstall ''; meta = { diff --git a/pkgs/by-name/zs/zsh-fast-syntax-highlighting/package.nix b/pkgs/by-name/zs/zsh-fast-syntax-highlighting/package.nix index d3b6129e4592..d7cbdab2ef1c 100644 --- a/pkgs/by-name/zs/zsh-fast-syntax-highlighting/package.nix +++ b/pkgs/by-name/zs/zsh-fast-syntax-highlighting/package.nix @@ -20,7 +20,7 @@ stdenvNoCC.mkDerivation rec { dontBuild = true; installPhase = '' - plugindir="$out/share/zsh/site-functions" + plugindir="$out/share/zsh/plugins/fast-syntax-highlighting" mkdir -p "$plugindir" cp -r -- {,_,-,.}fast-* *chroma themes "$plugindir"/ diff --git a/pkgs/by-name/zs/zsh-history-substring-search/package.nix b/pkgs/by-name/zs/zsh-history-substring-search/package.nix index e291025f6ee1..61af2fec16ac 100644 --- a/pkgs/by-name/zs/zsh-history-substring-search/package.nix +++ b/pkgs/by-name/zs/zsh-history-substring-search/package.nix @@ -17,8 +17,12 @@ stdenv.mkDerivation rec { strictDeps = true; installPhase = '' + install -D zsh-history-substring-search.plugin.zsh \ + "$out/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh" install -D zsh-history-substring-search.zsh \ - "$out/share/zsh-history-substring-search/zsh-history-substring-search.zsh" + "$out/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh" + ln -s $out/share/zsh/plugins/zsh-history-substring-search \ + $out/share/zsh-history-substring-search ''; meta = with lib; { diff --git a/pkgs/by-name/zs/zsh-nix-shell/package.nix b/pkgs/by-name/zs/zsh-nix-shell/package.nix index 75bf5db1c4e5..48d4c6497796 100644 --- a/pkgs/by-name/zs/zsh-nix-shell/package.nix +++ b/pkgs/by-name/zs/zsh-nix-shell/package.nix @@ -22,8 +22,9 @@ stdenv.mkDerivation rec { strictDeps = true; buildInputs = [ bash ]; installPhase = '' - install -D nix-shell.plugin.zsh --target-directory=$out/share/zsh-nix-shell - install -D scripts/* --target-directory=$out/share/zsh-nix-shell/scripts + install -D nix-shell.plugin.zsh --target-directory=$out/share/zsh/plugins/zsh-nix-shell + install -D scripts/* --target-directory=$out/share/zsh/plugins/zsh-nix-shell/scripts + ln -s $out/share/zsh/plugins/zsh-nix-shell $out/share/zsh-nix-shell ''; meta = with lib; { diff --git a/pkgs/by-name/zs/zsh-powerlevel10k/package.nix b/pkgs/by-name/zs/zsh-powerlevel10k/package.nix index 2435105d33d0..cbc33168774e 100644 --- a/pkgs/by-name/zs/zsh-powerlevel10k/package.nix +++ b/pkgs/by-name/zs/zsh-powerlevel10k/package.nix @@ -32,11 +32,12 @@ stdenv.mkDerivation (finalAttrs: { installPhase = '' runHook preInstall - install -D powerlevel10k.zsh-theme --target-directory=$out/share/zsh-powerlevel10k - install -D powerlevel9k.zsh-theme --target-directory=$out/share/zsh-powerlevel10k - install -D config/* --target-directory=$out/share/zsh-powerlevel10k/config - install -D internal/* --target-directory=$out/share/zsh-powerlevel10k/internal - cp -R gitstatus $out/share/zsh-powerlevel10k/gitstatus + install -D powerlevel10k.zsh-theme --target-directory=$out/share/zsh/themes/powerlevel10k + install -D powerlevel9k.zsh-theme --target-directory=$out/share/zsh/themes/powerlevel10k + install -D config/* --target-directory=$out/share/zsh/themes/powerlevel10k/config + install -D internal/* --target-directory=$out/share/zsh/themes/powerlevel10k/internal + cp -R gitstatus $out/share/zsh/themes/powerlevel10k/gitstatus + ln -s $out/share/zsh/themes/powerlevel10k $out/share/zsh-powerlevel10k runHook postInstall ''; diff --git a/pkgs/by-name/zs/zsh-powerlevel9k/package.nix b/pkgs/by-name/zs/zsh-powerlevel9k/package.nix index a9ec9e8d1a00..e66aa6e9995d 100644 --- a/pkgs/by-name/zs/zsh-powerlevel9k/package.nix +++ b/pkgs/by-name/zs/zsh-powerlevel9k/package.nix @@ -16,8 +16,9 @@ stdenv.mkDerivation { strictDeps = true; installPhase = '' - install -D powerlevel9k.zsh-theme --target-directory=$out/share/zsh-powerlevel9k - install -D functions/* --target-directory=$out/share/zsh-powerlevel9k/functions + install -D powerlevel9k.zsh-theme --target-directory=$out/share/zsh/themes/powerlevel9k + install -D functions/* --target-directory=$out/share/zsh/themes/powerlevel9k/functions + ln -s $out/share/zsh/themes/powerlevel9k $out/share/zsh-powerlevel9k ''; meta = {