Skip to content

Commit d22d43a

Browse files
committed
browserpass: 2.0.22 -> 3.0.1
See browserpass/browserpass-native#31 This is fully backwards compatible. (cherry picked from commit 6104fba)
1 parent 43ba99f commit d22d43a

File tree

4 files changed

+202
-44
lines changed

4 files changed

+202
-44
lines changed

pkgs/tools/security/browserpass/2.nix

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This file was generated by https://github.com/kamilchm/go2nix v1.2.1
2+
{ stdenv, buildGoPackage, fetchFromGitHub, gnupg }:
3+
4+
buildGoPackage rec {
5+
name = "browserpass-${version}";
6+
version = "2.0.22";
7+
8+
goPackagePath = "github.com/dannyvankooten/browserpass";
9+
10+
goDeps = ./2deps.nix;
11+
12+
src = fetchFromGitHub {
13+
repo = "browserpass";
14+
owner = "dannyvankooten";
15+
rev = version;
16+
sha256 = "05cacrx08k99c5zra7ksdik9xxn3vih3x6in7536zs5gm55mkbfx";
17+
};
18+
19+
postPatch = ''
20+
substituteInPlace browserpass.go \
21+
--replace /usr/local/bin/gpg ${gnupg}/bin/gpg
22+
'';
23+
24+
postInstall = ''
25+
host_file="$bin/bin/browserpass"
26+
mkdir -p "$bin/etc"
27+
28+
sed -e "s!%%replace%%!$host_file!" go/src/${goPackagePath}/chrome/host.json > chrome-host.json
29+
sed -e "s!%%replace%%!$host_file!" go/src/${goPackagePath}/firefox/host.json > firefox-host.json
30+
31+
install chrome-host.json $bin/etc/
32+
install -D firefox-host.json $bin/lib/mozilla/native-messaging-hosts/com.dannyvankooten.browserpass.json
33+
install go/src/${goPackagePath}/chrome/policy.json $bin/etc/chrome-policy.json
34+
'';
35+
36+
meta = with stdenv.lib; {
37+
description = "A Chrome & Firefox extension for zx2c4's pass";
38+
homepage = https://github.com/dannyvankooten/browserpass;
39+
license = licenses.mit;
40+
platforms = with platforms; linux ++ darwin ++ openbsd;
41+
maintainers = with maintainers; [ rvolosatovs ];
42+
};
43+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This file was generated by https://github.com/kamilchm/go2nix v1.2.1
2+
[
3+
{
4+
goPackagePath = "github.com/gokyle/twofactor";
5+
fetch = {
6+
type = "git";
7+
url = "https://github.com/gokyle/twofactor";
8+
rev = "eaad1884d40f9cabff98a57a524c17afd00c9fe7";
9+
sha256 = "07kvga6f2b56kpy52a3xk16garvlqz950s350dax97x7cayba95g";
10+
};
11+
}
12+
{
13+
goPackagePath = "github.com/mattn/go-zglob";
14+
fetch = {
15+
type = "git";
16+
url = "https://github.com/mattn/go-zglob";
17+
rev = "4959821b481786922ac53e7ef25c61ae19fb7c36";
18+
sha256 = "0rwkdw143kphpmingsrw1zp030zf3p08f64h347jpdm4lz8z5449";
19+
};
20+
}
21+
{
22+
goPackagePath = "github.com/sahilm/fuzzy";
23+
fetch = {
24+
type = "git";
25+
url = "https://github.com/sahilm/fuzzy";
26+
rev = "a154b19bb758dcdd6ede58dc11ea53c2950527b2";
27+
sha256 = "0jkw6474d5ik2fq2zznqxj4y3p42z47r7mbg856ln5wyara2sg0l";
28+
};
29+
}
30+
{
31+
goPackagePath = "rsc.io/qr";
32+
fetch = {
33+
type = "git";
34+
url = "https://github.com/rsc/qr";
35+
rev = "48b2ede4844e13f1a2b7ce4d2529c9af7e359fc5";
36+
sha256 = "1npxy32glnkvsp0871972jzjzgkwaqmbv6jsj9wgqsa1s2jr004p";
37+
};
38+
}
39+
]
Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,65 @@
1-
# This file was generated by https://github.com/kamilchm/go2nix v1.2.1
2-
{ stdenv, buildGoPackage, fetchFromGitHub, gnupg }:
3-
4-
buildGoPackage rec {
5-
name = "browserpass-${version}";
6-
version = "2.0.22";
7-
8-
goPackagePath = "github.com/dannyvankooten/browserpass";
9-
10-
goDeps = ./deps.nix;
1+
{ lib, callPackage, buildGoPackage, fetchFromGitHub, makeWrapper, gnupg }:
2+
let
3+
# For backwards compatibility with v2 of the browser extension, we embed v2
4+
# of the native host in v3. Because the extension will auto-update when it
5+
# is released, this code can be removed from that point on.
6+
# Don't forget to remove v2 references down below and the v2 files in this
7+
# folder
8+
v2 = callPackage ./2.nix {};
9+
in buildGoPackage rec {
10+
pname = "browserpass";
11+
version = "3.0.1";
1112

1213
src = fetchFromGitHub {
13-
repo = "browserpass";
14-
owner = "dannyvankooten";
14+
owner = "browserpass";
15+
repo = "browserpass-native";
1516
rev = version;
16-
sha256 = "05cacrx08k99c5zra7ksdik9xxn3vih3x6in7536zs5gm55mkbfx";
17+
sha256 = "1i3xxysiiapz9y2v0gp13inx7j0d7n0khpmcsy9k95pzn53526dx";
1718
};
1819

20+
nativeBuildInputs = [ makeWrapper ];
21+
22+
goPackagePath = "github.com/browserpass/browserpass-native";
23+
goDeps = ./deps.nix;
24+
1925
postPatch = ''
20-
substituteInPlace browserpass.go \
21-
--replace /usr/local/bin/gpg ${gnupg}/bin/gpg
26+
# Because this Makefile will be installed to be used by the user, patch
27+
# variables to be valid by default
28+
substituteInPlace Makefile \
29+
--replace "PREFIX ?= /usr" ""
2230
'';
2331

24-
postInstall = ''
25-
host_file="$bin/bin/browserpass"
26-
mkdir -p "$bin/etc"
32+
DESTDIR = placeholder "bin";
33+
34+
postConfigure = ''
35+
cd "go/src/$goPackagePath"
36+
make configure
37+
'';
38+
39+
buildPhase = ''
40+
make
41+
'';
42+
43+
installPhase = ''
44+
make install
45+
46+
wrapProgram $bin/bin/browserpass \
47+
--suffix PATH : ${lib.makeBinPath [ gnupg ]}
2748
28-
sed -e "s!%%replace%%!$host_file!" go/src/${goPackagePath}/chrome/host.json > chrome-host.json
29-
sed -e "s!%%replace%%!$host_file!" go/src/${goPackagePath}/firefox/host.json > firefox-host.json
49+
# This path is used by our firefox wrapper for finding native messaging hosts
50+
mkdir -p $bin/lib/mozilla/native-messaging-hosts
51+
ln -s $bin/lib/browserpass/hosts/firefox/*.json $bin/lib/mozilla/native-messaging-hosts
3052
31-
install chrome-host.json $bin/etc/
32-
install -D firefox-host.json $bin/lib/mozilla/native-messaging-hosts/com.dannyvankooten.browserpass.json
33-
install go/src/${goPackagePath}/chrome/policy.json $bin/etc/chrome-policy.json
53+
# These can be removed too, see comment up top
54+
ln -s ${lib.getBin v2}/etc $bin/etc
55+
ln -s ${lib.getBin v2}/lib/mozilla/native-messaging-hosts/* $bin/lib/mozilla/native-messaging-hosts
3456
'';
3557

36-
meta = with stdenv.lib; {
37-
description = "A Chrome & Firefox extension for zx2c4's pass";
38-
homepage = https://github.com/dannyvankooten/browserpass;
39-
license = licenses.mit;
40-
platforms = with platforms; linux ++ darwin ++ openbsd;
41-
maintainers = with maintainers; [ rvolosatovs ];
58+
meta = with lib; {
59+
description = "Browserpass native client app";
60+
homepage = https://github.com/browserpass/browserpass-native;
61+
license = licenses.isc;
62+
platforms = platforms.all;
63+
maintainers = with maintainers; [ rvolosatovs infinisil ];
4264
};
4365
}

pkgs/tools/security/browserpass/deps.nix

Lines changed: 69 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)