irs/default.nix

48 lines
862 B
Nix

{ pkgs
, scdoc
, xclip
, maim
, pngquant
, stdenvNoCC
, nushell
, xdotool
, ...
}:
stdenvNoCC.mkDerivation {
pname = "irs";
version = "0.3";
src = ./src;
nativeBuildInputs = [
scdoc
nushell
];
buildPhase = ''
for page in $(find manpages -type f); do
scdoc < $page > $(basename $page .scd)
done
'';
preConfig = ''
patchShebangs ./bin/*
'';
installPhase = ''
mkdir -p $out/{share/man/man1,bin,share/zsh/site-functions}
cp bin/* $out/bin/
cp completions/* $out/share/zsh/site-functions/
cp *.1 $out/share/man/man1/
runHook postInstall
'';
postInstall = ''
substituteInPlace $out/bin/* \
--replace "xclip" "${xclip}/bin/xclip" \
--replace "maim" "${maim}/bin/maim" \
--replace "pngquant" "${pngquant}/bin/pngquant" \
--replace "xdotool" "${xdotool}/bin/xdotool"
'';
}