From a7df6bc9d1a5621b3ec2750c82d3356c4fe88dbe Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Tue, 4 Jul 2023 15:01:43 -0400 Subject: [PATCH] rofi-pass: 2.0.2 -> unstable-2023-07-04 and init rofi-pass-wayland --- pkgs/tools/security/pass/rofi-pass.nix | 58 +++++++++++++++++++++----- pkgs/top-level/all-packages.nix | 3 ++ 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/pkgs/tools/security/pass/rofi-pass.nix b/pkgs/tools/security/pass/rofi-pass.nix index 3b5aedf81a80..6b0a975099f3 100644 --- a/pkgs/tools/security/pass/rofi-pass.nix +++ b/pkgs/tools/security/pass/rofi-pass.nix @@ -1,16 +1,41 @@ -{ lib, stdenv, fetchFromGitHub, pass, rofi, coreutils, util-linux, xdotool, gnugrep -, libnotify, pwgen, findutils, gawk, gnused, xclip, makeWrapper +{ 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" }: -stdenv.mkDerivation rec { +assert lib.assertOneOf "backend" backend [ "x11" "wayland" ]; + +stdenv.mkDerivation { pname = "rofi-pass"; - version = "2.0.2"; + version = "unstable-2023-07-04"; src = fetchFromGitHub { owner = "carnager"; repo = "rofi-pass"; - rev = version; - sha256 = "131jpcwyyzgzjn9lx4k1zn95pd68pjw4i41jfzcp9z9fnazyln5n"; + rev = "fa16c0211d898d337e76397d22de4f92e2405ede"; + hash = "sha256-GGa8ZNHZZD/sU+oL5ekHXxAe3bpX/42x6zO2LJuypNw="; }; nativeBuildInputs = [ makeWrapper ]; @@ -25,32 +50,43 @@ stdenv.mkDerivation rec { cp -a config.example $out/share/doc/rofi-pass/config.example ''; - wrapperPath = with lib; makeBinPath [ + wrapperPath = lib.makeBinPath ([ coreutils findutils gawk gnugrep gnused libnotify - (pass.withExtensions (ext: [ ext.pass-otp ])) pwgen - rofi 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}" + --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"; license = lib.licenses.gpl3; platforms = with lib.platforms; linux; + maintainers = with lib.maintainers; [ lilyinstarlight ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dc6ed7ab4a63..71fc9d0b08d9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -34259,6 +34259,9 @@ with pkgs; }; rofi-pass = callPackage ../tools/security/pass/rofi-pass.nix { }; + rofi-pass-wayland = callPackage ../tools/security/pass/rofi-pass.nix { + backend = "wayland"; + }; rofi-menugen = callPackage ../applications/misc/rofi-menugen { };