browserpass: 2.0.22 -> 3.0.1

See https://github.com/browserpass/browserpass-native/issues/31

This is fully backwards compatible.
This commit is contained in:
Silvan Mosberger
2019-04-01 01:24:28 +02:00
parent c637aeff19
commit 6104fba188
4 changed files with 203 additions and 45 deletions
+52 -30
View File
@@ -1,43 +1,65 @@
# This file was generated by https://github.com/kamilchm/go2nix v1.2.1
{ stdenv, buildGoPackage, fetchFromGitHub, gnupg }:
buildGoPackage rec {
name = "browserpass-${version}";
version = "2.0.22";
goPackagePath = "github.com/dannyvankooten/browserpass";
goDeps = ./deps.nix;
{ 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";
version = "3.0.1";
src = fetchFromGitHub {
repo = "browserpass";
owner = "dannyvankooten";
owner = "browserpass";
repo = "browserpass-native";
rev = version;
sha256 = "05cacrx08k99c5zra7ksdik9xxn3vih3x6in7536zs5gm55mkbfx";
sha256 = "1i3xxysiiapz9y2v0gp13inx7j0d7n0khpmcsy9k95pzn53526dx";
};
nativeBuildInputs = [ makeWrapper ];
goPackagePath = "github.com/browserpass/browserpass-native";
goDeps = ./deps.nix;
postPatch = ''
substituteInPlace browserpass.go \
--replace /usr/local/bin/gpg ${gnupg}/bin/gpg
# Because this Makefile will be installed to be used by the user, patch
# variables to be valid by default
substituteInPlace Makefile \
--replace "PREFIX ?= /usr" ""
'';
postInstall = ''
host_file="$bin/bin/browserpass"
mkdir -p "$bin/etc"
DESTDIR = placeholder "bin";
sed -e "s!%%replace%%!$host_file!" go/src/${goPackagePath}/chrome/host.json > chrome-host.json
sed -e "s!%%replace%%!$host_file!" go/src/${goPackagePath}/firefox/host.json > firefox-host.json
install chrome-host.json $bin/etc/
install -D firefox-host.json $bin/lib/mozilla/native-messaging-hosts/com.dannyvankooten.browserpass.json
install go/src/${goPackagePath}/chrome/policy.json $bin/etc/chrome-policy.json
postConfigure = ''
cd "go/src/$goPackagePath"
make configure
'';
meta = with stdenv.lib; {
description = "A Chrome & Firefox extension for zx2c4's pass";
homepage = https://github.com/dannyvankooten/browserpass;
license = licenses.mit;
platforms = with platforms; linux ++ darwin ++ openbsd;
maintainers = with maintainers; [ rvolosatovs ];
buildPhase = ''
make
'';
installPhase = ''
make install
wrapProgram $bin/bin/browserpass \
--suffix PATH : ${lib.makeBinPath [ gnupg ]}
# 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
# 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
'';
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 ];
};
}