diff --git a/pkgs/tools/networking/bukubrow/default.nix b/pkgs/tools/networking/bukubrow/default.nix index aee1b5c0e1d9..e83e72cbfb44 100644 --- a/pkgs/tools/networking/bukubrow/default.nix +++ b/pkgs/tools/networking/bukubrow/default.nix @@ -1,34 +1,46 @@ -{ stdenv, rustPlatform, fetchFromGitHub, sqlite }: +{ stdenv, rustPlatform, fetchFromGitHub, sqlite }: let -rustPlatform.buildRustPackage rec { - pname = "bukubrow"; - version = "2.4.0"; +manifest = { + description = "Bukubrow extension host application"; + name = "com.samhh.bukubrow"; + path = "@out@/bin/bukubrow"; + type = "stdio"; +}; + +in rustPlatform.buildRustPackage rec { + pname = "bukubrow-host"; + version = "5.0.0"; src = fetchFromGitHub { owner = "SamHH"; - repo = "bukubrow"; - rev = version; - sha256 = "1wrwav7am73bmgbpwh1pi0b8k7vhydqvw91hmmhnvbjhrhbns7s5"; + repo = pname; + rev = "v${version}"; + sha256 = "1a3gqxj6d1shv3w0v9m8x2xr0bvcynchy778yqalxkc3x4vr0nbn"; }; - sourceRoot = "source/binary"; - cargoSha256 = "0553awiba24a3a8xwjhlwf8yzbs44lnirjvcxnvsgah7dc44r0gj"; + cargoSha256 = "06nh99cvg3y4f98fs0j5bkidzq6fg46wk47z5jfzz5lf72ha54lk"; buildInputs = [ sqlite ]; + passAsFile = [ "firefoxManifest" "chromeManifest" ]; + firefoxManifest = builtins.toJSON (manifest // { + allowed_extensions = [ "bukubrow@samhh.com" ]; + }); + chromeManifest = builtins.toJSON (manifest // { + allowed_origins = [ "chrome-extension://ghniladkapjacfajiooekgkfopkjblpn/" ]; + }); + postBuild = '' + substituteAll $firefoxManifestPath firefox.json + substituteAll $chromeManifestPath chrome.json + ''; postInstall = '' - mkdir -p $out/etc $out/lib/mozilla/native-messaging-hosts - - host_file="$out/bin/bukubrow" - sed -e "s!%%replace%%!$host_file!" browser-hosts/firefox.json > "$out/etc/firefox-host.json" - sed -e "s!%%replace%%!$host_file!" browser-hosts/chrome.json > "$out/etc/chrome-host.json" - - ln -s $out/etc/firefox-host.json $out/lib/mozilla/native-messaging-hosts/com.samhh.bukubrow.json + install -Dm0644 firefox.json $out/lib/mozilla/native-messaging-hosts/com.samhh.bukubrow.json + install -Dm0644 chrome.json $out/etc/chromium/native-messaging-hosts/com.samhh.bukubrow.json ''; meta = with stdenv.lib; { description = "Bukubrow is a WebExtension for Buku, a command-line bookmark manager"; - homepage = https://github.com/SamHH/bukubrow; + homepage = https://github.com/SamHH/bukubrow-host; license = licenses.gpl3; platforms = platforms.all; maintainers = with maintainers; [ infinisil ];