Refactor the whole configuration #1
1 changed files with 60 additions and 81 deletions
|
@ -3,98 +3,77 @@
|
||||||
# https://github.com/schizofox/schizofox/blob/cdf69b2a445ff12680657a3bd44ce7c406bf2ae6/flake/modules/home-manager/default.nix
|
# https://github.com/schizofox/schizofox/blob/cdf69b2a445ff12680657a3bd44ce7c406bf2ae6/flake/modules/home-manager/default.nix
|
||||||
|
|
||||||
{ ... }: final: prev: {
|
{ ... }: final: prev: {
|
||||||
firefox-esr-wrapped = let
|
firefox-esr = let
|
||||||
sandboxFirefox = base: let
|
sandboxed-firefox-esr = prev.mkNixPak {
|
||||||
sandboxed = prev.mkNixPak {
|
config = { sloth, ... }: {
|
||||||
config = { sloth, ... }: {
|
app.package = prev.firefox-esr;
|
||||||
app.package = base;
|
app.binPath = "bin/firefox-esr";
|
||||||
app.binPath = "bin/firefox-esr";
|
flatpak.appId = "org.mozilla.firefox";
|
||||||
flatpak.appId = "org.mozilla.firefox";
|
|
||||||
|
|
||||||
dbus.policies = {
|
dbus.policies = {
|
||||||
"org.a11y.Bus" = "talk";
|
"org.a11y.Bus" = "talk";
|
||||||
"org.gnome.SessionManager" = "talk";
|
"org.gnome.SessionManager" = "talk";
|
||||||
"org.freedesktop.ScreenSaver" = "talk";
|
"org.freedesktop.ScreenSaver" = "talk";
|
||||||
"org.gtk.vfs.*" = "talk";
|
"org.gtk.vfs.*" = "talk";
|
||||||
"org.gtk.vfs" = "talk";
|
"org.gtk.vfs" = "talk";
|
||||||
"org.freedesktop.Notifications" = "talk";
|
"org.freedesktop.Notifications" = "talk";
|
||||||
"org.freedesktop.portal.FileChooser" = "talk";
|
"org.freedesktop.portal.FileChooser" = "talk";
|
||||||
"org.freedesktop.portal.Settings" = "talk";
|
"org.freedesktop.portal.Settings" = "talk";
|
||||||
"org.mpris.MediaPlayer2.firefox.*" = "own";
|
"org.mpris.MediaPlayer2.firefox.*" = "own";
|
||||||
"org.mozilla.firefox.*" = "own";
|
"org.mozilla.firefox.*" = "own";
|
||||||
"org.mozilla.firefox_beta.*" = "own";
|
"org.mozilla.firefox_beta.*" = "own";
|
||||||
"org.freedesktop.DBus" = "talk";
|
"org.freedesktop.DBus" = "talk";
|
||||||
"org.freedesktop.DBus.*" = "talk";
|
"org.freedesktop.DBus.*" = "talk";
|
||||||
"ca.desrt.dconf" = "talk";
|
"ca.desrt.dconf" = "talk";
|
||||||
"org.freedesktop.portal.*" = "talk";
|
"org.freedesktop.portal.*" = "talk";
|
||||||
"org.freedesktop.NetworkManager" = "talk";
|
"org.freedesktop.NetworkManager" = "talk";
|
||||||
"org.freedesktop.FileManager1" = "talk";
|
"org.freedesktop.FileManager1" = "talk";
|
||||||
};
|
};
|
||||||
|
|
||||||
gpu.enable = true;
|
gpu.enable = true;
|
||||||
gpu.provider = "bundle";
|
gpu.provider = "bundle";
|
||||||
fonts.enable = true;
|
fonts.enable = true;
|
||||||
locale.enable = true;
|
locale.enable = true;
|
||||||
etc.sslCertificates.enable = true;
|
etc.sslCertificates.enable = true;
|
||||||
|
|
||||||
bubblewrap = let
|
bubblewrap = let
|
||||||
envSuffix = envKey: sloth.concat' (sloth.env envKey);
|
envSuffix = envKey: sloth.concat' (sloth.env envKey);
|
||||||
in {
|
in {
|
||||||
bind.dev = [ "/dev/shm" ];
|
bind.dev = [ "/dev/shm" ];
|
||||||
tmpfs = [ "/tmp" ];
|
tmpfs = [ "/tmp" ];
|
||||||
|
|
||||||
bind.rw = [
|
bind.rw = [
|
||||||
sloth.xdgDownloadDir
|
sloth.xdgDownloadDir
|
||||||
|
|
||||||
(envSuffix "XDG_RUNTIME_DIR" "/at-spi/bus")
|
(envSuffix "XDG_RUNTIME_DIR" "/at-spi/bus")
|
||||||
(envSuffix "XDG_RUNTIME_DIR" "/gvfsd")
|
(envSuffix "XDG_RUNTIME_DIR" "/gvfsd")
|
||||||
(envSuffix "XDG_RUNTIME_DIR" "/pulse")
|
(envSuffix "XDG_RUNTIME_DIR" "/pulse")
|
||||||
(envSuffix "XDG_RUNTIME_DIR" "/doc")
|
(envSuffix "XDG_RUNTIME_DIR" "/doc")
|
||||||
(envSuffix "XDG_RUNTIME_DIR" "/dconf")
|
(envSuffix "XDG_RUNTIME_DIR" "/dconf")
|
||||||
|
|
||||||
[(sloth.mkdir (sloth.concat' sloth.xdgConfigHome "/mozilla")) (sloth.concat' sloth.homeDir "/.mozilla")]
|
[(sloth.mkdir (sloth.concat' sloth.xdgConfigHome "/mozilla")) (sloth.concat' sloth.homeDir "/.mozilla")]
|
||||||
];
|
];
|
||||||
|
|
||||||
bind.ro = [
|
bind.ro = [
|
||||||
"/sys/bus/pci"
|
"/sys/bus/pci"
|
||||||
"/etc/resolv.conf"
|
"/etc/resolv.conf"
|
||||||
"/etc/localtime"
|
"/etc/localtime"
|
||||||
["${prev.firefox-esr}/lib/firefox" "/app/etc/firefox"]
|
["${prev.firefox-esr}/lib/firefox" "/app/etc/firefox"]
|
||||||
(sloth.concat' sloth.xdgConfigHome "/dconf")
|
(sloth.concat' sloth.xdgConfigHome "/dconf")
|
||||||
(sloth.concat' sloth.xdgConfigHome "/gtk-2.0")
|
(sloth.concat' sloth.xdgConfigHome "/gtk-2.0")
|
||||||
(sloth.concat' sloth.xdgConfigHome "/gtk-3.0")
|
(sloth.concat' sloth.xdgConfigHome "/gtk-3.0")
|
||||||
(sloth.concat' sloth.xdgConfigHome "/gtk-4.0")
|
(sloth.concat' sloth.xdgConfigHome "/gtk-4.0")
|
||||||
(sloth.concat' sloth.xdgConfigHome "/dconf")
|
(sloth.concat' sloth.xdgConfigHome "/dconf")
|
||||||
];
|
];
|
||||||
|
|
||||||
sockets = {
|
sockets = {
|
||||||
x11 = false;
|
x11 = false;
|
||||||
wayland = true;
|
wayland = true;
|
||||||
pipewire = true;
|
pipewire = true;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in sandboxed.config.env;
|
|
||||||
baseWrapped = sandboxFirefox prev.firefox-esr;
|
|
||||||
|
|
||||||
finalizePackage = base: base // {
|
|
||||||
inherit (prev.firefox-esr)
|
|
||||||
meta
|
|
||||||
browserName
|
|
||||||
binaryName
|
|
||||||
version;
|
|
||||||
|
|
||||||
unwrapped = prev.firefox-esr;
|
|
||||||
|
|
||||||
override = attrs: let
|
|
||||||
firefoxWithCfg = if attrs ? cfg
|
|
||||||
then prev.firefox-esr.override attrs
|
|
||||||
else prev.firefox-esr;
|
|
||||||
in finalizePackage (sandboxFirefox firefoxWithCfg);
|
|
||||||
|
|
||||||
overrideAttrs = f: finalizePackage (sandboxFirefox prev.firefox-esr);
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
finalizePackage baseWrapped;
|
sandboxed-firefox-esr.config.env;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue