Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package request: Zen Browser #327982

Open
BlueFox1616 opened this issue Jul 17, 2024 · 96 comments · Fixed by #347222 · May be fixed by #363992
Open

Package request: Zen Browser #327982

BlueFox1616 opened this issue Jul 17, 2024 · 96 comments · Fixed by #347222 · May be fixed by #363992
Labels
0.kind: packaging request Request for a new package to be added 6.topic: nodejs

Comments

@BlueFox1616
Copy link

BlueFox1616 commented Jul 17, 2024

Zen
zen-browser

Project description

User-friendly, useful, mods that increase usability can be added from the zen-mods mod store, a customizable browser, features that can be searched for in a browser for the end user, easy to use thanks to the shortcut key assignment feature, theme-store, frequently used progressive web apps, add-on apps, websites can be easily accessed thanks to the sidebar feature, can be viewed as a mobile page. container, work spaces, zen-mods, window management by creating multiple tab sections in a window, sidebar feature.

Metadata

@BlueFox1616 BlueFox1616 added the 0.kind: packaging request Request for a new package to be added label Jul 17, 2024
@Lenny0939
Copy link

I've tried to write a package for it based on the package for the floorp browser, but it's not working for some reason. I get this error:

> Running phase: patchPhase
      > applying patch /nix/store/9lx1746yy56pn3dpc35l1xr6l3lykbin-env_var_for_system_dir-ff111.patch
      > patching file toolkit/xre/nsXREDirProvider.cpp
      > applying patch /nix/store/6wsdh6246xbmlv3jr5q7qpl9ay3acq04-no-buildconfig-ffx121.patch
      > patching file docshell/base/nsAboutRedirector.cpp
      > Hunk #1 succeeded at 73 (offset -15 lines).
      > patching file toolkit/content/jar.mn
      > Hunk #1 FAILED at 41.
      > 1 out of 1 hunk FAILED -- saving rejects to file toolkit/content/jar.mn.rej

This is my first time packaging something so I don't really know how to fix it

@mr-cheff
Copy link

mr-cheff commented Aug 2, 2024

toolkit/content/jar.mn doesnt exist

@Cristiandis

This comment was marked as spam.

1 similar comment
@chaezwav

This comment was marked as spam.

@pective

This comment was marked as spam.

1 similar comment
@mateowoetam

This comment was marked as spam.

@FMGordillo
Copy link

FMGordillo commented Aug 20, 2024

This is what I got thus far

...
00:00:06 checking cargo version... 1.77.1
00:00:06 checking for rust host triplet... x86_64-unknown-linux-gnu
00:00:06 checking for rust target triplet... x86_64-unknown-linux-gnu
00:00:06 checking for rustdoc... /nix/store/p8nr5crc52shb4n5b1z266z0g674239g-rustc-wrapper-1.77.2/bin/rustdoc
00:00:06 checking for cbindgen... /nix/store/07i7asifw6pp4a4fgmmxgq8a7r78bfyh-rust-cbindgen-0.26.0/bin/cbindgen
00:00:06 checking for rustfmt... not found
00:00:06 checking for clang for bindgen... /nix/store/v78293y2wi2kyxb93hp30k0ra9r77amf-clang-wrapper-17.0.6/bin/clang++
00:00:06 checking for libclang for bindgen... not found
00:00:06 ERROR: Could not find libclang to generate rust bindings for C/C++. Please install the necessary packages, run `mach bootstrap`, or use --with-libclang-path to give the path containing it.
00:00:06 W Exception when writing resource usage file: [Errno 2] No such file or directory: '/home/me/code/desktop/engine/obj-x86_64-pc-linux-gnu/.mozbuild/profile_build_resources.json'
00:00:07  Config object not found by mach.
00:00:07 *** Fix above errors and then restart with "./mach build"
let
  pkgs = import <nixpkgs> { };
  # I don't know if it needs gcc
in pkgs.mkShell {
  nativeBuildInputs = with pkgs; [
    # TODO: Install from cargo? Or use this instead?
    rust-cbindgen
    # TODO: Install from cargo? Or use this instead?
    rust-bindgen

    alsa-lib
    cargo
    clang
    gcc
    libpulseaudio
    libclang
    llvm
    pkg-config
    python3
    rustc
  ];
}

Maybe someone with experience building with Firefox could help it out on this one

@chaezwav
Copy link

Isn't there a firefox builder? Just looking at the Floorp expression they didn't use mkshell

@baduhai
Copy link
Contributor

baduhai commented Aug 21, 2024

Building this doesn't seem to be the same as building other firefox forks, since it uses surfer to automate building.

@MarceColl
Copy link

Meanwhile to avoid the flatpak I have this flake that uses the binary release while a proper build works: https://github.com/MarceColl/zen-browser-flake

@fndov

This comment was marked as spam.

@chaezwav
Copy link

Meanwhile to avoid the flatpak I have this flake that uses the binary release while a proper build works: https://github.com/MarceColl/zen-browser-flake

Is there anyway you could make it for the generic version too?

@dit7ya
Copy link
Member

dit7ya commented Aug 22, 2024

I spent some time tinkering with this only to later realize Firefox itself doesn't build on aarch64-darwin (my current machine) via nixpkgs.

{
  lib,
  stdenv,
  fetchFromGitHub,
  buildNpmPackage,
  vips,
  pkg-config,
  fetchurl,
  gnutar,
  git,
}: let
  firefoxVersion = "129.0.2";
  firefoxSrc = fetchurl {
    url = "mirror://mozilla/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.xz";
    hash = "sha512-9oBah+XLTkN1g5FuPsGzEtxz7sX8Bs56A4sTvXxoJ7GM84PDBkXZZiPOQWdTUfMCPsa5+J1nbxyImZTq558sEw==";
  };
in
  buildNpmPackage rec {
    pname = "zen-browser";
    version = "1.0.0-a.26";

    src = fetchFromGitHub {
      owner = "zen-browser";
      repo = "desktop";
      rev = version;
      hash = "sha256-SFLleJXchumnA28eYjSkMlFMqngoH8bp02q2WkGlYas=";
      fetchSubmodules = true;
    };

    nativeBuildInputs = [git pkg-config];
    buildInputs = [vips gnutar];
    patches = [./changes.patch];

    preBuild = ''
      patch node_modules/@zen-browser/surfer/dist/utils/version.js < ${./dist_utils_version.js.patch}
      patch node_modules/@zen-browser/surfer/dist/commands/download/firefox.js < ${./dist_commands_download_firefox.js.patch}


      # put the firefox source in the right place (.surfer/engine)
      mkdir -p .surfer/engine

      cp -r ${firefoxSrc} .surfer/engine/firefox-${firefoxVersion}.source.tar.xz

      npm run init
    '';

    makeCacheWritable = true;
    npmDepsHash = "sha256-AxGh/MC8Kw2SHw4wYOTyZjmC1q+hemPxSJZkjWNrYbo=";

    meta = with lib; {
      description = "Experience tranquillity while browsing the web without people tracking you";
      homepage = "https://github.com/zen-browser/desktop";
      license = licenses.mpl20;
      maintainers = with maintainers; [];
      mainProgram = "zen-browser";
      platforms = platforms.all;
    };
  }

The main issue with this package is that it depends on @zen-browser/surfer which does the main heavy-lifting of downloading various things via Javascript.

I think there are two approaches we can take here to build this from source.

  1. Patch aggressively inside the @zen-browser/surfer to replace all network calls with FODs, but still using their build pattern and scripts. Not sure if this can work, and how much effort it is going to be to make everything compatible with Nix.

  2. Utilizing buildMozillaMach to essentially replace what surfer does, but I am not sure how feasible this is.

@MarceColl
Copy link

Meanwhile to avoid the flatpak I have this flake that uses the binary release while a proper build works: https://github.com/MarceColl/zen-browser-flake

Is there anyway you could make it for the generic version too?

@chaezwav I've pushed an update that adds the generic version, you can find more information in the README. Let me know if it works for you and if not feel free to open an issue in the repo.

@chaezwav
Copy link

chaezwav commented Aug 22, 2024

@MarceColl It built properly and works fine. Thank you!

@baduhai
Copy link
Contributor

baduhai commented Aug 22, 2024

@dit7ya I'm trying to pickup where you left off, what are the patches that you have in your derivation?

@Eveeifyeve
Copy link
Contributor

I will look into trying to make this work, but I won't maintain it.

@timon-schelling
Copy link
Contributor

@Eveeifyeve I would. I'm also working on this. My biggest problem is getting it to work with the firefox wrapper for extensions etc.

@Eveeifyeve
Copy link
Contributor

I pretty much know nixpkgs so this shouldn't be hard.
The only hard part is patching some things.

@baduhai
Copy link
Contributor

baduhai commented Aug 23, 2024

@Eveeifyeve I would be willing to maintain it too.

How are you trying to go about this? Are you trying to use buildMachMozilla, or are you compiling this using surfer as does upstream, then patching things manually?

@Eveeifyeve
Copy link
Contributor

@Eveeifyeve I would be willing to maintain it too.

How are you trying to go about this? Are you trying to use buildMachMozilla, or are you compiling this using surfer as does upstream, then patching things manually?

Trying to use buildMachMozilla.

@Eveeifyeve
Copy link
Contributor

Eveeifyeve commented Aug 23, 2024

I will work on this tmr as it's 1am for me.

@baduhai
Copy link
Contributor

baduhai commented Aug 23, 2024

@Eveeifyeve Do you have your work on some public repo? I can pick this up when I have some time later today.

@Suri312006

This comment was marked as spam.

@Eveeifyeve
Copy link
Contributor

@Eveeifyeve Do you have your work on some public repo? I can pick this up when I have some time later today.

I can publish some changes to a repo today so you can pickup from.

@Eveeifyeve
Copy link
Contributor

Eveeifyeve commented Aug 24, 2024

Hey I don't think it's possible to do buildMachMozilla as it contains it's own cli aka surfer to build and grab Firefox source and build it with patches applied using npm scripts. We have to patch some stuff with their surfer cli as their build proccess uses surfer to grab source of firefox, so this has to be a buildNpmPackage which also allows for the package to work on linux & darwin.

Also it doesn't include files needed to be a buildMachMozilla like take a look at librewolf and floop browser as an example it doesn't contain files like moz.config and etc.

So summary buildMachMozzila doesn't give stuff that we need for zen-browser.

I am trying to get a working on a version that hopefully should work both Darwin & Linux over here.

also @dit7ya can you please provide the patch files?

Useful Links:

Surfer CLI Github:

Surfer CLI Source Code (NPM): https://www.npmjs.com/package/@zen-browser/surfer?activeTab=code

  • Look in dist/commands/download/firefox.js
  • Look in dist/utils/version.js

@Eveeifyeve
Copy link
Contributor

Hey I don't think it's possible to do buildMachMozilla as it contains it's own cli aka surfer to build and grab Firefox source and build it with patches applied using npm scripts. We have to patch some stuff with their surfer cli as their build proccess uses surfer to grab source of firefox, so this has to be a buildNpmPackage which also allows for the package to work on linux & darwin.

Also it doesn't include files needed to be a buildMachMozilla like take a look at librewolf and floop browser as an example it doesn't contain files like moz.config and etc.

So summary buildMachMozzila doesn't give stuff that we need for zen-browser.

I am trying to get a working on a version that hopefully should work both Darwin & Linux over here.

also @dit7ya can you please provide the patch files?

Useful Links:

Surfer CLI Github:

Surfer CLI Source Code (NPM): https://www.npmjs.com/package/@zen-browser/surfer?activeTab=code

  • Look in dist/commands/download/firefox.js
  • Look in dist/utils/version.js

I mean you could do an mkdirevation and use pnpm which is what the project maintainers use.

@BlueFox1616 BlueFox1616 reopened this Oct 21, 2024
@universish
Copy link

universish commented Oct 21, 2024

@BlueFox1616 , Could you please update the issue content:

**Zen**
zen-browser

**Project description**

User-friendly, useful, mods that increase usability can be added from the zen-mods mod store, a customizable browser, features that can be searched for in a browser for the end user, easy to use thanks to the shortcut key assignment feature, theme-store, frequently used progressive web apps, add-on apps, websites can be easily accessed thanks to the sidebar feature, can be viewed as a mobile page. container, work spaces, zen-mods, window management by creating multiple tab sections in a window, sidebar feature.

**Metadata**

* homepage URL: https://zen-browser.app/
* github homepage URL: https://github.com/zen-browser
* source URL: https://github.com/zen-browser/desktop
* flathub source URL: https://github.com/zen-browser/flatpak
* download URLs: https://github.com/zen-browser/desktop/releases ; flatpak: https://github.com/zen-browser/flatpak/releases ; flathub: https://flathub.org/apps/io.github.zen_browser.zen ; https://zen-browser.app/download
* license: MPL-2, MIT
* platforms: gnu-linux libre, gnu-linux, darwin (apple's), net (ms's)
* OSs: gnu-linux libre distros, gnu-linux distros, windows, macOS
* distribution formats of software: appimage, dmg, exe, flatpak, mar (portable, mozilla archive)


@BlueFox1616
Copy link
Author

i just edited it

@theotheroracle
Copy link
Contributor

not sure if it's better to ask here or the PR, but will native messaging hosts like firefoxpwa be supported by this ?

@mahyarmirrashed
Copy link

Following up on this, does this mean that we need to create a nixpkg for surfer so that we can use that to build Zen? What's the current state of this?

@youwen5
Copy link
Member

youwen5 commented Nov 20, 2024

@mahyarmirrashed It just means we need to package the surfer tool so that it can be used in the build phase of Zen.

We have actually completed packaging everything over in #347222 and it's just waiting to be merged.

@winterqt
Copy link
Member

Reopening this, but please see #347222 (comment). Do not open a PR packaging this without addressing all of these concerns.

@winterqt winterqt reopened this Nov 30, 2024
@JohnRTitor
Copy link
Contributor

Another point I would add is, surfer is very hard to work with, with each update, it may even become a hassle for maintainers. Then there's a concern of using git in the derivation.

If in future after packaging this on Nixpkgs, this becomes unmaintainable, we might just have to remove it again.

@Eveeifyeve
Copy link
Contributor

Another point I would add is, surfer is very hard to work with, with each update, it may even become a hassle for maintainers. Then there's a concern of using git in the derivation.

If in future after packaging this on Nixpkgs, this becomes unmaintainable, we might just have to remove it again.

Please mention this in pr #347222

@winterqt
Copy link
Member

It was already mentioned (at least, the Git part).

@mahyarmirrashed
Copy link

Can we mention the difficulties of integrating surfer with the Zen maintainers?

@Eveeifyeve
Copy link
Contributor

Can we mention the difficulties of integrating surfer with the Zen maintainers?

Maybe?

@phsb5321
Copy link

phsb5321 commented Dec 6, 2024

Hi everyone! I've been following this issue and really excited about getting Zen Browser into nixpkgs. I was wondering if there's any rough timeline or next steps planned? I noticed the previous PR (#347222) had some challenges around Surfer integration and Git dependencies. Is there anyone currently working on a new PR that addresses these, or would it be helpful to open a fresh PR to keep momentum going?

@brianmay
Copy link
Contributor

brianmay commented Dec 6, 2024

I think we can't do anything until Zen has a new release that isn't based on an old Firefox with known security issues.

@RayZ3R0
Copy link

RayZ3R0 commented Dec 6, 2024

Currently, Firefox Stable is at version 133. Zen did update to version 133, but it caused several issues with the browser due to some untested changes, so it was rolled back. Zen is moving to a beta release soon, which will be based on the latest Firefox version.

@BlueFox1616
Copy link
Author

BlueFox1616 commented Dec 10, 2024

zen beta has been released

@Eveeifyeve Eveeifyeve linked a pull request Dec 10, 2024 that will close this issue
13 tasks
@NklsCh
Copy link

NklsCh commented Dec 12, 2024

Maybe also take a look at this flake from @fufexan?
https://github.com/fufexan/zen-browser-flake
I think you can extract most of the stuff from there already

@justDeeevin
Copy link
Contributor

this flake is more up-to-date (probably mostly the same for packaging though)

@omarcresp
Copy link

I have a fork from @MarceColl also for my usage of zen browser meanwhile the pkgs is approve. the thing with this flakes is that it didnt build from source it just packages the image zen browser provides which didnt align with nixpkgs idea where pkgs should be built from source whenever it is possible

Also, I recommend using flakes like https://github.com/0xc000022070/zen-browser-flake for zen browser because of the auto update (we have github actions that update the flake versions without the need of manual work). Zen browser is highly unstable yet and depending on nixpkgs update cycle to get the newer versions or rollbacks may be counter productive, specially if you're in a stable channel. I rather having my zen outside the radar of nixpkgs through flakes so that i can update and revert it individually without messing my pkgs channel at least until zen become stable

@Pandapip1
Copy link
Contributor

I would expect that all the version bumps would be backported as per the backport criterion for packages that need to be up to date to work properly.

@fufexan
Copy link
Contributor

fufexan commented Dec 24, 2024

With the recent (1.0.2-b.4) change of dropping the specific variant, I've also added aarch64 support to my flake.

If anyone wants to test it out and give feedback I would appreciate it.

@Eveeifyeve
Copy link
Contributor

Eveeifyeve commented Dec 24, 2024

With the recent (1.0.2-b.4) change of dropping the specific variant, I've also added aarch64 support to my flake.

If anyone wants to test it out and give feedback I would appreciate it.

Well I just dropped support for 1.0.2-b.4. Please let me know if it works in this pr, as I don't have an aarch64-linux machine but i have an x86_64-linux.

@fufexan
Copy link
Contributor

fufexan commented Dec 24, 2024

I don't have an aarch64 machine either. I mentioned this as I haven't seen other flakes which support it.

@luisnquin
Copy link
Member

We're also supporting the latest browser version in this flake 0xc000022070/zen-browser-flake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: packaging request Request for a new package to be added 6.topic: nodejs
Projects
None yet