more-tmux-plugins.nix 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. { lib
  2. , fetchFromGitHub
  3. , pkgs
  4. , stdenv
  5. , config
  6. }:
  7. let
  8. rtpPath = "share/tmux-plugins";
  9. addRtp = path: rtpFilePath: attrs: derivation:
  10. derivation // { rtp = "${derivation}/${path}/${rtpFilePath}"; } // {
  11. overrideAttrs = f: mkTmuxPlugin (attrs // f attrs);
  12. };
  13. mkTmuxPlugin = a@{
  14. pluginName,
  15. rtpFilePath ? (builtins.replaceStrings ["-"] ["_"] pluginName) + ".tmux",
  16. namePrefix ? "tmuxplugin-",
  17. src,
  18. unpackPhase ? "",
  19. configurePhase ? ":",
  20. buildPhase ? ":",
  21. addonInfo ? null,
  22. preInstall ? "",
  23. postInstall ? "",
  24. path ? lib.getName pluginName,
  25. ...
  26. }:
  27. if lib.hasAttr "dependencies" a then
  28. throw "dependencies attribute is obselete. see NixOS/nixpkgs#118034" # added 2021-04-01
  29. else addRtp "${rtpPath}/${path}" rtpFilePath a (stdenv.mkDerivation (a // {
  30. pname = namePrefix + pluginName;
  31. inherit pluginName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
  32. installPhase = ''
  33. runHook preInstall
  34. target=$out/${rtpPath}/${path}
  35. mkdir -p $out/${rtpPath}
  36. cp -r . $target
  37. if [ -n "$addonInfo" ]; then
  38. echo "$addonInfo" > $target/addon-info.json
  39. fi
  40. runHook postInstall
  41. '';
  42. }));
  43. in rec {
  44. inherit mkTmuxPlugin;
  45. tmux-select-pane-no-wrap = mkTmuxPlugin rec {
  46. pluginName = "tmux-select-pane-no-wrap";
  47. version = "00add78";
  48. src = fetchFromGitHub {
  49. owner = "dalejung";
  50. repo = pluginName;
  51. rev = version;
  52. sha256 = "sha256-ot0cHvk1TXvHOw9z+7TLSiHT77jHwvV2PSHcNuhOorQ=";
  53. };
  54. };
  55. }