2023-04-12 12:48:02 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gnupg
|
|
|
|
, makeWrapper
|
2023-07-15 17:15:38 +00:00
|
|
|
, autoPatchelfHook
|
|
|
|
, testers
|
|
|
|
, browserpass
|
2023-04-12 12:48:02 +00:00
|
|
|
}:
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildGoModule rec {
|
|
|
|
pname = "browserpass";
|
2023-03-15 16:39:30 +00:00
|
|
|
version = "3.1.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "browserpass";
|
|
|
|
repo = "browserpass-native";
|
|
|
|
rev = version;
|
2023-03-15 16:39:30 +00:00
|
|
|
sha256 = "sha256-UZzOPRRiCUIG7uSSp9AEPMDN/+4cgyK47RhrI8oUx8U=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ] ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
vendorHash = "sha256-CjuH4ANP2bJDeA+o+1j+obbtk5/NVLet/OFS3Rms4r0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Because this Makefile will be installed to be used by the user, patch
|
|
|
|
# variables to be valid by default
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "PREFIX ?= /usr" ""
|
2022-04-27 09:35:20 +00:00
|
|
|
sed -i -e 's/SED =.*/SED = sed/' Makefile
|
|
|
|
sed -i -e 's/INSTALL =.*/INSTALL = install/' Makefile
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
DESTDIR = placeholder "out";
|
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
make configure
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
2023-04-12 12:48:02 +00:00
|
|
|
make browserpass
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
checkTarget = "test";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
|
|
|
make install
|
|
|
|
|
|
|
|
wrapProgram $out/bin/browserpass \
|
|
|
|
--suffix PATH : ${lib.makeBinPath [ gnupg ]}
|
|
|
|
|
|
|
|
# This path is used by our firefox wrapper for finding native messaging hosts
|
|
|
|
mkdir -p $out/lib/mozilla/native-messaging-hosts
|
2024-02-07 01:22:34 +00:00
|
|
|
# Copy ff manifests rather than linking to allow link-farming to work recursively in dependants
|
|
|
|
cp $out/lib/browserpass/hosts/firefox/*.json $out/lib/mozilla/native-messaging-hosts/
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = browserpass;
|
|
|
|
command = "browserpass --version";
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Browserpass native client app";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "browserpass";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/browserpass/browserpass-native";
|
|
|
|
license = licenses.isc;
|
2024-04-21 15:54:59 +00:00
|
|
|
maintainers = with maintainers; [ rvolosatovs ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-08-20 17:08:02 +00:00
|
|
|
}
|