nixpkgs/pkgs/tools/security/pass/rofi-pass.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

93 lines
1.9 KiB
Nix
Raw Normal View History

{ 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"
}:
assert lib.assertOneOf "backend" backend [ "x11" "wayland" ];
stdenv.mkDerivation {
pname = "rofi-pass";
version = "unstable-2023-07-07";
src = fetchFromGitHub {
owner = "carnager";
repo = "rofi-pass";
rev = "e77cbdbe0e885f0b1daba3a0b6bae793cc2b1ba3";
hash = "sha256-zmNuFE+++tf4pKTXSTc7s8R9rvI+XwgWl8mCEPaaIRM=";
};
nativeBuildInputs = [ makeWrapper ];
dontBuild = true;
installPhase = ''
mkdir -p $out/bin
2016-09-17 22:20:40 +03:00
cp -a rofi-pass $out/bin/rofi-pass
mkdir -p $out/share/doc/rofi-pass/
2016-09-17 22:20:40 +03:00
cp -a config.example $out/share/doc/rofi-pass/config.example
'';
wrapperPath = lib.makeBinPath ([
coreutils
2015-12-10 14:05:39 +03:00
findutils
gawk
2015-12-10 14:05:39 +03:00
gnugrep
gnused
libnotify
2015-12-10 14:05:39 +03:00
pwgen
2020-11-24 18:29:28 +03:00
util-linux
] ++ lib.optionals (backend == "x11") [
rofi
(pass.withExtensions (ext: [ ext.pass-otp ]))
xclip
xdotool
] ++ lib.optionals (backend == "wayland") [
rofi-wayland
(pass-wayland.withExtensions (ext: [ ext.pass-otp ]))
wl-clipboard
wtype
]);
fixupPhase = ''
patchShebangs $out/bin
wrapProgram $out/bin/rofi-pass \
--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"}
'';
passthru.updateScript = unstableGitUpdater { };
meta = {
description = "A script to make rofi work with password-store";
homepage = "https://github.com/carnager/rofi-pass";
2021-01-15 12:19:50 +03:00
license = lib.licenses.gpl3;
platforms = with lib.platforms; linux;
maintainers = with lib.maintainers; [ lilyinstarlight ];
};
}