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.
This commit is contained in:
Luigi Sartor Piucco
2020-10-16 19:41:03 -03:00
committed by John Titor
parent d8cc1036c6
commit 10f01ded35
7 changed files with 33 additions and 16 deletions

View File

@@ -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; {

View File

@@ -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 = {

View File

@@ -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"/

View File

@@ -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; {

View File

@@ -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; {

View File

@@ -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
'';

View File

@@ -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 = {