2023-08-04 22:07:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, unstableGitUpdater
|
|
|
|
, coreutils
|
|
|
|
, util-linux
|
|
|
|
, gnugrep
|
|
|
|
, libnotify
|
|
|
|
, pwgen
|
|
|
|
, findutils
|
|
|
|
, gawk
|
|
|
|
, gnused
|
|
|
|
# wayland-only deps
|
|
|
|
, rofi-wayland
|
|
|
|
, pass-wayland
|
|
|
|
, wl-clipboard
|
|
|
|
, wtype
|
|
|
|
# x11-only deps
|
|
|
|
, rofi
|
|
|
|
, pass
|
|
|
|
, xclip
|
|
|
|
, xdotool
|
|
|
|
# backend selector
|
|
|
|
, backend ? "x11"
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
assert lib.assertOneOf "backend" backend [ "x11" "wayland" ];
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "rofi-pass";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "unstable-2024-02-13";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "carnager";
|
|
|
|
repo = "rofi-pass";
|
2024-02-29 20:09:43 +00:00
|
|
|
rev = "8aa6b9293a8f0af267425326fa966966ca42085e";
|
|
|
|
hash = "sha256-g/AuLYj0yvLCXFR3y9GbMiE6hDCPBeuFM145c2Ukvys=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -a rofi-pass $out/bin/rofi-pass
|
|
|
|
|
|
|
|
mkdir -p $out/share/doc/rofi-pass/
|
|
|
|
cp -a config.example $out/share/doc/rofi-pass/config.example
|
|
|
|
'';
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
wrapperPath = lib.makeBinPath ([
|
2020-04-24 23:36:52 +00:00
|
|
|
coreutils
|
|
|
|
findutils
|
|
|
|
gawk
|
|
|
|
gnugrep
|
|
|
|
gnused
|
|
|
|
libnotify
|
|
|
|
pwgen
|
2020-11-24 20:58:05 +00:00
|
|
|
util-linux
|
2023-08-04 22:07:22 +00:00
|
|
|
] ++ lib.optionals (backend == "x11") [
|
|
|
|
rofi
|
|
|
|
(pass.withExtensions (ext: [ ext.pass-otp ]))
|
2020-04-24 23:36:52 +00:00
|
|
|
xclip
|
|
|
|
xdotool
|
2023-08-04 22:07:22 +00:00
|
|
|
] ++ lib.optionals (backend == "wayland") [
|
|
|
|
rofi-wayland
|
|
|
|
(pass-wayland.withExtensions (ext: [ ext.pass-otp ]))
|
|
|
|
wl-clipboard
|
|
|
|
wtype
|
|
|
|
]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
fixupPhase = ''
|
|
|
|
patchShebangs $out/bin
|
|
|
|
|
|
|
|
wrapProgram $out/bin/rofi-pass \
|
2023-08-04 22:07:22 +00:00
|
|
|
--prefix PATH : "$wrapperPath" \
|
|
|
|
--set-default ROFI_PASS_BACKEND ${if backend == "wayland" then "wtype" else "xdotool"} \
|
|
|
|
--set-default ROFI_PASS_CLIPBOARD_BACKEND ${if backend == "wayland" then "wl-clipboard" else "xclip"}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
passthru.updateScript = unstableGitUpdater { };
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "A script to make rofi work with password-store";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "rofi-pass";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/carnager/rofi-pass";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.gpl3;
|
|
|
|
platforms = with lib.platforms; linux;
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = with lib.maintainers; [ lilyinstarlight ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|