2021-01-25 08:26:54 +00:00
|
|
|
{ lib, buildGoPackage, fetchurl, fetchFromGitHub, go-bindata }:
|
2018-07-30 20:32:22 +01:00
|
|
|
|
|
|
|
let
|
2019-12-28 02:56:52 +00:00
|
|
|
version = "1.6.4";
|
2018-07-30 20:32:22 +01:00
|
|
|
|
|
|
|
# TODO: must build the extension instead of downloading it. But since it's
|
|
|
|
# literally an asset that is indifferent regardless of the platform, this
|
|
|
|
# might be just enough.
|
|
|
|
webext = fetchurl {
|
|
|
|
url = "https://github.com/browsh-org/browsh/releases/download/v${version}/browsh-${version}-an.fx.xpi";
|
2019-12-28 02:56:52 +00:00
|
|
|
sha256 = "1shf1s9s525wns5vrsc4ns21zjxm1si43lx6v0q8ma6vd5x5445l";
|
2018-07-30 20:32:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
in buildGoPackage rec {
|
|
|
|
inherit version;
|
|
|
|
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "browsh";
|
2018-07-30 20:32:22 +01:00
|
|
|
|
|
|
|
goPackagePath = "browsh";
|
|
|
|
|
2019-04-14 01:39:28 +01:00
|
|
|
# further go package dependencies are defined in deps.nix, see line below.
|
2018-07-30 20:32:22 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "browsh-org";
|
|
|
|
repo = "browsh";
|
|
|
|
rev = "v${version}";
|
2019-12-28 02:56:52 +00:00
|
|
|
sha256 = "0gvf5k1gm81xxg7ha309kgfkgl5357dli0fbc4z01rmfgbl0rfa0";
|
2018-07-30 20:32:22 +01:00
|
|
|
};
|
|
|
|
|
2020-03-17 23:21:40 +00:00
|
|
|
nativeBuildInputs = [ go-bindata ];
|
2018-07-30 20:32:22 +01:00
|
|
|
|
|
|
|
# embed the web extension in a go file and place it where it's supposed to
|
|
|
|
# be. See
|
2019-04-14 01:39:28 +01:00
|
|
|
# https://github.com/browsh-org/browsh/blob/v1.5.0/interfacer/contrib/xpi2bin.sh
|
2018-07-30 20:32:22 +01:00
|
|
|
preBuild = ''
|
|
|
|
xpiprefix="$(mktemp -d)"
|
|
|
|
cp "${webext}" "$xpiprefix/browsh.xpi"
|
|
|
|
go-bindata \
|
|
|
|
-prefix "$xpiprefix" \
|
|
|
|
-pkg browsh \
|
|
|
|
-o "$NIX_BUILD_TOP/go/src/${goPackagePath}/interfacer/src/browsh/webextension.go" \
|
|
|
|
"$xpiprefix/browsh.xpi"
|
|
|
|
|
|
|
|
sed \
|
|
|
|
-e 's:Asset("/browsh.xpi"):Asset("browsh.xpi"):g' \
|
|
|
|
-i "$NIX_BUILD_TOP/go/src/${goPackagePath}/interfacer/src/browsh/firefox.go"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postBuild = ''
|
|
|
|
mv "$NIX_BUILD_TOP/go/bin/src" "$NIX_BUILD_TOP/go/bin/browsh"
|
|
|
|
'';
|
|
|
|
|
|
|
|
goDeps = ./deps.nix;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-07-30 20:32:22 +01:00
|
|
|
description = "A fully-modern text-based browser, rendering to TTY and browsers";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.brow.sh/";
|
2018-07-30 20:32:22 +01:00
|
|
|
maintainers = [ maintainers.kalbasit ];
|
2021-01-15 13:21:58 +00:00
|
|
|
license = lib.licenses.lgpl21;
|
|
|
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
2018-07-30 20:32:22 +01:00
|
|
|
};
|
|
|
|
}
|