more-tmux-plugins.nix 1.9 KB

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