2023-03-15 03:20:53 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gnupg
|
|
|
|
, makeWrapper
|
2023-06-06 11:18:27 +00:00
|
|
|
, autoPatchelfHook
|
2023-06-07 20:38:43 +00:00
|
|
|
, testers
|
|
|
|
, browserpass
|
2023-03-15 03:20:53 +00:00
|
|
|
}:
|
|
|
|
|
2019-04-28 18:05:24 +00:00
|
|
|
buildGoModule rec {
|
2019-03-31 21:13:44 +00:00
|
|
|
pname = "browserpass";
|
2023-03-07 07:20:01 +00:00
|
|
|
version = "3.1.0";
|
2017-11-05 13:38:03 +00:00
|
|
|
|
2017-06-12 23:03:02 +00:00
|
|
|
src = fetchFromGitHub {
|
2019-03-31 21:13:44 +00:00
|
|
|
owner = "browserpass";
|
|
|
|
repo = "browserpass-native";
|
2017-06-12 23:03:02 +00:00
|
|
|
rev = version;
|
2023-03-07 07:20:01 +00:00
|
|
|
sha256 = "sha256-UZzOPRRiCUIG7uSSp9AEPMDN/+4cgyK47RhrI8oUx8U=";
|
2017-04-10 21:21:20 +00:00
|
|
|
};
|
|
|
|
|
2023-06-08 22:15:06 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ] ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
|
2019-03-31 21:13:44 +00:00
|
|
|
|
2023-03-07 07:20:01 +00:00
|
|
|
vendorHash = "sha256-CjuH4ANP2bJDeA+o+1j+obbtk5/NVLet/OFS3Rms4r0=";
|
2019-03-31 21:13:44 +00:00
|
|
|
|
2023-03-15 03:20:53 +00:00
|
|
|
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
2020-08-04 00:26:27 +00:00
|
|
|
|
2018-04-16 14:49:01 +00:00
|
|
|
postPatch = ''
|
2019-03-31 21:13:44 +00:00
|
|
|
# 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-24 20:06:19 +00:00
|
|
|
sed -i -e 's/SED =.*/SED = sed/' Makefile
|
|
|
|
sed -i -e 's/INSTALL =.*/INSTALL = install/' Makefile
|
2018-04-16 14:49:01 +00:00
|
|
|
'';
|
|
|
|
|
2019-04-28 18:05:24 +00:00
|
|
|
DESTDIR = placeholder "out";
|
2019-03-31 21:13:44 +00:00
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
make configure
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
2023-03-15 03:20:53 +00:00
|
|
|
make browserpass
|
2019-03-31 21:13:44 +00:00
|
|
|
'';
|
|
|
|
|
2023-03-15 03:20:53 +00:00
|
|
|
checkTarget = "test";
|
|
|
|
|
2019-03-31 21:13:44 +00:00
|
|
|
installPhase = ''
|
|
|
|
make install
|
|
|
|
|
2019-04-28 18:05:24 +00:00
|
|
|
wrapProgram $out/bin/browserpass \
|
2019-03-31 21:13:44 +00:00
|
|
|
--suffix PATH : ${lib.makeBinPath [ gnupg ]}
|
2017-04-10 21:21:20 +00:00
|
|
|
|
2019-03-31 21:13:44 +00:00
|
|
|
# This path is used by our firefox wrapper for finding native messaging hosts
|
2019-04-28 18:05:24 +00:00
|
|
|
mkdir -p $out/lib/mozilla/native-messaging-hosts
|
|
|
|
ln -s $out/lib/browserpass/hosts/firefox/*.json $out/lib/mozilla/native-messaging-hosts
|
2017-04-10 21:21:20 +00:00
|
|
|
'';
|
|
|
|
|
2023-06-07 20:38:43 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = browserpass;
|
|
|
|
command = "browserpass --version";
|
|
|
|
};
|
|
|
|
|
2019-03-31 21:13:44 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Browserpass native client app";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/browserpass/browserpass-native";
|
2019-03-31 21:13:44 +00:00
|
|
|
license = licenses.isc;
|
|
|
|
maintainers = with maintainers; [ rvolosatovs infinisil ];
|
2017-04-10 21:21:20 +00:00
|
|
|
};
|
2020-07-31 03:58:04 +00:00
|
|
|
}
|