From be55a17137619c431491acbce64c9dd518945731 Mon Sep 17 00:00:00 2001 From: Dmitriy Kholkin Date: Fri, 22 Apr 2022 02:15:29 +0300 Subject: [PATCH] move to firefox --- flake.nix | 5 + profiles/applications/firefox.nix | 184 ++++++++++++++++++++++++++ profiles/applications/vivaldi.nix | 8 +- profiles/overlay.nix | 2 + profiles/packages/arkenfox-userjs.nix | 23 ++++ roles/desktop.nix | 1 + 6 files changed, 219 insertions(+), 4 deletions(-) create mode 100755 profiles/applications/firefox.nix create mode 100755 profiles/packages/arkenfox-userjs.nix diff --git a/flake.nix b/flake.nix index 8b71842..b262c02 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,10 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + arkenfox-userjs = { + url = "github:arkenfox/user.js"; + flake = false; + }; base16.url = "github:alukardbf/base16-nix"; # base16.url = "/home/alukard/projects/base16-nix"; base16-horizon-scheme = { @@ -44,6 +48,7 @@ url = "github:mozilla/nixpkgs-mozilla"; flake = false; }; + nur.url = github:nix-community/NUR; qbittorrent-ee = { url = "github:c0re100/qBittorrent-Enhanced-Edition"; flake = false; diff --git a/profiles/applications/firefox.nix b/profiles/applications/firefox.nix new file mode 100755 index 0000000..92fb5e7 --- /dev/null +++ b/profiles/applications/firefox.nix @@ -0,0 +1,184 @@ +{ config, pkgs, lib, ... }: +with lib; +let + thm = config.lib.base16.theme; + fonts = config.lib.base16.theme.fonts; + profileName = "alukard"; + profilePath = ".mozilla/firefox/${profileName}"; + mkUserJs = { prefs ? {}, extraPrefs ? "" }: '' + ${extraPrefs} + + ${concatStrings (mapAttrsToList (name: value: '' + user_pref("${name}", ${builtins.toJSON value}); + '') prefs)} + ''; + + firefox-kpoxa = pkgs.writeShellScriptBin "firefox-kpoxa" '' + ${pkgs.firefox-wayland}/bin/firefox -profile /home/alukard/.mozilla/firefox/kpoxa + ''; +in { + environment.sessionVariables = { + MOZ_USE_XINPUT2 = "1"; + MOZ_DBUS_REMOTE = "1"; + }; + # programs.browserpass.enable = true; + + defaultApplications.browser = { + cmd = "${pkgs.firefox-wayland}/bin/firefox"; + desktop = "firefox"; + }; + + home-manager.users.alukard = { + home.packages = [ firefox-kpoxa ]; + # programs.browserpass = { + # enable = true; + # browsers = [ "firefox" ]; + # }; + wayland.windowManager.sway.config = { + window.commands = [ + { + criteria = { title = "Firefox — Sharing Indicator"; }; + command = "floating enable"; + } + { + criteria = { title = "Firefox — Sharing Indicator"; }; + command = "no_focus"; + } + { + criteria = { title = "Firefox — Sharing Indicator"; }; + command = "resize set 0 0"; + } + { + criteria = { title = "Firefox — Sharing Indicator"; }; + command = "move absolute position 10 10"; + } + ]; + }; + + programs.firefox = { + enable = true; + package = pkgs.firefox-wayland; + profiles = { + alukard = { + id = 0; + userChrome = '' + #TabsToolbar { + visibility: collapse; + } + toolbar#nav-bar, nav-bar-customization-target { + background: ${thm.base00-hex} !important; + } + @-moz-document url("about:newtab") { + * { background-color: ${thm.base00-hex} !important; } + } + ''; + userContent = '' + .scroll-styled-h, .scroll-styled-v, html { + scrollbar-color: #495460 rgba(255, 255, 255, .0); + scrollbar-width: thin; + } + ''; + extraConfig = mkUserJs { + prefs = { + "network.http.referer.XOriginPolicy" = 0; + "signon.rememberSignons" = false; + "browser.quitShortcut.disabled" = true; + "general.autoScroll" = true; + "extensions.pocket.enabled" = false; + "browser.startup.page" = 1; + "browser.startup.homepage" = "https://startpage.ataraxiadev.com"; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.search.suggest.enabled" = true; + "ui.context_menus.after_mouseup" = true; + + "font.name.monospace.x-western" = "${fonts.mono.family}"; + "font.name.sans-serif.x-western" = "${fonts.main.family}"; + "font.name.serif.x-western" = "${fonts.serif.family}"; + "browser.display.background_color" = thm.base00-hex; + "browser.display.foreground_color" = thm.base05-hex; + # "browser.display.document_color_use" = 2; + "browser.anchor_color" = thm.base0D-hex; + "browser.visited_color" = thm.base0C-hex; + "browser.display.use_document_fonts" = true; + "pdfjs.disabled" = true; + + "media.eme.enabled" = true; + + "experiments.activeExperiment" = false; + "experiments.enabled" = false; + "experiments.supported" = false; + "network.allow-experiments" = false; + }; + extraPrefs = "${fileContents "${pkgs.arkenfox-userjs}/share/user-js/profiles/user.js"}"; + }; + }; + kpoxa = { + id = 1; + userContent = '' + .scroll-styled-h, .scroll-styled-v, html { + scrollbar-color: #495460 rgba(255, 255, 255, .0); + scrollbar-width: thin; + } + ''; + extraConfig = mkUserJs { + prefs = { + "network.http.referer.XOriginPolicy" = 0; + "signon.rememberSignons" = false; + "general.autoScroll" = true; + "extensions.pocket.enabled" = false; + "browser.startup.homepage" = "https://startpage.ataraxiadev.com"; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.search.suggest.enabled" = true; + "browser.urlbar.suggest.searches" = true; + "ui.context_menus.after_mouseup" = true; + "keyword.enabled" = true; + "media.eme.enabled" = true; + + "browser.startup.page" = 3; + "network.cookie.lifetimePolicy" = 0; + "browser.sessionstore.privacy_level" = 0; + "privacy.clearOnShutdown.history" = false; + "privacy.cpd.history" = false; + + "font.name.monospace.x-western" = "${fonts.mono.family}"; + "font.name.sans-serif.x-western" = "${fonts.main.family}"; + "font.name.serif.x-western" = "${fonts.serif.family}"; + "browser.display.background_color" = thm.base00-hex; + "browser.display.foreground_color" = thm.base05-hex; + "browser.anchor_color" = thm.base0D-hex; + "browser.visited_color" = thm.base0C-hex; + "browser.display.use_document_fonts" = true; + + "experiments.activeExperiment" = false; + "experiments.enabled" = false; + "experiments.supported" = false; + "network.allow-experiments" = false; + }; + extraPrefs = "${fileContents "${pkgs.arkenfox-userjs}/share/user-js/profiles/user.js"}"; + }; + }; + }; + # extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + # # add-custom-search-engine + # adsum-notabs + # # auto-tab-discard + # bitwarden + # # browserpass + # darkreader + # gesturefy + # libredirect + # markdownload + # refined-github + # # rust-search-extension + # search-by-image + # # search-engines-helper + # skip-redirect + # stylus + # tab-session-manager + # # tampermonkey + # terms-of-service-didnt-read + # ublock-origin + # ]; + }; + }; +} diff --git a/profiles/applications/vivaldi.nix b/profiles/applications/vivaldi.nix index 686a465..849ac8a 100644 --- a/profiles/applications/vivaldi.nix +++ b/profiles/applications/vivaldi.nix @@ -1,8 +1,8 @@ { pkgs, ... }: { - defaultApplications.browser = { - cmd = "${pkgs.vivaldi}/bin/vivaldi"; - desktop = "vivaldi"; - }; +# defaultApplications.browser = { +# cmd = "${pkgs.vivaldi}/bin/vivaldi"; +# desktop = "vivaldi"; +# }; home-manager.users.alukard = { home.packages = with pkgs; [ diff --git a/profiles/overlay.nix b/profiles/overlay.nix index 3a10f88..1ad1404 100644 --- a/profiles/overlay.nix +++ b/profiles/overlay.nix @@ -15,12 +15,14 @@ with lib; { nixpkgs.overlays = [ # inputs.nixpkgs-wayland.overlay inputs.nix-alien.overlay + inputs.nur.overlay roundcube-plugins (self: super: rec { inherit inputs; android-emulator = self.callPackage ./packages/android-emulator.nix { }; + arkenfox-userjs = pkgs.callPackage ./packages/arkenfox-userjs.nix { arkenfox-repo = inputs.arkenfox-userjs; }; bibata-cursors = pkgs.callPackage ./packages/bibata-cursors.nix { }; ceserver = pkgs.callPackage ./packages/ceserver.nix { }; gamescope = pkgs.callPackage ./packages/gamescope.nix { }; diff --git a/profiles/packages/arkenfox-userjs.nix b/profiles/packages/arkenfox-userjs.nix new file mode 100755 index 0000000..1b5ed65 --- /dev/null +++ b/profiles/packages/arkenfox-userjs.nix @@ -0,0 +1,23 @@ +{ stdenv, lib, arkenfox-repo }: +stdenv.mkDerivation { + pname = "arknefox"; + version = "master"; + src = arkenfox-repo; + + dontBuild = true; + + installPhase = '' + mkdir -p $out/share/user-js/profiles + substituteInPlace prefsCleaner.sh \ + --replace 'currdir=$(pwd)' 'currdir=$@' + cp {user.js,prefsCleaner.sh,updater.sh} $out/share/user-js/profiles + ''; + + meta = with lib; { + description = "Firefox privacy, security and anti-fingerprinting"; + homepage = "https://github.com/arkenfox/user.js"; + maintainers = [ danielphan2003 ]; + platforms = platforms.all; + license = licenses.mit; + }; +} \ No newline at end of file diff --git a/roles/desktop.nix b/roles/desktop.nix index 410c435..2d97530 100644 --- a/roles/desktop.nix +++ b/roles/desktop.nix @@ -17,6 +17,7 @@ alacritty corectrl + firefox gamemode himalaya kitty