2023-06-04 08:12:51 +02:00
|
|
|
{ pkgs, lib, ... }:
|
|
|
|
let vimclip = pkgs.stdenv.mkDerivation rec {
|
2023-01-12 20:49:08 +01:00
|
|
|
name = "vimclip";
|
2023-06-04 08:55:52 +02:00
|
|
|
rev = "52003cc31e6e1d20550cdf6b7d3bf1a019a34fa0";
|
2023-01-12 20:49:08 +01:00
|
|
|
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
inherit rev;
|
|
|
|
owner = "hrantzsch";
|
|
|
|
repo = "vimclip";
|
2023-06-04 08:55:52 +02:00
|
|
|
sha256 = "1ifsiiafvby8z9gp1x6fpfwklr6k9mg5vrajw9di06yixmrxzw7g";
|
2023-01-12 20:49:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp ./vimclip $out/bin/vimclip
|
|
|
|
chmod +x $out/bin/vimclip
|
|
|
|
'';
|
2023-06-04 08:12:51 +02:00
|
|
|
}; in
|
|
|
|
pkgs.writeShellScriptBin "vimclip" ''
|
2023-06-04 08:35:38 +02:00
|
|
|
if [ "wayland" = $XDG_SESSION_TYPE ]
|
2023-06-04 08:12:51 +02:00
|
|
|
then
|
2023-06-04 08:17:14 +02:00
|
|
|
export VIMCLIP_CLIPBOARD_COMMAND=${pkgs.wl-clipboard}/bin/wl-copy
|
2023-06-04 08:12:51 +02:00
|
|
|
else
|
2023-06-04 08:17:14 +02:00
|
|
|
export VIMCLIP_CLIPBOARD_COMMAND=${lib.getExe pkgs.xsel}
|
2023-06-04 08:12:51 +02:00
|
|
|
fi
|
2023-01-12 20:49:08 +01:00
|
|
|
|
2023-06-04 08:12:51 +02:00
|
|
|
${lib.getExe vimclip}
|
|
|
|
''
|