Skip to content

Commit

Permalink
zinit: refactor and modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
Moraxyc committed Jan 4, 2025
1 parent d35a029 commit a3df920
Showing 1 changed file with 37 additions and 29 deletions.
66 changes: 37 additions & 29 deletions pkgs/by-name/zi/zinit/package.nix
Original file line number Diff line number Diff line change
@@ -1,48 +1,56 @@
{ stdenvNoCC, lib, fetchFromGitHub, installShellFiles }:

stdenvNoCC.mkDerivation rec {
{
stdenvNoCC,
lib,
fetchFromGitHub,
installShellFiles,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
pname = "zinit";
version = "3.13.1";

src = fetchFromGitHub {
owner = "zdharma-continuum";
repo = pname;
rev = "v${version}";
repo = finalAttrs.pname;
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-fnBV0LmC/wJm0pOITJ1mhiBqsg2F8AQJWvn0p/Bgo5Q=";
};
# adapted from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=zsh-zplugin-git
dontBuild = true;

outputs = [
"out"
"man"
];

strictDeps = true;
nativeBuildInputs = [ installShellFiles ];
installPhase = ''
outdir="$out/share/$pname"

cd "$src"
nativeBuildInputs = [ installShellFiles ];

# Zplugin's source files
install -dm0755 "$outdir"
# Installing backward compatibility layer
install -m0644 zinit{,-side,-install,-autoload}.zsh "$outdir"
install -m0755 share/git-process-output.zsh "$outdir"
installPhase = ''
runHook preInstall
installManPage doc/zinit.1
# Source files
mkdir -p $out/share/zinit
install -m0644 zinit{,-side,-install,-autoload}.zsh $out/share/zinit
install -m0755 share/git-process-output.zsh $out/share/zinit
# Zplugin autocompletion
# Autocompletion
installShellCompletion --zsh _zinit
#TODO:Zplugin-module files
# find zmodules/ -type d -exec install -dm 755 "{}" "$outdir/{}" \;
# find zmodules/ -type f -exec install -m 744 "{}" "$outdir/{}" \;
'';
postInstall = ''
# Manpage
installManPage doc/zinit.1
runHook postInstall
'';
#TODO:doc output

meta = with lib; {
#TODO: output doc through zshelldoc

meta = {
homepage = "https://github.com/zdharma-continuum/zinit";
description = "Flexible zsh plugin manager";
license = licenses.mit;
maintainers = with maintainers; [ pasqui23 sei40kr ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
pasqui23
sei40kr
];
};
}
})

0 comments on commit a3df920

Please sign in to comment.