2019-03-31 21:13:44 +00:00
|
|
|
{ lib, callPackage, buildGoPackage, fetchFromGitHub, makeWrapper, gnupg }:
|
|
|
|
let
|
|
|
|
# For backwards compatibility with v2 of the browser extension, we embed v2
|
|
|
|
# of the native host in v3. Because the extension will auto-update when it
|
|
|
|
# is released, this code can be removed from that point on.
|
|
|
|
# Don't forget to remove v2 references down below and the v2 files in this
|
|
|
|
# folder
|
|
|
|
v2 = callPackage ./2.nix {};
|
|
|
|
in buildGoPackage rec {
|
|
|
|
pname = "browserpass";
|
2019-04-14 19:16:17 +00:00
|
|
|
version = "3.0.6";
|
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;
|
2019-04-14 19:16:17 +00:00
|
|
|
sha256 = "0q3bsla07zjl6i69nj1axbkg2ia89pvh0jg6nlqgbm2kpzzbn0pz";
|
2017-04-10 21:21:20 +00:00
|
|
|
};
|
|
|
|
|
2019-03-31 21:13:44 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
goPackagePath = "github.com/browserpass/browserpass-native";
|
|
|
|
goDeps = ./deps.nix;
|
|
|
|
|
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" ""
|
2019-04-14 19:16:17 +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-03-31 21:13:44 +00:00
|
|
|
DESTDIR = placeholder "bin";
|
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
cd "go/src/$goPackagePath"
|
|
|
|
make configure
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
make
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
make install
|
|
|
|
|
|
|
|
wrapProgram $bin/bin/browserpass \
|
|
|
|
--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
|
|
|
|
mkdir -p $bin/lib/mozilla/native-messaging-hosts
|
|
|
|
ln -s $bin/lib/browserpass/hosts/firefox/*.json $bin/lib/mozilla/native-messaging-hosts
|
2017-04-10 21:21:20 +00:00
|
|
|
|
2019-03-31 21:13:44 +00:00
|
|
|
# These can be removed too, see comment up top
|
|
|
|
ln -s ${lib.getBin v2}/etc $bin/etc
|
|
|
|
ln -s ${lib.getBin v2}/lib/mozilla/native-messaging-hosts/* $bin/lib/mozilla/native-messaging-hosts
|
2017-04-10 21:21:20 +00:00
|
|
|
'';
|
|
|
|
|
2019-03-31 21:13:44 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Browserpass native client app";
|
|
|
|
homepage = https://github.com/browserpass/browserpass-native;
|
|
|
|
license = licenses.isc;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ rvolosatovs infinisil ];
|
2017-04-10 21:21:20 +00:00
|
|
|
};
|
2017-04-22 13:13:02 +00:00
|
|
|
}
|