From 5af904b8d766c6b6c7b7ff47f84ec3a80d0b93b7 Mon Sep 17 00:00:00 2001 From: caem Date: Fri, 24 Jan 2025 16:50:18 +0100 Subject: [PATCH] if this works first try --- modules/nixos/desktop/gnome/default.nix | 1 + overlays/nixpkgs/firefox.nix | 73 +++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 overlays/nixpkgs/firefox.nix diff --git a/modules/nixos/desktop/gnome/default.nix b/modules/nixos/desktop/gnome/default.nix index 61ecd06..3622cc1 100644 --- a/modules/nixos/desktop/gnome/default.nix +++ b/modules/nixos/desktop/gnome/default.nix @@ -34,6 +34,7 @@ environment.systemPackages = with pkgs; [ ghostty dconf-editor + firefox-esr ] ++ (with pkgs.gnomeExtensions; [ caffeine accent-directories diff --git a/overlays/nixpkgs/firefox.nix b/overlays/nixpkgs/firefox.nix new file mode 100644 index 0000000..91a0756 --- /dev/null +++ b/overlays/nixpkgs/firefox.nix @@ -0,0 +1,73 @@ +# Shamelessly stolen most parts from https://github.com/schizofox/schizofox + +{ pkgs, ... }: final: prev: { + firefox-esr = pkgs.mkNixPak { + config = { sloth, ... }: { + app.package = pkgs.firefox-esr; + flatpak.appId = "org.mozilla.firefox"; + dbus.policies = { + "org.mozilla.Firefox" = "own"; + "org.mozilla.Firefox.*" = "own"; + "org.a11y.Bus" = "talk"; + "org.gnome.SessionManager" = "talk"; + "org.freedesktop.ScreenSaver" = "talk"; + "org.gtk.vfs.*" = "talk"; + "org.gtk.vfs" = "talk"; + "org.freedesktop.Notifications" = "talk"; + "org.freedesktop.portal.FileChooser" = "talk"; + "org.freedesktop.portal.Settings" = "talk"; + "org.mpris.MediaPlayer2.firefox.*" = "own"; + "org.mozilla.firefox.*" = "own"; + "org.mozilla.firefox_beta.*" = "own"; + "org.freedesktop.DBus" = "talk"; + "org.freedesktop.DBus.*" = "talk"; + "ca.desrt.dconf" = "talk"; + "org.freedesktop.portal.*" = "talk"; + "org.freedesktop.NetworkManager" = "talk"; + "org.freedesktop.FileManager1" = "talk"; + }; + + gpu.enable = true; + gpu.provider = "bundle"; + fonts.enable = true; + locale.enable = true; + etc.sslCertificates.enable = true; + + bubblewrap = let + envSuffix = envKey: sloth.concat' (sloth.env envKey); + in { + network = true; + + bind.rw = [ + (sloth.concat' sloth.xdgCacheHome "/fontconfig") + (sloth.concat' sloth.xdgCacheHome "/mesa_shader_cache") + (sloth.concat [ + (sloth.env "XDG_RUNTIME_DIR") + "/" + (sloth.envOr "WAYLAND_DISPLAY" "no") + ]) + "/tmp/.X11-unix" + (sloth.envOr "XAUTHORITY" "/no-xauth") + + (envSuffix "XDG_RUNTIME_DIR" "/at-spi/bus") + (envSuffix "XDG_RUNTIME_DIR" "/gvfsd") + (envSuffix "XDG_RUNTIME_DIR" "/pulse") + (envSuffix "XDG_RUNTIME_DIR" "/doc") + (envSuffix "XDG_RUNTIME_DIR" "/dconf") + + (sloth.concat [sloth.xdgConfigHome "/.mozilla"]) + ]; + + bind.ro = [ + "/etc/resolv.conf" + (sloth.concat' sloth.xdgConfigHome "/gtk-2.0") + (sloth.concat' sloth.xdgConfigHome "/gtk-3.0") + (sloth.concat' sloth.xdgConfigHome "/gtk-4.0") + (sloth.concat' sloth.xdgConfigHome "/dconf") + "/etc/localtime" + "/sys/bus/pci" + ]; + }; + }; + }; +}