Jump to content

Zen Browser: Difference between revisions

From Official NixOS Wiki
Klinger (talk | contribs)
mNo edit summary
Changed the flake to 0xc000022070's more updated flake. Added home manager installation instructions and a reference to the flake's home manager configuration reference section. Removed the configuration section.
 
Line 11: Line 11:


== Installation ==
== Installation ==
 
For any installation method, use nixpkgs-unstable to ensure compatibility with the latest Firefox version.
==== Shell (Flakes) ====
<syntaxhighlight lang="bash">
nix shell github:youwen5/zen-browser-flake
</syntaxhighlight>The command above makes zen available in your current shell.


==== System setup (Flakes) ====
==== System setup (Flakes) ====
First add the zen flake to your <code>flake.nix</code><syntaxhighlight lang="nix">
Add the zen flake to your <code>flake.nix</code><syntaxhighlight lang="nix">{
{
   ...
   ...
   inputs = {
   inputs = {
     ...
     ...
     zen-browser = {
     zen-browser = {
       url = "github:youwen5/zen-browser-flake";
       url = "github:0xc000022070/zen-browser-flake";
       inputs.nixpkgs.follows = "nixpkgs";
       inputs.nixpkgs.follows = "nixpkgs";
     };
     };
   }
   }
}
}</syntaxhighlight>Add zen to your <code>environment.systemPackages</code><syntaxhighlight lang="nix">{
</syntaxhighlight>Then add zen to your <code>environment.systemPackages</code><syntaxhighlight lang="nix">
{
   inputs,
   inputs,
   ...
   ...
}: {
}: {
   environment.systemPackages = [
   environment.systemPackages = [
     inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default
     inputs.zen-browser.packages."${pkgs.stdenv.hostPlatform.system}".default # default, beta, twilight, or twilight-official
   ];
   ];
}
}</syntaxhighlight>Default and beta both install the beta version of zen.
</syntaxhighlight>After rebuilding, Zen will be installed system-wide.


== Configuration ==
==== Home Manager (Flakes) ====
This is an example of a pure, declarative, wrapper-based configuration independent of NixOS and home-manager (though it is presented as a NixOS module for convenience). Extensions are not packaged through Nix, but are installed by the browser upon startup. It should also work on any Firefox based browser.<syntaxhighlight lang="nix">
First add the zen flake to your <code>flake.nix</code><syntaxhighlight lang="nix">{
{
  inputs,
  pkgs,
  lib,
   ...
   ...
}:
   inputs = {
let
     ...
   extension = shortId: guid: {
     zen-browser = {
     name = guid;
       url = "github:0xc000022070/zen-browser-flake";
     value = {
      inputs.nixpkgs.follows = "nixpkgs";
       install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
       home-manager.follows = "home-manager";
       installation_mode = "normal_installed";
     };
     };
   };
   }
}</syntaxhighlight>Add zen to your Home Manager configuration:<syntaxhighlight lang="nix">
{
  imports = [
    inputs.zen-browser.homeModules.beta # beta, twilight, or twilight-official
  ];


   prefs = {
   programs.zen-browser = {
     # Check these out at about:config
     enable = true;
    "extensions.autoDisableScopes" = 0;
     setAsDefaultBrowser = true;
     "extensions.pocket.enabled" = false;
    # ...
   };
   };
  extensions = [
    # To add additional extensions, find it on addons.mozilla.org, find
    # the short ID in the url (like https://addons.mozilla.org/en-US/firefox/addon/!SHORT_ID!/)
    # Then go to https://addons.mozilla.org/api/v5/addons/addon/!SHORT_ID!/ to get the guid
    (extension "ublock-origin" "uBlock0@raymondhill.net")
    # ...
  ];
in
{
  environment.systemPackages = [
    (pkgs.wrapFirefox
      inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.zen-browser-unwrapped
      {
        extraPrefs = lib.concatLines (
          lib.mapAttrsToList (
            name: value: ''lockPref(${lib.strings.toJSON name}, ${lib.strings.toJSON value});''
          ) prefs
        );
        extraPolicies = {
          DisableTelemetry = true;
          ExtensionSettings = builtins.listToAttrs extensions;
          SearchEngines = {
            Default = "ddg";
            Add = [
              {
                Name = "nixpkgs packages";
                URLTemplate = "https://search.nixos.org/packages?query={searchTerms}";
                IconURL = "https://wiki.nixos.org/favicon.ico";
                Alias = "@np";
              }
              {
                Name = "NixOS options";
                URLTemplate = "https://search.nixos.org/options?query={searchTerms}";
                IconURL = "https://wiki.nixos.org/favicon.ico";
                Alias = "@no";
              }
              {
                Name = "NixOS Wiki";
                URLTemplate = "https://wiki.nixos.org/w/index.php?search={searchTerms}";
                IconURL = "https://wiki.nixos.org/favicon.ico";
                Alias = "@nw";
              }
              {
                Name = "noogle";
                URLTemplate = "https://noogle.dev/q?term={searchTerms}";
                IconURL = "https://noogle.dev/favicon.ico";
                Alias = "@ng";
              }
            ];
          };
        };
      }
    )
  ];
}
}
</syntaxhighlight>
</syntaxhighlight>Please see the flake repository's [https://github.com/0xc000022070/zen-browser-flake#home-manager-reference Home Manager Reference Section] or the [https://github.com/0xc000022070/zen-browser-flake#configuration-examples Configuration Examples Section] for more information on how to declaratively configure Zen with Home Manager.
 
 
[[Category:Web Browser]]
[[Category:Web Browser]]

Latest revision as of 01:30, 24 October 2026

Zen

Native Application

100%

Zen is a firefox based browser that promises a calmer internet, and features a sideways based tab system.

Installation

For any installation method, use nixpkgs-unstable to ensure compatibility with the latest Firefox version.

System setup (Flakes)

Add the zen flake to your flake.nix

{
  ...
  inputs = {
    ...
    zen-browser = {
      url = "github:0xc000022070/zen-browser-flake";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  }
}

Add zen to your environment.systemPackages

{
  inputs,
  ...
}: {
  environment.systemPackages = [
    inputs.zen-browser.packages."${pkgs.stdenv.hostPlatform.system}".default # default, beta, twilight, or twilight-official
  ];
}

Default and beta both install the beta version of zen.

Home Manager (Flakes)

First add the zen flake to your flake.nix

{
  ...
  inputs = {
    ...
    zen-browser = {
      url = "github:0xc000022070/zen-browser-flake";
      inputs.nixpkgs.follows = "nixpkgs";
      home-manager.follows = "home-manager";
    };
  }
}

Add zen to your Home Manager configuration:

{
  imports = [
    inputs.zen-browser.homeModules.beta # beta, twilight, or twilight-official
  ];

  programs.zen-browser = {
    enable = true;
    setAsDefaultBrowser = true;
  };
}

Please see the flake repository's Home Manager Reference Section or the Configuration Examples Section for more information on how to declaratively configure Zen with Home Manager.