diff --git a/home/default.nix b/home/default.nix index a17ca26..d1abc63 100644 --- a/home/default.nix +++ b/home/default.nix @@ -9,6 +9,7 @@ ../programs/sway/default.nix ../programs/shell/default.nix ../programs/emacs/default.nix + ../programs/firefox/default.nix ../programs/prog/default.nix ../programs/cava/default.nix ../programs/obs/default.nix diff --git a/programs/firefox/bookmarks/bookmarks.json b/programs/firefox/bookmarks/bookmarks.json new file mode 100644 index 0000000..f9f2859 --- /dev/null +++ b/programs/firefox/bookmarks/bookmarks.json @@ -0,0 +1,155 @@ +[ + { + "name": "Messaging", + "bookmarks": [ + { "name": "WhatApp Web", "url": "https://web.whatsapp.com/" }, + { "name": "Discord", "url": "https://discord.com/app" }, + { + "name": "Teams", + "url": "https://teams.microsoft.com/v2", + "tags": ["work"] + } + ] + }, + { + "name": "Development", + "bookmarks": [ + { + "name": "Forgejo", + "url": "https://git.xenia.me.uk", + "tags": ["server", "git"] + }, + { "name": "GitHub", "url": "https://github.com", "tags": ["git"] }, + { + "name": "CCFE GitLab", + "url": "https://git.ccfe.ac.uk", + "tags": ["work", "git"] + } + ] + }, + { + "name": "Documentation", + "bookmarks": [ + { + "name": "Nix", + "toolbar": true, + "bookmarks": [ + { + "name": "NixOS and Flakes", + "url": "https://nixos-and-flakes.thiscute.world/" + }, + { + "name": "Home Manager", + "url": "https://nix-community.github.io/home-manager/options.xhtml" + } + ] + }, + { + "name": "Awesome", + "toolbar": true, + "bookmarks": [ + { + "name": "Awesome Emacs", + "url": "https://github.com/emacs-tw/awesome-emacs" + } + ] + }, + { + "name": "OpenWiki", + "toolbar": true, + "bookmarks": [ + { + "name": "Homepage", + "url": "https://wiki.jetdata.eu/open/index.php?title=Main_Page" + }, + { + "name": "Diagnostic Coordinator", + "url": "https://wiki.jetdata.eu/open/index.php?title=Diagnostic_Coordinator_Wiki" + }, + { + "name": "Spectroscopy Group", + "url": "https://wiki.jetdata.eu/open/index.php?title=Spectroscopy_Group:index" + }, + { + "name": "KS5", + "url": "https://wiki.jetdata.eu/open/index.php?title=CXS:Topic3" + }, + { + "name": "KT3", + "url": "https://wiki.jetdata.eu/open/index.php?title=KT3_Journals" + } + ] + } + ] + }, + { + "name": "Travel", + "bookmarks": [{ "name": "ABRP", "url": "https://abetterrouteplanner.com/" }] + }, + { + "name": "Work", + "bookmarks": [ + { + "name": "JET", + "toolbar": true, + "bookmarks": [ + { "name": "Homepage", "url": "http://w3.jet.uk" }, + { + "name": "Physics Summary", + "url": "https://users.euro-fusion.org/pages/physics-summary/LatestSession.php" + }, + { + "name": "JSPO Reports", + "url": "https://www.jspo.jet.uk/pages/operations/jpecreports_2023.html" + }, + { "name": "DVCM Homepage", "url": "https://dvcm.jetdata.eu/" }, + { + "name": "JET Data Services", + "url": "https://data.jet.uk", + "tags": ["data"] + }, + { + "name": "PPF Query", + "url": "https://data.jet.uk/ppf/browse/ppfquery", + "tags": ["data"] + }, + { + "name": "ReqCo", + "url": "https://data.jet.uk/reqco/myrequests", + "tags": ["data"] + } + ] + }, + { + "name": "MAST-U", + "toolbar": true, + "bookmarks": [ + { "name": "Users Page", "url": "https://users.mastu.ukaea.uk/home" }, + { + "name": "Diagnostic Handbook", + "url": "https://intranet.ccfe.ac.uk/mastu-handbook" + } + ] + }, + { + "name": "Office", + "toolbar": true, + "bookmarks": [ + { + "name": "Outlook Calendar", + "url": "https://outlook.office.com/calendar/view/workweek" + }, + { + "name": "OneDrive", + "url": "https://ukaeauk-my.sharepoint.com/personal/evie_litherland-smith_ukaea_uk/" + }, + { "name": "Sharepoint", "url": "https://ukaeauk.sharepoint.com/" } + ] + } + ] + }, + { + "name": "Miscellaneous", + "bookmarks": [] + } +] diff --git a/programs/firefox/bookmarks/default.nix b/programs/firefox/bookmarks/default.nix new file mode 100644 index 0000000..c49630b --- /dev/null +++ b/programs/firefox/bookmarks/default.nix @@ -0,0 +1,27 @@ +lib: let + withTag = { + bookmarks, + tags, + }: ( + map (x: + if (builtins.hasAttr "bookmarks" x) + then { + inherit (x) name; + toolbar = true; + bookmarks = withTag { + inherit (x) bookmarks; + tags = [(builtins.toString x.name)] ++ tags; + }; + } + else { + inherit (x) name url; + tags = (x.tags or []) ++ tags; + }) + bookmarks + ); +in ( + withTag { + bookmarks = builtins.fromJSON (builtins.readFile ./bookmarks.json); + tags = []; + } +) diff --git a/programs/firefox/default.nix b/programs/firefox/default.nix new file mode 100644 index 0000000..e52ccd5 --- /dev/null +++ b/programs/firefox/default.nix @@ -0,0 +1,146 @@ +{ + config, + lib, + pkgs, + ... +}: { + programs.firefox = { + enable = true; + policies = { + BlockAboutProfiles = true; + Cookies = { + Behavior = "reject-tracker-and-partition-foreign"; + BehaviorPrivateBrowsing = "reject"; + Locked = true; + }; + DefaultDownloadDirectory = "\${home}/Downloads"; + DisableAppUpdate = true; + DisableFirefoxAccounts = true; + DisableFirefoxScreenshots = true; + DisableFirefoxStudies = true; + DisableFormHistory = true; + DisablePocket = true; + DisableProfileImport = true; + DisableSetDesktopBackground = true; + DisableSystemAddonUpdate = true; + DisableTelemetry = true; + DisplayBookmarksToolbar = "never"; + DisplayMenuBar = "default-off"; + DontCheckDefaultBrowser = true; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + ExtensionSettings = { + "queryamoid@kaply.com" = { + installation_mode = "force_installed"; + install_url = "https://github.com/mkaply/queryamoid/releases/download/v0.1/query_amo_addon_id-0.1-fx.xpi"; + }; + "uBlock0@raymondhill.net" = { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + }; + "addon@simplelogin" = { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/simplelogin/latest.xpi"; + }; + "{8446b178-c865-4f5c-8ccc-1d7887811ae3}" = { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/catppuccin-mocha-lavender-git/latest.xpi"; + }; + }; + FirefoxHome = { + Search = true; + TopSites = false; + SponsoredTopSites = false; + Highlights = false; + Pocket = false; + SponsoredPocket = false; + Snippets = false; + Locked = true; + }; + FirefoxSuggest = { + WebSuggestions = false; + SponsoredSuggestions = false; + ImproveSuggest = false; + Locked = true; + }; + HardwareAcceleration = true; + Homepage = { + Locked = true; + StartPage = "homepage-locked"; + }; + NewTabPage = true; + NoDefaultBookmarks = true; + OfferToSaveLogins = false; + PasswordManagerEnabled = false; + PDFjs = {Enabled = false;}; + Permissions = { + Autoplay = { + Default = "block-audio-video"; + }; + }; + PictureInPicture = {Enabled = true;}; + PopupBlocking = {Default = true;}; + RequestedLocales = ["en-GB"]; + SearchBar = "unified"; + ShowHomeButton = true; + StartDownloadsInTempDirectory = true; + }; + profiles.default = { + settings = { + "app.shield.optoutstudies.enabled" = false; + "browser.bookmarks.addedImportButton" = false; + "browser.bookmarks.showMobileBookmarks" = false; + "browser.toolbars.bookmarks.visibility" = "newtab"; + "browser.contentblocking.category" = "strict"; + "browser.search.region" = "GB"; + "browser.search.isUS" = false; + "browser.warnOnQuitShortcut" = false; + "distribution.searchplugins.defaultLocale" = "en-GB"; + "doh-rollout.home-region" = "GB"; + "extensions.activeThemeID" = "{c6698fd1-fe9b-4eae-95d5-fe1703820469}"; + "extensions.formautofill.creditCards.enabled" = false; + "general.useragent.locale" = "en-GB"; + "intl.accept_languages" = "en-gb,en"; + "intl.locale.requested" = "en-gb,en"; + "intl.regional_prefs.use_os_locales" = false; + "media.eme.enabled" = true; + "privacy.webrtc.legacyGlobalIndicator" = false; + "signon.management.page.breach-alerts.enabled" = false; + "signon.rememberSignons" = false; + "browser.newtabpage.pinned" = [ + { + title = "NixOS Wiki"; + url = "https://nixos.wiki"; + } + { + title = "Arch Wiki"; + url = "https://wiki.archlinux.org"; + } + ]; + }; + containers = { + personal = { + color = "purple"; + icon = "fingerprint"; + id = 0; + }; + work = { + color = "blue"; + icon = "briefcase"; + id = 1; + }; + }; + search = { + default = "DuckDuckGo"; + force = true; + order = ["DuckDuckGo"]; + engines = import ./search-engines.nix pkgs; + }; + bookmarks = import ./bookmarks/default.nix lib; + }; + }; +} diff --git a/programs/firefox/search-engines.nix b/programs/firefox/search-engines.nix new file mode 100644 index 0000000..1b6b73d --- /dev/null +++ b/programs/firefox/search-engines.nix @@ -0,0 +1,43 @@ +pkgs: { + "OpenStreetMap" = { + urls = [{template = "https://www.openstreetmap.org/search?query={searchTerms}";}]; + definedAliases = ["@om"]; + }; + "NixOS Packages" = { + urls = [{template = "http://search.nixos.org/packages?channel=unstable&size=50&sort=relevance&type=packages&query={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@np"]; + }; + "NixOS Options" = { + urls = [{template = "http://search.nixos.org/options?channel=unstable&size=50&sort=relevance&type=packages&query={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@np"]; + }; + "Home Manager Options" = { + urls = [{template = "https://mipmip.github.io/home-manager-option-search/?query={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@hm"]; + }; + "PyPI packages" = { + urls = [{template = "https://pypi.org/search/?q={searchTerms}";}]; + definedAliases = ["@py"]; + }; + "NixOS Wiki" = { + urls = [{template = "https://nixos.wiki/index.php?search={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@nw"]; + }; + "Arch Wiki" = { + urls = [{template = "https://wiki.archlinux.org/index.php?search={searchTerms}";}]; + definedAliases = ["@aw"]; + }; + "GitHub" = { + urls = [{template = "https://github.com/search?q={searchTerms}";}]; + definedAliases = ["@gh"]; + }; + "MyNixOS" = { + urls = [{template = "https://mynixos.com/search?q={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@mn"]; + }; +}