aboutsummaryrefslogtreecommitdiffstats
path: root/modules/by-name
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/by-name/fi/firefox/extensions.json (renamed from modules/home.legacy/conf/firefox/config/extensions/extensions.json)6
-rw-r--r--modules/by-name/fi/firefox/module.nix234
-rw-r--r--modules/by-name/fi/firefox/profile.nix177
-rw-r--r--modules/by-name/fi/firefox/search_engines/default.nix (renamed from modules/home.legacy/conf/firefox/config/search/engines/default.nix)42
-rw-r--r--modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg (renamed from modules/home.legacy/conf/firefox/config/search/engines/logos/arch_linux.svg)0
-rw-r--r--modules/by-name/fi/firefox/search_engines/logos/brave.svg (renamed from modules/home.legacy/conf/firefox/config/search/engines/logos/brave.svg)0
-rw-r--r--modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico (renamed from modules/home.legacy/conf/firefox/config/search/engines/logos/google_scholar.ico)bin3871 -> 3871 bytes
-rw-r--r--modules/by-name/fi/firefox/search_engines/logos/rust_std.svg (renamed from modules/home.legacy/conf/firefox/config/search/engines/logos/rust_std.svg)0
-rw-r--r--modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png (renamed from modules/home.legacy/conf/firefox/config/search/engines/logos/rust_tokio.png)bin3551 -> 3551 bytes
-rw-r--r--modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg (renamed from modules/home.legacy/conf/firefox/config/search/engines/logos/wikipedia.svg)0
-rwxr-xr-xmodules/by-name/fi/firefox/update_extensions.sh12
-rw-r--r--modules/by-name/fi/firefox/userChrome.css (renamed from modules/home.legacy/conf/firefox/config/chrome/userChrome.css)0
-rw-r--r--modules/by-name/ho/home-manager/module.nix2
13 files changed, 456 insertions, 17 deletions
diff --git a/modules/home.legacy/conf/firefox/config/extensions/extensions.json b/modules/by-name/fi/firefox/extensions.json
index 298c570d..062f1a5e 100644
--- a/modules/home.legacy/conf/firefox/config/extensions/extensions.json
+++ b/modules/by-name/fi/firefox/extensions.json
@@ -19,9 +19,9 @@
"addonId": "{b11bea1f-a888-4332-8d8a-cec2be7d24b9}",
"default_area": "navbar",
"pname": "torproject-snowflake",
- "sha256": "sha256:4028bad3bef6610a985edda954d5c4f1487480a8f32f230d9edf88d97c8dd88e",
- "url": "https://addons.mozilla.org/firefox/downloads/file/4379590/torproject_snowflake-0.9.2.xpi",
- "version": "0.9.2"
+ "sha256": "sha256:615c0d570f41e721a91fc4f334377a61732171b65eb1a4429d78681e85bc8878",
+ "url": "https://addons.mozilla.org/firefox/downloads/file/4458115/torproject_snowflake-0.9.3.xpi",
+ "version": "0.9.3"
},
"tridactyl-vim": {
"addonId": "tridactyl.vim@cmcaine.co.uk",
diff --git a/modules/by-name/fi/firefox/module.nix b/modules/by-name/fi/firefox/module.nix
new file mode 100644
index 00000000..feeb8198
--- /dev/null
+++ b/modules/by-name/fi/firefox/module.nix
@@ -0,0 +1,234 @@
+{
+ lib,
+ config,
+ pkgs,
+ ...
+}: let
+ cfg = config.soispha.programs.firefox;
+
+ mkAllowedExtension = extension:
+ lib.attrsets.nameValuePair extension.addonId {
+ installation_mode = "normal_installed";
+ updates_disabled = true;
+ inherit (extension) default_area;
+ install_url = "file://${builtins.fetchurl {
+ inherit
+ (extension)
+ url
+ sha256
+ ;
+ }}";
+ };
+
+ allowedExtensions =
+ builtins.listToAttrs
+ (builtins.map mkAllowedExtension (builtins.attrValues
+ cfg.extensions));
+
+ mkBlockedExtension = id:
+ lib.attrsets.nameValuePair id {
+ install_mode = "blocked";
+ };
+ blockedExtensions = builtins.listToAttrs (builtins.map mkBlockedExtension [
+ # these are the default search engines
+ "addons-search-detection@mozilla.com"
+ "amazon@search.mozilla.org"
+ "bing@search.mozilla.org"
+ "ddg@search.mozilla.org"
+ "google@search.mozilla.org"
+ "wikipedia@search.mozilla.org"
+ ]);
+
+ mkProfile = import ./profile.nix {inherit config pkgs;};
+in {
+ options.soispha.programs.firefox = {
+ enable = lib.mkEnableOption "firefox";
+
+ profiles = lib.mkOption {
+ type = lib.types.attrsOf (lib.types.submodule {
+ options = {
+ id = lib.mkOption {
+ type = lib.types.int;
+ description = "The id of this profile.";
+ };
+ name = lib.mkOption {
+ type = lib.types.str;
+ description = "The name of this profile";
+ };
+ };
+ });
+ description = "A list of profies to create besides the default `default` profile.";
+ default = {};
+ apply = value:
+ lib.attrsets.mapAttrs' (name: value: lib.attrsets.nameValuePair name (mkProfile value))
+ value;
+ };
+
+ extensions = lib.mkOption {
+ type = lib.types.attrsOf (
+ lib.types.submodule {
+ options = {
+ addonId = lib.mkOption {
+ type = lib.types.str;
+ example = "addon@darkreader.org";
+ description = "The addon id of this extension";
+ };
+ default_area = lib.mkOption {
+ type = lib.types.enum ["navbar" "menupanel"];
+ example = "navbar";
+ description = ''
+ Where to put this extension by default.
+ `navbar` means into the top-left bar as icon.
+ `menupanel` means hidden behind a “all extensions” button.
+ '';
+ };
+ pname = lib.mkOption {
+ type = lib.types.str;
+ example = "darkreader";
+ description = "The package name of this extension";
+ };
+ sha256 = lib.mkOption {
+ type = lib.types.str;
+ example = "sha256:f565b2263a71626a0310380915b7aef90be8cc6fe16ea43ac1a0846efedc2e4c";
+ description = "The fetchurl copatible hash of this extension";
+ };
+ url = lib.mkOption {
+ type = lib.types.str;
+ example = "https://addons.mozilla.org/firefox/downloads/file/4439735/darkreader-4.9.103.xpi";
+ description = "The download url of this extension.";
+ };
+ version = lib.mkOption {
+ type = lib.types.str;
+ example = "4.9.103";
+ description = "The version of this extension";
+ };
+ };
+ }
+ );
+
+ default = builtins.fromJSON (builtins.readFile ./extensions.json);
+
+ description = ''
+ A list of the extensions that should be installed.
+ You can use a tool like `generate_extensions` to generate this config.
+ '';
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ programs.firefox = {
+ enable = true;
+ preferencesStatus = "locked";
+
+ languagePacks = ["de" "sv-SE" "en-CA"];
+
+ nativeMessagingHosts.packages = [
+ pkgs.tridactyl-native
+ pkgs.keepassxc
+ ];
+
+ # NOTE: See https://mozilla.github.io/policy-templates for documentation <2023-10-21>
+ policies = {
+ # NixOS manages this already
+ DisableAppUpdate = true;
+
+ DisableFirefoxAccounts = true;
+ DisableFirefoxScreenshots = true;
+
+ # KeepassXC does this for me
+ DisableMasterPasswordCreation = true;
+
+ # I use a self-hosted services for that
+ DisablePocket = true;
+
+ # I don't want to lose my data
+ DisableProfileRefresh = true;
+
+ DisableDeveloperTools = false;
+
+ DisplayBookmarksToolbar = "newtab";
+ DisplayMenuBar = "default-off";
+
+ DNSOverHTTPS = {
+ Enabled = true;
+ Locked = false;
+ };
+ # The concept of a "default browser" does not apply to my NixOS config
+ DontCheckDefaultBrowser = true;
+
+ ExtensionSettings =
+ {
+ "*" = {
+ # Blocking the extension install here, also blocks the 'about:debugging' page
+
+ # blocked_install_message = ''
+ # You can't install a extension manually,
+ # please specify it in your NixOS configuration
+ # '';
+ installation_mode = "allowed";
+ };
+ }
+ // allowedExtensions
+ // blockedExtensions;
+ RequestedLocales = config.programs.firefox.languagePacks;
+
+ ExtensionUpdate = false;
+
+ HardwareAcceleration = true;
+
+ # KeepassXC and such things
+ OfferToSaveLogins = false;
+ PasswordManagerEnabled = false;
+
+ PDFjs = {
+ Enabled = true;
+ # Don't honor documents right to be un-copy-able
+ EnablePermissions = false;
+ };
+
+ SearchBar = "unified";
+ };
+
+ # Beware, that we already set them per-profile in the home-manager config.
+ preferences = {};
+ };
+
+ home-manager.users.soispha = {
+ home.sessionVariables = {
+ # Improve touch input and make scrolling smother
+ MOZ_USE_XINPUT2 = "1";
+
+ # Tell Firefox to use Wayland
+ MOZ_ENABLE_WAYLAND = 1;
+
+ # Tell GTK to use portals
+ GTK_USE_PORTAL = 1;
+
+ BROWSER = "firefox";
+ };
+
+ programs.firefox = {
+ enable = true;
+ arkenfox = {
+ enable = true;
+ version = "133.0";
+ };
+
+ # We use the NixOS module to provide us a package.
+ # HACK: Extract the package from the system-path to get a version for
+ # arkenfox-nixos to compare to. <2025-04-02>
+ package = lib.lists.findSingle (x: builtins.hasAttr "pname" x && x.pname == "firefox") "none" "multiple" config.environment.systemPackages;
+
+ profiles =
+ {
+ default = mkProfile {
+ isDefault = true;
+ id = 0;
+ name = "default";
+ };
+ }
+ // cfg.profiles;
+ };
+ };
+ };
+}
diff --git a/modules/by-name/fi/firefox/profile.nix b/modules/by-name/fi/firefox/profile.nix
new file mode 100644
index 00000000..7cdf4d90
--- /dev/null
+++ b/modules/by-name/fi/firefox/profile.nix
@@ -0,0 +1,177 @@
+{config, pkgs}: preConfig: ({
+ userChrome = ./userChrome.css;
+
+ bookmarks = {
+ force = true;
+ settings = [];
+ };
+
+ search = {
+ default = "brave-search";
+ privateDefault = "brave-search";
+ force = true;
+ engines = import ./search_engines {inherit pkgs;};
+
+ order = [
+ # DEFAULT
+ "brave-search"
+
+ # NIX
+ "nix-packages"
+ "nix-options"
+ "nixpkgs-issues"
+ "homemanager-options"
+ "nixos-wiki"
+ "nixpkgs-pull-request-tracker"
+
+ # RUST
+ "rust-std"
+ "rust-tokio"
+
+ # OTHER
+ "google-scholar"
+ "wikipedia"
+ "arch-wiki"
+ ];
+ };
+
+ settings = {
+ "browser.download.dir" = "${config.home-manager.users.soispha.xdg.userDirs.download}";
+ # "browser.download.useDownloadDir" = true;
+ # "browser.download.folderList" = 2;
+
+ # QoL
+ "general.autoScroll" = false;
+ "browser.tabs.insertAfterCurrent" = true;
+ "browser.tabs.loadInBackground" = true;
+ "browser.ctrlTab.recentlyUsedOrder" = false;
+ "browser.search.widget.inNavBar" = true;
+ "findbar.highlightAll" = true;
+
+ "devtools.toolbox.host" = "right";
+ "devtools.toolsidebar-width.inspector" = 700;
+
+ # Keep translations useful
+ "browser.translations.automaticallyPopup" = true;
+ "browser.translations.neverTranslateLanguages" = "de";
+
+ # Improve Tab UI
+ "browser.tabs.inTitlebar" = 1;
+ "browser.toolbars.bookmarks.visibility" = "never";
+ "browser.places.importBookmarksHTML" = true;
+
+ # Theme
+ "extensions.activeThemeID" = "firefox-alpenglow@mozilla.org";
+ "extensions.extensions.activeThemeID" = "firefox-alpenglow@mozilla.org";
+
+ # disable updates (pretty pointless with nix)
+ "extensions.update.autoUpdateDefault" = false;
+ "extensions.update.enabled" = false;
+ "app.update.channel" = "default";
+ "browser.shell.checkDefaultBrowser" = false;
+
+ # Allow my custom css
+ "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
+ };
+
+ arkenfox = {
+ enable = true;
+ "0000".enable = true;
+ "0100" = {
+ enable = true;
+ "0102"."browser.startup.page".value = 3;
+ "0103"."browser.startup.homepage".value = "file:///home/dt/home.html";
+ "0104"."browser.newtabpage.enabled".value = true;
+ };
+ "0200" = {
+ enable = true;
+ };
+ "0300" = {
+ enable = true;
+ };
+ "0400" = {
+ enable = false;
+ };
+ "0600" = {
+ enable = true;
+ };
+ "0700" = {
+ enable = true;
+ "0710"."network.trr.mode" = {
+ enable = true;
+ value = 3;
+ };
+ };
+ "0800" = {
+ enable = true;
+ };
+ "0900" = {
+ enable = true;
+ };
+ "1000" = {
+ enable = true;
+ "1001"."browser.cache.disk.enable".value = true;
+ "1003"."browser.sessionstore.privacy_level".value = 0;
+ };
+ "1200" = {
+ enable = true;
+ "1241"."security.mixed_content.block_display_content".enable = true;
+ };
+ "1600" = {
+ enable = true;
+ };
+ "1700" = {
+ enable = true;
+ };
+ "2000" = {
+ enable = true;
+ };
+ "2400" = {
+ enable = true;
+ };
+ "2600" = {
+ enable = true;
+ "2603" = {
+ "browser.download.start_downloads_in_tmp_dir".value = false;
+ "browser.helperApps.deleteTempFileOnExit".value = false;
+ };
+ "2615"."permissions.default.shortcuts" = {
+ value = 2;
+ enable = true;
+ };
+ };
+ "2700" = {
+ enable = true;
+ };
+ "2800" = {
+ enable = false;
+ "2810"."privacy.sanitize.sanitizeOnShutdown".value = false;
+ };
+ "4000" = {
+ enable = true;
+ };
+ "4500" = {
+ enable = true;
+ };
+ "5000" = {
+ enable = true;
+ "5003"."signon.rememberSignons" = {
+ enable = true;
+ value = false;
+ };
+ };
+ "6000" = {
+ enable = true;
+ };
+ "7000" = {
+ enable = true;
+ };
+ "8000" = {
+ enable = true;
+ };
+ "9000" = {
+ enable = true;
+ };
+ };
+ }
+ // preConfig)
diff --git a/modules/home.legacy/conf/firefox/config/search/engines/default.nix b/modules/by-name/fi/firefox/search_engines/default.nix
index 1c2045eb..d05a5af8 100644
--- a/modules/home.legacy/conf/firefox/config/search/engines/default.nix
+++ b/modules/by-name/fi/firefox/search_engines/default.nix
@@ -1,81 +1,95 @@
{pkgs, ...}: {
# DEFAULT
- "Brave Search" = {
+ brave-search= {
+ name = "Brave Search";
urls = [{template = "https://search.brave.com/search?q={searchTerms}";}];
icon = ./logos/brave.svg;
definedAliases = ["@bs"];
};
# NIX
- "Nix Packages" = {
+ nix-packages= {
+ name = "Nix packages";
urls = [{template = "https://search.nixos.org/packages?type=packages&query={searchTerms}";}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@np"];
};
- "Nix functions" = {
+ nix-functions= {
+ name = "Nix functions";
urls = [{template = "https://noogle.dev/q?term={searchTerms}";}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@ng"];
};
- "NixOS Options" = {
+ nixos-options= {
+ name = "NixOS options";
urls = [{template = "https://search.nixos.org/options?type=options&query={searchTerms}";}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@no"];
};
- "HomeManager Options" = {
+ homemanager-options= {
+ name = "Home-Manager options";
urls = [{template = "https://home-manager-options.extranix.com/?query={searchTerms}&release=master";}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@nh"];
};
- "Nixpkgs issues" = {
+ nixpkgs-issues= {
+ name = "Nixpkgs issues";
urls = [{template = "https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+{searchTerms}";}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@ni"];
};
- "Nixpkgs pull requests" = {
+ nixpkgs-pull-requests= {
+ name = "Nixpkgs pull requests";
urls = [{template = "https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+{searchTerms}";}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@nr"];
};
- "Nixpkgs pull requests tracker" = {
+ nixpkgs-pull-requests-tracker= {
+ name = "Nixpkgs pull requests tracker";
urls = [{template = "https://nixpk.gs/pr-tracker.html?pr={searchTerms}";}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@nt"];
};
- "NixOS Wiki" = {
+ nixos-wiki= {
+ name = "NixOS Wiki";
urls = [{template = "https://wiki.nixos.org/w/index.php?search={searchTerms}";}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@nw"];
};
# RUST
- "Rust std" = {
+ rust-std= {
+ name = "Rust std";
urls = [{template = "https://doc.rust-lang.org/std/?search={searchTerms}";}];
icon = ./logos/rust_std.svg;
definedAliases = ["@rs"];
};
- "Rust tokio" = {
+ rust-tokio= {
+ name = "Rust tokio";
urls = [{template = "https://docs.rs/tokio/latest/tokio/index.html?search={searchTerms}";}];
icon = ./logos/rust_tokio.png;
definedAliases = ["@rt"];
};
# OTHER
- "Google Scholar" = {
+ google-scholar= {
+ name = "Google Scholar";
urls = [{template = "https://scholar.google.com/scholar?hl=en&q={searchTerms}";}];
icon = ./logos/google_scholar.ico;
definedAliases = ["@gs"];
};
- "Wikipedia" = {
+ wikipedia= {
+ name = "Wikipedia";
urls = [{template = "https://en.wikipedia.org/wiki/{searchTerms}";}];
icon = ./logos/wikipedia.svg;
definedAliases = ["@wp"];
};
- "Arch Wiki" = {
+ arch-wiki= {
+ name = "Arch Wiki";
urls = [{template = "https://wiki.archlinux.org/index.php?search={searchTerms}";}];
icon = ./logos/arch_linux.svg;
definedAliases = ["@aw"];
diff --git a/modules/home.legacy/conf/firefox/config/search/engines/logos/arch_linux.svg b/modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg
index 949b5c5f..949b5c5f 100644
--- a/modules/home.legacy/conf/firefox/config/search/engines/logos/arch_linux.svg
+++ b/modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg
diff --git a/modules/home.legacy/conf/firefox/config/search/engines/logos/brave.svg b/modules/by-name/fi/firefox/search_engines/logos/brave.svg
index 09dd2e42..09dd2e42 100644
--- a/modules/home.legacy/conf/firefox/config/search/engines/logos/brave.svg
+++ b/modules/by-name/fi/firefox/search_engines/logos/brave.svg
diff --git a/modules/home.legacy/conf/firefox/config/search/engines/logos/google_scholar.ico b/modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico
index 85d0c664..85d0c664 100644
--- a/modules/home.legacy/conf/firefox/config/search/engines/logos/google_scholar.ico
+++ b/modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico
Binary files differ
diff --git a/modules/home.legacy/conf/firefox/config/search/engines/logos/rust_std.svg b/modules/by-name/fi/firefox/search_engines/logos/rust_std.svg
index 0091b5a8..0091b5a8 100644
--- a/modules/home.legacy/conf/firefox/config/search/engines/logos/rust_std.svg
+++ b/modules/by-name/fi/firefox/search_engines/logos/rust_std.svg
diff --git a/modules/home.legacy/conf/firefox/config/search/engines/logos/rust_tokio.png b/modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png
index f1de55ff..f1de55ff 100644
--- a/modules/home.legacy/conf/firefox/config/search/engines/logos/rust_tokio.png
+++ b/modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png
Binary files differ
diff --git a/modules/home.legacy/conf/firefox/config/search/engines/logos/wikipedia.svg b/modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg
index dc32f984..dc32f984 100644
--- a/modules/home.legacy/conf/firefox/config/search/engines/logos/wikipedia.svg
+++ b/modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg
diff --git a/modules/by-name/fi/firefox/update_extensions.sh b/modules/by-name/fi/firefox/update_extensions.sh
new file mode 100755
index 00000000..efcc83c6
--- /dev/null
+++ b/modules/by-name/fi/firefox/update_extensions.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env sh
+
+# The `generate_extensions` binary is provided in the devshell.
+
+generate_extensions \
+ darkreader:navbar \
+ keepassxc-browser:navbar \
+ vhack-libredirect:navbar \
+ torproject-snowflake:navbar \
+ tridactyl-vim:menupanel \
+ ublock-origin:menupanel \
+ >"$(dirname "$0")"/extensions.json
diff --git a/modules/home.legacy/conf/firefox/config/chrome/userChrome.css b/modules/by-name/fi/firefox/userChrome.css
index 0b3aff77..0b3aff77 100644
--- a/modules/home.legacy/conf/firefox/config/chrome/userChrome.css
+++ b/modules/by-name/fi/firefox/userChrome.css
diff --git a/modules/by-name/ho/home-manager/module.nix b/modules/by-name/ho/home-manager/module.nix
index ea0ce409..5da40834 100644
--- a/modules/by-name/ho/home-manager/module.nix
+++ b/modules/by-name/ho/home-manager/module.nix
@@ -16,6 +16,7 @@
impermanence,
nix-index-database,
nixVim,
+ arkenfox-nixos,
...
}: let
cfg = config.soispha.home-manager;
@@ -49,6 +50,7 @@ in {
impermanence
nixVim
nix-index-database
+ arkenfox-nixos
;
};
};