Migrate Zen Browser from Flatpak
This commit is contained in:
parent
24f4096ed4
commit
8004d5ca0d
5 changed files with 149 additions and 25 deletions
|
|
@ -206,7 +206,7 @@ $mainMod = SUPER
|
|||
# Launchers and actions
|
||||
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
|
||||
bind = $mainMod, Return, exec, $terminal
|
||||
bind = $mainMod SHIFT, Return, exec, app.zen_browser.zen
|
||||
bind = $mainMod SHIFT, Return, exec, zen
|
||||
bind = $mainMod, D, exec, emacs
|
||||
bind = $mainMod SHIFT, Q, killactive,
|
||||
bind = $mainMod, M, exit,
|
||||
|
|
|
|||
23
flake.lock
generated
23
flake.lock
generated
|
|
@ -249,7 +249,8 @@
|
|||
"home-manager": "home-manager_2",
|
||||
"nix-openclaw": "nix-openclaw",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"zen-browser": "zen-browser"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
|
|
@ -281,6 +282,26 @@
|
|||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"zen-browser": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1775710180,
|
||||
"narHash": "sha256-sCokvdNvl8zIzsnjgG0TN5h3RUI7GJyWW9ErfmEj0rM=",
|
||||
"owner": "youwen5",
|
||||
"repo": "zen-browser-flake",
|
||||
"rev": "2c138beb648d1cbbfae76695a8230ee04e4db25a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "youwen5",
|
||||
"repo": "zen-browser-flake",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
|||
|
|
@ -9,17 +9,21 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
zen-browser = {
|
||||
url = "github:youwen5/zen-browser-flake";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nix-openclaw.url = "github:openclaw/nix-openclaw";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, agenix, nix-openclaw, ... }:
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, agenix, zen-browser, nix-openclaw, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
enableOpenClaw = false;
|
||||
in {
|
||||
nixosConfigurations.Nixos = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit agenix; };
|
||||
specialArgs = { inherit agenix zen-browser; };
|
||||
modules = [
|
||||
./hosts/Nixos/configuration.nix
|
||||
agenix.nixosModules.default
|
||||
|
|
|
|||
106
home/ltadeu6.nix
106
home/ltadeu6.nix
|
|
@ -151,16 +151,16 @@
|
|||
defaultApplications = {
|
||||
"x-scheme-handler/discord-402572971681644545" = [ "discord-402572971681644545.desktop" ];
|
||||
"application/pdf" = [ "org.gnome.Evince.desktop" ];
|
||||
"x-scheme-handler/http" = [ "app.zen_browser.zen.desktop" ];
|
||||
"x-scheme-handler/https" = [ "app.zen_browser.zen.desktop" ];
|
||||
"x-scheme-handler/chrome" = [ "app.zen_browser.zen.desktop" ];
|
||||
"text/html" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/x-extension-htm" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/x-extension-html" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/x-extension-shtml" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/xhtml+xml" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/x-extension-xhtml" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/x-extension-xht" = [ "app.zen_browser.zen.desktop" ];
|
||||
"x-scheme-handler/http" = [ "zen.desktop" ];
|
||||
"x-scheme-handler/https" = [ "zen.desktop" ];
|
||||
"x-scheme-handler/chrome" = [ "zen.desktop" ];
|
||||
"text/html" = [ "zen.desktop" ];
|
||||
"application/x-extension-htm" = [ "zen.desktop" ];
|
||||
"application/x-extension-html" = [ "zen.desktop" ];
|
||||
"application/x-extension-shtml" = [ "zen.desktop" ];
|
||||
"application/xhtml+xml" = [ "zen.desktop" ];
|
||||
"application/x-extension-xhtml" = [ "zen.desktop" ];
|
||||
"application/x-extension-xht" = [ "zen.desktop" ];
|
||||
"image/png" = [ "org.gnome.eog.desktop" ];
|
||||
"image/svg+xml" = [ "org.inkscape.Inkscape.desktop" ];
|
||||
"image/jpeg" = [ "org.gnome.eog.desktop" ];
|
||||
|
|
@ -168,16 +168,16 @@
|
|||
};
|
||||
associations.added = {
|
||||
"application/pdf" = [ "org.gnome.Evince.desktop" ];
|
||||
"x-scheme-handler/http" = [ "app.zen_browser.zen.desktop" ];
|
||||
"x-scheme-handler/https" = [ "app.zen_browser.zen.desktop" ];
|
||||
"x-scheme-handler/chrome" = [ "app.zen_browser.zen.desktop" ];
|
||||
"text/html" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/x-extension-htm" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/x-extension-html" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/x-extension-shtml" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/xhtml+xml" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/x-extension-xhtml" = [ "app.zen_browser.zen.desktop" ];
|
||||
"application/x-extension-xht" = [ "app.zen_browser.zen.desktop" ];
|
||||
"x-scheme-handler/http" = [ "zen.desktop" ];
|
||||
"x-scheme-handler/https" = [ "zen.desktop" ];
|
||||
"x-scheme-handler/chrome" = [ "zen.desktop" ];
|
||||
"text/html" = [ "zen.desktop" ];
|
||||
"application/x-extension-htm" = [ "zen.desktop" ];
|
||||
"application/x-extension-html" = [ "zen.desktop" ];
|
||||
"application/x-extension-shtml" = [ "zen.desktop" ];
|
||||
"application/xhtml+xml" = [ "zen.desktop" ];
|
||||
"application/x-extension-xhtml" = [ "zen.desktop" ];
|
||||
"application/x-extension-xht" = [ "zen.desktop" ];
|
||||
"image/png" = [ "org.gnome.eog.desktop" ];
|
||||
"application/x-partial-download" = [ "mpv.desktop" ];
|
||||
"image/svg+xml" = [ "org.inkscape.Inkscape.desktop" ];
|
||||
|
|
@ -369,6 +369,72 @@
|
|||
fi
|
||||
'';
|
||||
|
||||
home.activation.importZenFlatpakProfile =
|
||||
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
set -euo pipefail
|
||||
src_dir="$HOME/.var/app/app.zen_browser.zen/.zen"
|
||||
dst_dir="$HOME/.zen"
|
||||
tmp_dir="$HOME/.zen.hm-import"
|
||||
preferred_profile="ajei92g8.Default (release)"
|
||||
|
||||
if [ -e "$dst_dir/profiles.ini" ] || [ ! -d "$src_dir" ]; then
|
||||
:
|
||||
else
|
||||
rm -rf "$tmp_dir"
|
||||
cp -a "$src_dir" "$tmp_dir"
|
||||
find "$tmp_dir" \( -name lock -o -name .parentlock \) -delete
|
||||
mv "$tmp_dir" "$dst_dir"
|
||||
fi
|
||||
|
||||
if [ -d "$dst_dir/$preferred_profile" ]; then
|
||||
python3 - "$dst_dir" "$preferred_profile" <<'PY'
|
||||
import configparser
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
base = Path(sys.argv[1])
|
||||
preferred = sys.argv[2]
|
||||
|
||||
profiles_ini = base / "profiles.ini"
|
||||
if profiles_ini.exists():
|
||||
parser = configparser.RawConfigParser()
|
||||
parser.optionxform = str
|
||||
parser.read(profiles_ini)
|
||||
for section in parser.sections():
|
||||
if not section.startswith("Profile"):
|
||||
continue
|
||||
if parser.has_option(section, "Path"):
|
||||
path = parser.get(section, "Path")
|
||||
if path == preferred:
|
||||
parser.set(section, "Default", "1")
|
||||
elif parser.has_option(section, "Default"):
|
||||
parser.remove_option(section, "Default")
|
||||
with profiles_ini.open("w") as f:
|
||||
parser.write(f, space_around_delimiters=False)
|
||||
|
||||
install_id = None
|
||||
for section in parser.sections():
|
||||
if section.startswith("Install"):
|
||||
install_id = section.removeprefix("Install")
|
||||
break
|
||||
|
||||
installs_ini = base / "installs.ini"
|
||||
installs = configparser.RawConfigParser()
|
||||
installs.optionxform = str
|
||||
if installs_ini.exists():
|
||||
installs.read(installs_ini)
|
||||
if install_id is None:
|
||||
install_id = "2953CB39A2589173"
|
||||
if not installs.has_section(install_id):
|
||||
installs.add_section(install_id)
|
||||
installs.set(install_id, "Default", preferred)
|
||||
installs.set(install_id, "Locked", "1")
|
||||
with installs_ini.open("w") as f:
|
||||
installs.write(f, space_around_delimiters=False)
|
||||
PY
|
||||
fi
|
||||
'';
|
||||
|
||||
services.spotifyd = {
|
||||
enable = true;
|
||||
settings.global = {
|
||||
|
|
|
|||
|
|
@ -2,10 +2,42 @@
|
|||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
|
||||
{ config, pkgs, lib, agenix, ... }:
|
||||
{ config, pkgs, lib, agenix, zen-browser, ... }:
|
||||
let
|
||||
username = "ltadeu6";
|
||||
homeDir = "/home/${username}";
|
||||
zenExtension = shortId: guid: {
|
||||
name = guid;
|
||||
value = {
|
||||
install_url =
|
||||
"https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
|
||||
installation_mode = "normal_installed";
|
||||
};
|
||||
};
|
||||
zenBrowserPackage = pkgs.wrapFirefox
|
||||
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});'')
|
||||
{
|
||||
"extensions.autoDisableScopes" = 0;
|
||||
"extensions.pocket.enabled" = false;
|
||||
});
|
||||
|
||||
extraPolicies = {
|
||||
DisableAppUpdate = true;
|
||||
DisableTelemetry = true;
|
||||
ExtensionSettings = builtins.listToAttrs [
|
||||
(zenExtension "brazilian-portuguese-dictionary"
|
||||
"pt-BR@dictionaries.addons.mozilla.org")
|
||||
(zenExtension "ublock-origin" "uBlock0@raymondhill.net")
|
||||
(zenExtension "sponsorblock" "sponsorBlocker@ajay.app")
|
||||
(zenExtension "proton-vpn-firefox-extension" "vpn@proton.ch")
|
||||
(zenExtension "darkreader" "addon@darkreader.org")
|
||||
];
|
||||
};
|
||||
};
|
||||
in {
|
||||
imports = [ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
|
|
@ -799,6 +831,7 @@ in {
|
|||
environment.systemPackages = with pkgs; [
|
||||
most
|
||||
agenix.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
zenBrowserPackage
|
||||
# mangohud
|
||||
hyfetch
|
||||
cacert
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue