diff --git a/flake.lock b/flake.lock index 286a271..13ee505 100644 --- a/flake.lock +++ b/flake.lock @@ -77,6 +77,27 @@ "type": "github" } }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nur", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems_2" @@ -203,6 +224,27 @@ "type": "github" } }, + "nur": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1763052046, + "narHash": "sha256-SHdav1soeHzFZFgAiRJORaSyB/D7FEd0ZH3JZLAcLy4=", + "owner": "nix-community", + "repo": "NUR", + "rev": "2712fb70b786a703e39fddf77414469d16654e94", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, "nuschtosSearch": { "inputs": { "flake-utils": "flake-utils", @@ -257,6 +299,7 @@ "kwin-effects-forceblur": "kwin-effects-forceblur", "nixpkgs": "nixpkgs", "nixvim": "nixvim", + "nur": "nur", "plasma-manager": "plasma-manager" } }, diff --git a/flake.nix b/flake.nix index a16aa88..9459ff1 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,11 @@ inputs.home-manager.follows = "home-manager"; }; + nur = { + url = "github:nix-community/NUR"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixvim = { url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; @@ -42,6 +47,7 @@ catppuccin, home-manager, plasma-manager, + nur, nixvim, kwin-effects-forceblur, apple-silicon, @@ -63,6 +69,7 @@ modules = [ { nixpkgs.overlays = [ + nur.overlays.default (import ./packages/widevine-firefox/overlay.nix) (import ./packages/strawberry/overlay.nix) (import ./packages/helium-browser/overlay.nix) diff --git a/home/all.nix b/home/all.nix index beb9238..a5fb926 100755 --- a/home/all.nix +++ b/home/all.nix @@ -27,6 +27,9 @@ spotdl rclone helium-browser + deno + prettier + prettierd kde-rounded-corners kdePackages.partitionmanager diff --git a/home/browsers/firefox/default.nix b/home/browsers/firefox/default.nix new file mode 100644 index 0000000..eb311bb --- /dev/null +++ b/home/browsers/firefox/default.nix @@ -0,0 +1,75 @@ +# https://discourse.nixos.org/t/combining-best-of-system-firefox-and-home-manager-firefox-settings/37721 +{ pkgs, ... }: + +{ + programs.firefox = { + enable = true; + profiles = { + default = { + id = 0; + name = "default"; + isDefault = true; + userChrome = ./userChrome.css; + extensions = { + force = true; + packages = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + plasma-integration + stylus + violentmonkey + consent-o-matic + privacy-badger + sponsorblock + ]; + settings = { + "uBlock0@raymondhill.net".settings = { + selectedFilterLists = [ + "ublock-filters" + "ublock-badware" + "ublock-privacy" + "ublock-unbreak" + "ublock-quick-fixes" + ]; + }; + + "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}".settings = { + dbInChromeStorage = true; # required for Stylus + }; + }; + }; + settings = { + "extensions.autoDisableScopes" = 0; # enables all extensions automatically + "xpinstall.signatures.required" = false; + "extensions.update.autoUpdateDefault" = false; + "extensions.update.enabled" = false; + "browser.search.defaultenginename" = "google"; + "browser.search.order.1" = "google"; + + "signon.rememberSignons" = false; + "widget.use-xdg-desktop-portal.file-picker" = 1; + "browser.aboutConfig.showWarning" = false; + "browser.compactmode.show" = true; + "browser.cache.disk.enable" = true; # Set to false if you have a HDD + "browser.warnOnQuitShortcut" = false; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + + # "mousewheel.default.delta_multiplier_x" = 100; + # "mousewheel.default.delta_multiplier_y" = 100; + # "mousewheel.default.delta_multiplier_z" = 100; + + # Firefox 75+ remembers the last workspace it was opened on as part of its session management. + # This is annoying, because I can have a blank workspace, click Firefox from the launcher, and + # then have Firefox open on some other workspace. + "widget.disable-workspace-management" = true; + }; + search = { + force = true; + default = "google"; + order = [ + "google" + ]; + }; + }; + }; + }; +} diff --git a/home/browsers/firefox/userChrome.css b/home/browsers/firefox/userChrome.css new file mode 100644 index 0000000..ac60443 --- /dev/null +++ b/home/browsers/firefox/userChrome.css @@ -0,0 +1,223 @@ +@media (prefers-color-scheme: light) { + :root { + /* bookmark_text */ + --toolbar-color: #eff1f5ff !important; + + /* button_background_active */ + --toolbarbutton-active-background: rgba(156, 160, 176, 1) !important; + + /* button_background_hover */ + --toolbarbutton-hover-background: rgba(204, 208, 218, 1) !important; + + /* icons */ + --toolbarbutton-icon-fill: #4c4f69ff !important; + + /* icons_attention */ + --toolbarbutton-icon-fill-attention: #4c4f69ff !important; + + /* frame */ + --toolbox-non-lwt-bgcolor: #dce0e8ff !important; + + /* frame_inactive */ + &:where([tabsintitlebar]) { + --toolbox-non-lwt-bgcolor-inactive: #dce0e8ff !important; + } + + /* popup */ + --arrowpanel-background: #eff1f5ff !important; + + /* popup_border */ + --arrowpanel-border-color: #9ca0b0ff !important; + + /* popup_highlight */ + --urlbarView-highlight-background: #9ca0b0ff !important; + + /* popup_highlight_text */ + --urlbarView-highlight-color: #4c4f69ff !important; + + /* popup_text */ + --arrowpanel-color: #4c4f69ff !important; + + /* tab_background_text */ + --toolbox-non-lwt-textcolor: #4c4f69ff !important; + + /* tab_line */ + .tab-background[selected]:not([multiselected]) { + outline: 1px solid #9ca0b0ff; + outline-offset: -1px; + } + + .tab-background[multiselected] { + --focus-outline-color: #9ca0b0ff; + } + + /* tab_loading */ + #tabbrowser-tabs { + --tab-loading-fill: #9ca0b0ff !important; + } + + /* tab_selected */ + --tab-selected-bgcolor: #eff1f5ff !important; + + /* tab_text */ + --tab-selected-textcolor: #4c4f69ff !important; + + /* toolbar */ + --toolbar-bgcolor: #eff1f5ff !important; + + /* toolbar_bottom_separator */ + --chrome-content-separator-color: #eff1f5ff !important; + + /* toolbar_field */ + --input-bgcolor: #e6e9efff !important; + --toolbar-field-background-color: var(--input-bgcolor) !important; + + /* toolbar_field_border */ + --input-border-color: #eff1f5ff !important; + --toolbar-field-border-color: var(--input-border-color) !important; + + /* toolbar_field_border_focus */ + --toolbar-field-focus-border-color: #6c7086ff !important; + + /* toolbar_field_focus */ + --toolbar-field-focus-background-color: #eff1f5ff !important; + + /* toolbar_field_highlight */ + #urlbar-input, + .searchbar-textbox { + &:focus::selection { + background-color: #6c7086ff; + } + } + + /* toolbar_field_highlight_text */ + #urlbar-input, + .searchbar-textbox { + &:focus::selection { + color: #eff1f5ff; + } + } + + /* toolbar_field_text */ + --input-color: #4c4f69ff !important; + --toolbar-field-color: var(--input-color) !important; + + /* toolbar_field_text_focus */ + --toolbar-field-focus-color: #4c4f69ff !important; + + /* toolbar_vertical_separator */ + --toolbarseparator-color: #6c7086ff !important; + } +} + +@media (prefers-color-scheme: dark) { + :root { + /* bookmark_text */ + --toolbar-color: #1e1e2eff !important; + + /* button_background_active */ + --toolbarbutton-active-background: rgba(108, 112, 134, 1) !important; + + /* button_background_hover */ + --toolbarbutton-hover-background: rgba(49, 50, 68, 1) !important; + + /* icons */ + --toolbarbutton-icon-fill: #cdd6f4ff !important; + + /* icons_attention */ + --toolbarbutton-icon-fill-attention: #cdd6f4ff !important; + + /* frame */ + --toolbox-non-lwt-bgcolor: #11111bff !important; + + /* frame_inactive */ + &:where([tabsintitlebar]) { + --toolbox-non-lwt-bgcolor-inactive: #11111bff !important; + } + + /* popup */ + --arrowpanel-background: #1e1e2eff !important; + + /* popup_border */ + --arrowpanel-border-color: #6c7086ff !important; + + /* popup_highlight */ + --urlbarView-highlight-background: #6c7086ff !important; + + /* popup_highlight_text */ + --urlbarView-highlight-color: #cdd6f4ff !important; + + /* popup_text */ + --arrowpanel-color: #cdd6f4ff !important; + + /* tab_background_text */ + --toolbox-non-lwt-textcolor: #cdd6f4ff !important; + + /* tab_line */ + .tab-background[selected]:not([multiselected]) { + outline: 1px solid #6c7086ff; + outline-offset: -1px; + } + + .tab-background[multiselected] { + --focus-outline-color: #6c7086ff; + } + + /* tab_loading */ + #tabbrowser-tabs { + --tab-loading-fill: #6c7086ff !important; + } + + /* tab_selected */ + --tab-selected-bgcolor: #1e1e2eff !important; + + /* tab_text */ + --tab-selected-textcolor: #cdd6f4ff !important; + + /* toolbar */ + --toolbar-bgcolor: #1e1e2eff !important; + + /* toolbar_bottom_separator */ + --chrome-content-separator-color: #1e1e2eff !important; + + /* toolbar_field */ + --input-bgcolor: #181825ff !important; + --toolbar-field-background-color: var(--input-bgcolor) !important; + + /* toolbar_field_border */ + --input-border-color: #1e1e2eff !important; + --toolbar-field-border-color: var(--input-border-color) !important; + + /* toolbar_field_border_focus */ + --toolbar-field-focus-border-color: #6c7086ff !important; + + /* toolbar_field_focus */ + --toolbar-field-focus-background-color: #1e1e2eff !important; + + /* toolbar_field_highlight */ + #urlbar-input, + .searchbar-textbox { + &:focus::selection { + background-color: #6c7086ff; + } + } + + /* toolbar_field_highlight_text */ + #urlbar-input, + .searchbar-textbox { + &:focus::selection { + color: #1e1e2eff; + } + } + + /* toolbar_field_text */ + --input-color: #cdd6f4ff !important; + --toolbar-field-color: var(--input-color) !important; + + /* toolbar_field_text_focus */ + --toolbar-field-focus-color: #cdd6f4ff !important; + + /* toolbar_vertical_separator */ + --toolbarseparator-color: #6c7086ff !important; + } +} diff --git a/system/all.nix b/system/all.nix index f94830c..68f6321 100755 --- a/system/all.nix +++ b/system/all.nix @@ -26,6 +26,7 @@ home-manager.users.sckova = { imports = [ ../home/all.nix + ../home/browsers/firefox/default.nix ../home/${config.networking.hostName}.nix ]; }; diff --git a/system/browsers/firefox.nix b/system/browsers/firefox.nix index b24c03b..f795cf4 100644 --- a/system/browsers/firefox.nix +++ b/system/browsers/firefox.nix @@ -1,3 +1,4 @@ +# https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265 { pkgs, ... }: let @@ -15,106 +16,79 @@ in MOZ_GMP_PATH = "${pkgs.widevine-firefox}/gmp-widevinecdm/system-installed"; }; - programs.firefox = { - enable = true; - preferences = { - "widget.use-xdg-desktop-portal.file-picker" = 1; - "widget.gtk.global-menu.enabled" = true; - "widget.gtk.global-menu.wayland.enabled" = true; - "browser.tabs.inTitlebar" = 0; - "extensions.pocket.enabled" = false; - "extensions.screenshots.disabled" = true; - "browser.topsites.contile.enabled" = false; - "browser.formfill.enable" = false; - "browser.search.suggest.enabled" = false; - "browser.search.suggest.enabled.private" = false; - "browser.urlbar.suggest.searches" = false; - "browser.urlbar.showSearchSuggestionsFirst" = false; - "browser.newtabpage.activity-stream.feeds.section.topstories" = false; - "browser.newtabpage.activity-stream.feeds.snippets" = false; - "browser.newtabpage.activity-stream.section.highlights.includePocket" = false; - "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = false; - "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = false; - "browser.newtabpage.activity-stream.section.highlights.includeVisited" = false; - "browser.newtabpage.activity-stream.showSponsored" = false; - "browser.newtabpage.activity-stream.system.showSponsored" = false; - "browser.newtabpage.activity-stream.showSponsoredTopSites" = false; + programs = { + firefox = { + enable = true; + languagePacks = [ "en-US" ]; - "media.gmp-widevinecdm.version" = "system-installed"; - "media.gmp-widevinecdm.visible" = true; - "media.gmp-widevinecdm.enabled" = true; - "media.gmp-widevinecdm.autoupdate" = false; + # ---- POLICIES ---- + # Check about:policies#documentation for options. + policies = { + DisableTelemetry = true; + DisableFirefoxStudies = true; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + DisablePocket = true; + DisableFirefoxAccounts = true; + DisableAccounts = true; + DisableFirefoxScreenshots = true; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + DontCheckDefaultBrowser = true; + DisplayBookmarksToolbar = "newtab"; # alternatives: "always" or "newtab" + DisplayMenuBar = "always"; # alternatives: "always", "never" or "default-on" + SearchBar = "unified"; # alternative: "separate" - "media.eme.enabled" = true; - "media.eme.encrypted-media-encryption-scheme.enabled" = true; - }; - policies = { - DisableTelemetry = true; - DisableFirefoxStudies = true; - EnableTrackingProtection = { - Value = true; - Locked = true; - Cryptomining = true; - Fingerprinting = true; - }; - DisablePocket = true; - DisableFirefoxAccounts = true; - DisableAccounts = true; - DisableFirefoxScreenshots = true; - OverrideFirstRunPage = ""; - OverridePostUpdatePage = ""; - DontCheckDefaultBrowser = true; - DisplayBookmarksToolbar = "newtab"; # alternatives: "always" or "newtab" - DisplayMenuBar = "always"; # alternatives: "always", "never" or "default-on" - SearchBar = "unified"; # alternative: "separate" - - # ---- EXTENSIONS ---- - # Check about:support for extension/add-on ID strings. - # Valid strings for installation_mode are "allowed", "blocked", - # "force_installed" and "normal_installed". - ExtensionSettings = { - # blocks all addons except the ones specified below - "*".installation_mode = "blocked"; - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "force_installed"; - }; - "plasma-browser-integration@kde.org" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/plasma-integration/latest.xpi"; - installation_mode = "force_installed"; - }; - "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/styl-us/latest.xpi"; - installation_mode = "force_installed"; - }; - "{aecec67f-0d10-4fa7-b7c7-609a2db280cf}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/violentmonkey/latest.xpi"; - installation_mode = "force_installed"; - }; - "gdpr@cavi.au.dk" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/consent-o-matic/latest.xpi"; - installation_mode = "force_installed"; - }; - "dont-track-me-google@robwu.nl" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/dont-track-me-google1/latest.xpi"; - installation_mode = "force_installed"; - }; - "jid1-MnnxcxisBPnSXQ@jetpack" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi"; - installation_mode = "force_installed"; - }; - "FirefoxColor@mozilla.com" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/firefox-color/latest.xpi"; - installation_mode = "force_installed"; - }; - "sponsorBlocker@ajay.app" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; - installation_mode = "force_installed"; - }; - # "" = { - # install_url = "https://addons.mozilla.org/firefox/downloads/latest/_/latest.xpi"; - # installation_mode = "force_installed"; + # ---- EXTENSIONS ---- + # Check about:support for extension/add-on ID strings. + # Valid strings for installation_mode are "allowed", "blocked", + # "force_installed" and "normal_installed". + # ExtensionSettings = { + # # blocks all addons except the ones specified below + # "*".installation_mode = "blocked"; # }; + + # ---- PREFERENCES ---- + # Check about:config for options. + Preferences = { + "browser.contentblocking.category" = { + Value = "strict"; + Status = "locked"; + }; + "widget.use-xdg-desktop-portal.file-picker" = 1; + "widget.gtk.global-menu.enabled" = lock-true; + "widget.gtk.global-menu.wayland.enabled" = lock-true; + "browser.tabs.inTitlebar" = 0; + "extensions.pocket.enabled" = lock-false; + "extensions.screenshots.disabled" = lock-true; + "browser.topsites.contile.enabled" = lock-false; + "browser.formfill.enable" = lock-false; + "browser.search.suggest.enabled" = lock-false; + "browser.search.suggest.enabled.private" = lock-false; + "browser.urlbar.suggest.searches" = lock-false; + "browser.urlbar.showSearchSuggestionsFirst" = lock-false; + "browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false; + "browser.newtabpage.activity-stream.feeds.snippets" = lock-false; + "browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false; + "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = lock-false; + "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = lock-false; + "browser.newtabpage.activity-stream.section.highlights.includeVisited" = lock-false; + "browser.newtabpage.activity-stream.showSponsored" = lock-false; + "browser.newtabpage.activity-stream.system.showSponsored" = lock-false; + "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false; + + "media.gmp-widevinecdm.version" = "system-installed"; + "media.gmp-widevinecdm.visible" = lock-true; + "media.gmp-widevinecdm.enabled" = lock-true; + "media.gmp-widevinecdm.autoupdate" = lock-false; + + "media.eme.enabled" = lock-true; + "media.eme.encrypted-media-encryption-scheme.enabled" = lock-true; + }; }; }; };