aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-04-02 18:13:25 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-04-02 18:15:48 +0200
commit4d04e90f0941350957afe7ffe17e99fe27eca2b9 (patch)
tree93291063f47d4d7f69c7955903141bdacc4b5373
parentrefactor(treewide): Remove `river_init_lesser` (diff)
downloadnixos-config-4d04e90f0941350957afe7ffe17e99fe27eca2b9.zip
refactor(modules/legacy/firefox): Move to by-name
This also improves the arkanfox-integration and the profile id generation.
-rw-r--r--flake.lock46
-rw-r--r--flake.nix16
-rw-r--r--flake/default.nix5
-rw-r--r--flake/nixosConfigurations/default.nix6
-rw-r--r--flake/packages/default.nix3
-rw-r--r--lib/default.nix30
-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
-rw-r--r--modules/common/default.nix1
-rw-r--r--modules/home.legacy/conf/default.nix1
-rw-r--r--modules/home.legacy/conf/firefox/config/bookmarks/default.nix11
-rw-r--r--modules/home.legacy/conf/firefox/config/bookmarks/lib.nix49
-rw-r--r--modules/home.legacy/conf/firefox/config/extensions/native_messaging_hosts/default.nix15
-rw-r--r--modules/home.legacy/conf/firefox/config/policies/default.nix146
-rw-r--r--modules/home.legacy/conf/firefox/config/prefs/default.nix21
-rw-r--r--modules/home.legacy/conf/firefox/config/prefs/override.js202
-rw-r--r--modules/home.legacy/conf/firefox/default.nix133
-rw-r--r--modules/home.legacy/conf/firefox/package.nix30
-rw-r--r--modules/home.legacy/conf/firefox/scripts/default.nix29
-rwxr-xr-xmodules/home.legacy/conf/firefox/scripts/extract_cookies.sh77
-rwxr-xr-xmodules/home.legacy/conf/firefox/scripts/unzip_mozlz4.py45
-rwxr-xr-xmodules/home.legacy/conf/firefox/scripts/update_extensions.sh18
-rw-r--r--modules/home.legacy/conf/taskwarrior/firefox/default.nix32
-rw-r--r--modules/home.legacy/default.nix2
-rwxr-xr-xupdate.sh2
36 files changed, 531 insertions, 862 deletions
diff --git a/flake.lock b/flake.lock
index 3a177791..ac446ada 100644
--- a/flake.lock
+++ b/flake.lock
@@ -29,6 +29,32 @@
"type": "github"
}
},
+ "arkenfox-nixos": {
+ "inputs": {
+ "flake-compat": [
+ "flake-compat"
+ ],
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "pre-commit": [
+ "pre-commit-hooks"
+ ]
+ },
+ "locked": {
+ "lastModified": 1739094253,
+ "narHash": "sha256-yDTgmfSuL5Ax7LRuxhdoMJrBi4X9Q3fyyI7TerTXVBA=",
+ "owner": "dwarfmaster",
+ "repo": "arkenfox-nixos",
+ "rev": "27e0c3094e778bd73f93bea799f627ef317e7f22",
+ "type": "github"
+ },
+ "original": {
+ "owner": "dwarfmaster",
+ "repo": "arkenfox-nixos",
+ "type": "github"
+ }
+ },
"beautysh": {
"inputs": {
"nixpkgs": [
@@ -690,6 +716,7 @@
"root": {
"inputs": {
"agenix": "agenix",
+ "arkenfox-nixos": "arkenfox-nixos",
"beautysh": "beautysh",
"crane": "crane",
"devshell": "devshell",
@@ -723,8 +750,7 @@
"shell_library": "shell_library",
"systems": "systems",
"templates": "templates",
- "treefmt-nix": "treefmt-nix",
- "user_js": "user_js"
+ "treefmt-nix": "treefmt-nix"
}
},
"rust-overlay": {
@@ -874,22 +900,6 @@
"repo": "treefmt-nix",
"type": "github"
}
- },
- "user_js": {
- "flake": false,
- "locked": {
- "lastModified": 1741229528,
- "narHash": "sha256-21DoV4SMueMFRHMsvfsPfQIOtsvRWNY06rE4gB7xFnc=",
- "owner": "arkenfox",
- "repo": "user.js",
- "rev": "3d76c74c80485931425464fec0e59d6cb461677a",
- "type": "github"
- },
- "original": {
- "owner": "arkenfox",
- "repo": "user.js",
- "type": "github"
- }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index f8d6020d..8d8ce03a 100644
--- a/flake.nix
+++ b/flake.nix
@@ -203,6 +203,14 @@
nixpkgs.follows = "nixpkgs";
};
};
+ arkenfox-nixos = {
+ url = "github:dwarfmaster/arkenfox-nixos";
+ inputs = {
+ nixpkgs.follows = "nixpkgs";
+ pre-commit.follows = "pre-commit-hooks";
+ flake-compat.follows = "flake-compat";
+ };
+ };
# my configs
templates = {
@@ -236,10 +244,6 @@
};
# external resources
- user_js = {
- url = "github:arkenfox/user.js";
- flake = false;
- };
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs = {
@@ -266,8 +270,8 @@
lanzaboote,
nixVim,
nix-index-database,
+ arkenfox-nixos,
# external dependencies
- user_js,
treefmt-nix,
templates,
# my binaries
@@ -319,9 +323,9 @@
disko
lanzaboote
nix-index-database
+ arkenfox-nixos
# external dependencies
treefmt-nix
- user_js
templates
# my binaries
shell_library
diff --git a/flake/default.nix b/flake/default.nix
index 05433865..54db815f 100644
--- a/flake/default.nix
+++ b/flake/default.nix
@@ -21,8 +21,8 @@
disko,
lanzaboote,
nix-index-database,
+ arkenfox-nixos,
# external dependencies
- user_js,
treefmt-nix,
templates,
# my binaries
@@ -56,10 +56,9 @@
disko
lanzaboote
nix-index-database
+ arkenfox-nixos
# bins
qmk_firmware
- # external
- user_js
;
};
diff --git a/flake/nixosConfigurations/default.nix b/flake/nixosConfigurations/default.nix
index f2374e05..0a65018b 100644
--- a/flake/nixosConfigurations/default.nix
+++ b/flake/nixosConfigurations/default.nix
@@ -22,10 +22,9 @@
disko,
lanzaboote,
nix-index-database,
+ arkenfox-nixos,
# bins
qmk_firmware,
- # external
- user_js,
}: let
modules = [
agenix.nixosModules.default
@@ -55,6 +54,7 @@
impermanence
nix-index-database
nixVim
+ arkenfox-nixos
# nix registry
nixpkgs_as_input
self
@@ -63,8 +63,6 @@
# TODO: Integrate these into `pkgs/by-name` <2024-05-22>
qmk_firmware
serverphone
- # external deps
- user_js
;
};
diff --git a/flake/packages/default.nix b/flake/packages/default.nix
index 82924a25..04051853 100644
--- a/flake/packages/default.nix
+++ b/flake/packages/default.nix
@@ -67,8 +67,6 @@
value)
myPkgs
)));
-
- firefox = (import ../../modules/home.legacy/conf/firefox/scripts) {inherit pkgs sysLib;};
in
{
# install-iso = nixos-generators.nixosGenerate {
@@ -97,5 +95,4 @@ in
}
// output
// output_neovim
- // firefox
// myPkgsFlat
diff --git a/lib/default.nix b/lib/default.nix
index 80227cf4..f18e4b33 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -26,6 +26,34 @@
(lib.lists.imap0 (index: elem: elem * (pow 2 index)) binaryList);
/*
+ Converts `string` to a (probably) unique numerical id.
+
+ This is achieved by hashing the string and returning the first six hex-digits
+ converted to a base 10 number.
+
+ # Type
+
+ idFromString :: String -> Int
+
+ # Arguments
+
+ string
+ : The string to use as seed for the id generation.
+
+ # Examples
+
+ idFromString "3d-printer"
+ => 10365713
+ */
+ idFromString = string: let
+ inputSeed =
+ builtins.concatStringsSep ""
+ (lib.lists.take 6
+ (lib.strings.stringToCharacters (builtins.hashString "sha256" string)));
+ in
+ lib.trivial.fromHexString inputSeed;
+
+ /*
source: https://github.com/NixOS/nix/issues/10387#issuecomment-2494597690
Raises the `base` to the power of `power`.
@@ -65,5 +93,5 @@
then (base * (pow base (power - 1)))
else builtins.throw "Negative powers are not supported";
in {
- inherit binaryToDecimal pow;
+ inherit binaryToDecimal idFromString pow;
}
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
;
};
};
diff --git a/modules/common/default.nix b/modules/common/default.nix
index 232c329d..01c6a41a 100644
--- a/modules/common/default.nix
+++ b/modules/common/default.nix
@@ -182,6 +182,7 @@
];
};
};
+ firefox.enable = true;
mpv.enable = true;
swaylock.enable = true;
taskwarrior.enable = true;
diff --git a/modules/home.legacy/conf/default.nix b/modules/home.legacy/conf/default.nix
index e1cab572..07de2e96 100644
--- a/modules/home.legacy/conf/default.nix
+++ b/modules/home.legacy/conf/default.nix
@@ -4,7 +4,6 @@
./beets
./btop
./dconf
- ./firefox
./gammastep
./gpg
./gtk
diff --git a/modules/home.legacy/conf/firefox/config/bookmarks/default.nix b/modules/home.legacy/conf/firefox/config/bookmarks/default.nix
deleted file mode 100644
index 41936819..00000000
--- a/modules/home.legacy/conf/firefox/config/bookmarks/default.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- lib,
- pkgs,
- ...
-}: let
- bookmarks = [];
-
- mkBookmarksFile = (import ./lib.nix) {inherit lib pkgs;};
- bookmarks_file = mkBookmarksFile bookmarks;
-in
- bookmarks_file
diff --git a/modules/home.legacy/conf/firefox/config/bookmarks/lib.nix b/modules/home.legacy/conf/firefox/config/bookmarks/lib.nix
deleted file mode 100644
index d1d89dd2..00000000
--- a/modules/home.legacy/conf/firefox/config/bookmarks/lib.nix
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- lib,
- pkgs,
-}: bookmarks: let
- indent = level:
- lib.concatStringsSep "" (map (lib.const " ") (lib.range 1 level));
-
- bookmarkToHTML = indentLevel: bookmark: ''
- ${indent indentLevel}<DT><A HREF="${
- lib.escapeXML bookmark.url
- }" ADD_DATE="0" LAST_MODIFIED="0">${lib.escapeXML bookmark.name}</A>'';
-
- directoryToHTML = indentLevel: directory: ''
- ${indent indentLevel}<DT>${
- if directory.toolbar
- then ''<H3 PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar''
- else "<H3>${lib.escapeXML directory.name}"
- }</H3>
- ${indent indentLevel}<DL><p>
- ${allItemsToHTML (indentLevel + 1) directory.bookmarks}
- ${indent indentLevel}</p></DL>'';
-
- itemToHTMLOrRecurse = indentLevel: item:
- if item ? "url"
- then bookmarkToHTML indentLevel item
- else directoryToHTML indentLevel item;
-
- allItemsToHTML = indentLevel: bookmarks:
- lib.concatStringsSep "\n"
- (map (itemToHTMLOrRecurse indentLevel) bookmarks);
-
- bookmarkEntries = allItemsToHTML 1 bookmarks;
-in
- pkgs.writeText "firefox-bookmarks.html" ''
- <!DOCTYPE NETSCAPE-Bookmark-file-1>
- <!-- This is an automatically generated file.
- It will be read and overwritten.
- DO NOT EDIT! -->
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
- <TITLE>Bookmarks</TITLE>
- <H1>Bookmarks Menu</H1>
-
- <DL><p>
- <DT><H3 ADD_DATE="0" LAST_MODIFIED="0" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3>
- <DL><p>
- ${bookmarkEntries}
- </DL><p>
- </p></DL>
- ''
diff --git a/modules/home.legacy/conf/firefox/config/extensions/native_messaging_hosts/default.nix b/modules/home.legacy/conf/firefox/config/extensions/native_messaging_hosts/default.nix
deleted file mode 100644
index 9aaa1682..00000000
--- a/modules/home.legacy/conf/firefox/config/extensions/native_messaging_hosts/default.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{pkgs, ...}:
-/*
-++ lib.optional (cfg.enableBrowserpass or false) (lib.getBin browserpass)
-++ lib.optional (cfg.enableBukubrow or false) bukubrow
-++ lib.optional (cfg.enableTridactylNative or false) tridactyl-native
-++ lib.optional (cfg.enableGnomeExtensions or false) gnome-browser-connector
-++ lib.optional (cfg.enableUgetIntegrator or false) uget-integrator
-++ lib.optional (cfg.enablePlasmaBrowserIntegration or false) plasma5Packages.plasma-browser-integration
-++ lib.optional (cfg.enableFXCastBridge or false) fx-cast-bridge
-++ lib.optional (cfg.enableKeePassXC or false) keepassxc
-*/
-with pkgs; [
- tridactyl-native
- keepassxc
-]
diff --git a/modules/home.legacy/conf/firefox/config/policies/default.nix b/modules/home.legacy/conf/firefox/config/policies/default.nix
deleted file mode 100644
index 02c740f6..00000000
--- a/modules/home.legacy/conf/firefox/config/policies/default.nix
+++ /dev/null
@@ -1,146 +0,0 @@
-{
- config,
- extensions,
- ...
-}: let
- locals = [
- "en-CA"
- "de"
- "sv-SE"
- ];
- mkAllowedExtension = extension: {
- name = extension.addonId;
- value = {
- 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
- extensions));
-
- mkBlockedExtension = id: {
- name = id;
- value = {
- 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"
- ]);
-
- language_packs = builtins.listToAttrs (builtins.map
- (
- lang: {
- name = "langpack-${lang}@firefox.mozilla.org";
- value = {
- installation_mode = "normal_installed";
- updates_disabled = true;
- install_url = "https://releases.mozilla.org/pub/firefox/releases/${config.soispha.firefox.package_version}/linux-x86_64/xpi/${lang}.xpi";
- };
- }
- )
- locals);
-in {
- # 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;
-
- EnableTrackingProtection = {
- Value = true;
- Locked = false;
- Cryptomining = true;
- Fingerprinting = true;
- EmailTracking = true;
- };
-
- EncryptedMediaExtensions = {
- # I want a _free_ config (and I can always just run another browser)
- Enabled = false;
- Locked = 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
- // language_packs;
-
- ExtensionUpdate = false;
-
- # TODO: Add handlers for the default file types <2023-10-21>
- # Handlers = {
- # };
-
- HardwareAcceleration = true;
-
- # Blocking the extension install here, also blocks the 'about:debugging' page
- # InstallAddonsPermission = {
- # Allowed = [];
- # Default = false;
- # };
-
- # 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";
- RequestedLocales = locals;
- };
-}
diff --git a/modules/home.legacy/conf/firefox/config/prefs/default.nix b/modules/home.legacy/conf/firefox/config/prefs/default.nix
deleted file mode 100644
index 80c6d274..00000000
--- a/modules/home.legacy/conf/firefox/config/prefs/default.nix
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- pkgs,
- config,
- user_js,
- bookmarks,
- ...
-}: let
- user_js_override = pkgs.writeText "user.override.js" (builtins.readFile ./override.js);
-in
- pkgs.runCommand "user.js" {} ''
- mkdir $out;
- cat "${user_js}/user.js" > $out/user.js;
- cat "${user_js_override}" >> $out/user.js;
-
- cat << EOF >> $out/user.js;
- // My bookmarks
- user_pref("browser.bookmarks.file", "${toString bookmarks}");
- user_pref("browser.startup.homepage", "file:///home/dt/home.html"); // 0103 // TODO: add this from a flake
- user_pref("browser.download.dir", "${config.xdg.userDirs.download}");
- EOF
- ''
diff --git a/modules/home.legacy/conf/firefox/config/prefs/override.js b/modules/home.legacy/conf/firefox/config/prefs/override.js
deleted file mode 100644
index cf74cf3b..00000000
--- a/modules/home.legacy/conf/firefox/config/prefs/override.js
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- 0100: STARTUP
- 0200: GEOLOCATION / LANGUAGE / LOCALE
- 0300: QUIETER FOX
- 0400: SAFE BROWSING
- 0600: BLOCK IMPLICIT OUTBOUND
- 0700: DNS / DoH / PROXY / SOCKS / IPv6
- 0800: LOCATION BAR / SEARCH BAR / SUGGESTIONS / HISTORY / FORMS
- 0900: PASSWORDS
- 1000: DISK AVOIDANCE
- 1200: HTTPS (SSL/TLS / OCSP / CERTS / HPKP)
- 1400: FONTS
- 1600: HEADERS / REFERERS
- 1700: CONTAINERS
- 2000: PLUGINS / MEDIA / WEBRTC
- 2400: DOM (DOCUMENT OBJECT MODEL)
- 2600: MISCELLANEOUS
- 2700: ETP (ENHANCED TRACKING PROTECTION)
- 2800: SHUTDOWN & SANITIZING
- 4500: RFP (RESIST FINGERPRINTING)
- 5000: OPTIONAL OPSEC
- 5500: OPTIONAL HARDENING
- 6000: DON'T TOUCH
- 7000: DON'T BOTHER
- 8000: DON'T BOTHER: FINGERPRINTING
- 9000: NON-PROJECT RELATED
- 9999: DEPRECATED / REMOVED / LEGACY / RENAMED
-*/
-
-
-// restore session
-user_pref("browser.startup.page", 3); // 0102
-
-user_pref("browser.newtabpage.enabled", true); // 0104
-
-// disable the geoservice, TODO: don't know if I want this
-//user_pref("geo.provider.use_geoclue", false); // 0202
-
-// TODO: is this something useful?
-user_pref("datareporting.policy.dataSubmissionEnabled", true); // 0330
-
-// enable health reports
-user_pref("datareporting.healthreport.uploadEnabled", true); // 0331
-
-// Do I want to opt-out?
-user_pref("toolkit.telemetry.coverage.opt-out", false); // 0333
-
-// enables studies
-user_pref("app.shield.optoutstudies.enabled", true); // 0340
-
-// I guess that browsing protection is useful
-user_pref("browser.safebrowsing.downloads.remote.enabled", true); // 0403
-
-// TODO: does this (-> set to false) make things slower?
-user_pref("network.prefetch-next", true); // 0601
-
-// enable ipv6 because the rest of the system uses it
-user_pref("network.dns.disableIPv6", false); // 0701
-
-// TRR only
-user_pref("network.trr.mode", 3); // 0710
-
-// I trust my search engine
-user_pref("keyword.enabled", true); // 801
-user_pref("browser.search.suggest.enabled", true); // 0804
-user_pref("browser.urlbar.suggest.searches", true); // 0804
-// TODO: no idea what this does, enabling it
-user_pref("browser.urlbar.showSearchTerms.enabled", true); // 9004
-
-// prefetch urls, if the get auto completed
-user_pref("browser.urlbar.speculativeConnect.enabled", true); // 0805
-
-// Disable autoScrolling (clicking with the mouse wheel)
-user_pref("general.autoScroll", false);
-
-// add new tabs after the current one
-user_pref("browser.tabs.insertAfterCurrent", true);
-
-// TODO: I might want to enable this
-//user_pref("browser.urlbar.suggest.quicksuggest.nonsponsored", false); // 0807
-
-// TODO: enable form and search history?
-//user_pref("browser.formfill.enable", false); // 0810
-
-// disk cache should help performance
-user_pref("browser.cache.disk.enable", true); // 1001
-
-// store extra session data (form content, cookies and POST data) 0: everywhere
-user_pref("browser.sessionstore.privacy_level", 0); // 1003
-
-// Disable unsafe passive content (images) on https sites
-user_pref("security.mixed_content.block_display_content", true); // 1241
-
-// Disable the eme banner
-user_pref("browser.eme.ui.enabled", false); // 2022
-
-// Don't delete my precious temp files
-user_pref("browser.helperApps.deleteTempFileOnExit", false); // 2603
-
-// Download to the download dir
-user_pref("browser.download.useDownloadDir", true); // 2651
-
-// Open the download panel
-user_pref("browser.download.alwaysOpenPanel", true); // 2652
-
-// Block after custom ruleset
-user_pref("browser.contentblocking.category", "custom"); // 2701
-
-// set the custom settings // 7016
-user_pref("network.cookie.cookieBehavior", 1);
-user_pref("network.http.referer.disallowCrossSiteRelaxingDefault", true);
-user_pref("network.http.referer.disallowCrossSiteRelaxingDefault.top_navigation", true);
-user_pref("privacy.partition.network_state.ocsp_cache", true);
-user_pref("privacy.query_stripping.enabled", true);
-user_pref("privacy.trackingprotection.enabled", true);
-user_pref("privacy.trackingprotection.socialtracking.enabled", true);
-user_pref("privacy.trackingprotection.cryptomining.enabled", true);
-user_pref("privacy.trackingprotection.fingerprinting.enabled", true);
-
-
-// I might want to change that, when it hinders session restore
-//user_pref("privacy.partition.always_partition_third_party_non_cookie_storage.exempt_sessionstorage", false); // 2720
-
-// I like my history very much!
-user_pref("privacy.sanitize.sanitizeOnShutdown", false); // 2810
-
-// The downsides (light theme + potential breakages):
-//user_pref("privacy.resistFingerprinting", true); // 4501
-user_pref("privacy.resistFingerprinting.letterboxing", false); // 4504
-
-// I would like to keep my gl, even in the web
-user_pref("webgl.disabled", false); // 4520
-
-// I like my service workers and am using a service using them.
-user_pref("dom.serviceWorkers.enabled", true); // 7017
-
-// I've got a password manager already
-user_pref("signon.rememberSignons", false); // 5003
-
-// Do not track header
-user_pref("privacy.donottrackheader.enabled", true); // 7015
-
-// Allow my custom css
-user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);
-
-// might improve performance TODO:
-user_pref("gfx.webrender.all", true);
-
-// disable updates (pretty pointless with nix)
-user_pref("extensions.update.autoUpdateDefault", false);
-user_pref("extensions.update.enabled", false);
-user_pref("app.update.channel", "default");
-
-user_pref("browser.ctrlTab.recentlyUsedOrder", false);
-
-user_pref("browser.download.useDownloadDir", true);
-user_pref("browser.download.folderList", 2); // TODO:
-user_pref("browser.download.viewableInternally.typeWasRegistered.svg", true);
-user_pref("browser.download.viewableInternally.typeWasRegistered.webp", true);
-user_pref("browser.download.viewableInternally.typeWasRegistered.xml", true);
-
-// TODO: what does this do?
-user_pref("browser.search.widget.inNavBar", true);
-
-user_pref("browser.shell.checkDefaultBrowser", false);
-user_pref("browser.tabs.loadInBackground", true);
-user_pref("browser.urlbar.placeholderName", "Brave");
-
-// Set the tabs and bookmarks
-user_pref("browser.tabs.inTitlebar", 1);
-user_pref("browser.toolbars.bookmarks.visibility", "never");
-user_pref("browser.places.importBookmarksHTML", true);
-
-// Theme
-user_pref("extensions.activeThemeID", "firefox-alpenglow@mozilla.org");
-user_pref("extensions.extensions.activeThemeID", "firefox-alpenglow@mozilla.org");
-
-// highlight all entries when searching
-user_pref("findbar.highlightAll", true);
-
-// Set the default position for the developer toolbox
-user_pref("devtools,toolbox.host", "right");
-user_pref("devtools,toolsidebar-width.inspector", 700);
-
-// Don't bother me with translations
-user_pref("browser.translations.automaticallyPopup", true);
-user_pref("browser.translations.neverTranslateLanguages", "de");
-
-// Put all downloads into the downloads directory
-user_pref("browser.download.start_downloads_in_tmp_dir", false);
-
-// TODO:
-//user_pref("extensions.webcompat.enable_picture_in_picture_overrides", true);
-//user_pref("extensions.webcompat.enable_shims", true);
-//user_pref("extensions.webcompat.perform_injections", true);
-//user_pref("extensions.webcompat.perform_ua_overrides", true);
-
-// onlykey / copied from a yubikey config
-//user_pref("security.webauth.u2f", true);
-//user_pref("security.webauth.webauthn", true);
-//user_pref("security.webauth.webauthn_enable_softtoken", true);
-//user_pref("security.webauth.webauthn_enable_usbtoken", true);
diff --git a/modules/home.legacy/conf/firefox/default.nix b/modules/home.legacy/conf/firefox/default.nix
index 663c4978..e69de29b 100644
--- a/modules/home.legacy/conf/firefox/default.nix
+++ b/modules/home.legacy/conf/firefox/default.nix
@@ -1,133 +0,0 @@
-{
- config,
- pkgs,
- lib,
- user_js,
- ...
-}: let
- extensions =
- builtins.fromJSON (builtins.readFile ./config/extensions/extensions.json);
-
- userChrome = builtins.readFile ./config/chrome/userChrome.css;
- bookmarks = (import ./config/bookmarks/default.nix) {
- inherit
- pkgs
- lib
- ;
- };
- engines = (import ./config/search/engines) {inherit pkgs;};
-
- native_messaging_hosts = (import ./config/extensions/native_messaging_hosts/default.nix) {inherit pkgs;};
-
- policies = (import ./config/policies) {inherit config extensions;};
-
- search = {
- default = "Brave Search";
- privateDefault = "Brave Search";
- force = true;
- 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"
- ];
-
- inherit engines;
- };
-
- prefConfig = builtins.readFile "${
- (import ./config/prefs) {inherit pkgs lib config bookmarks user_js;}
- }/user.js";
-
- # Package {{{
- package = import ./package.nix {
- inherit config lib pkgs;
- extraPolicies = policies;
- extraNativeMessagingHosts = native_messaging_hosts;
- };
- # }}}
-
- # Profiles {{{
- profiles = {
- "default" = {
- inherit search userChrome;
- isDefault = true;
- id = 0;
- name = "default";
- extraConfig = prefConfig;
- };
- };
-
- taskwarriorProfiles = import ../taskwarrior/firefox {
- inherit
- config
- lib
- # options
- prefConfig
- search
- userChrome
- ;
- profile_size = builtins.length (builtins.attrNames profiles);
- };
- # }}}
-in {
- options.soispha.firefox = {
- package = lib.mkOption {
- type = lib.types.package;
- default = pkgs.firefox;
- description = "Firefox package to use.";
- defaultText = lib.literalExpression "pkgs.firefox";
- relatedPackages = [
- "firefox"
- "firefox-beta-bin"
- "firefox-bin"
- "firefox-devedition-bin"
- "firefox-esr"
- ];
- };
- package_version = lib.mkOption {
- type = lib.types.str;
- default = pkgs.firefox.version;
- description = "Firefox version to use";
- };
- };
-
- config = {
- soispha.firefox.package = package;
- soispha.firefox.package_version = pkgs.firefox.version;
- home.sessionVariables = {
- # improve touch input & make scrolling smother
- MOZ_USE_XINPUT2 = "1";
-
- # improve wayland support
- MOZ_ENABLE_WAYLAND = 1;
-
- # tell gtk to use portals
- GTK_USE_PORTAL = 1;
-
- BROWSER = "firefox";
- };
- programs.firefox = {
- enable = true;
- inherit (config.soispha.firefox) package;
- profiles =
- profiles
- // taskwarriorProfiles;
- };
- };
-}
diff --git a/modules/home.legacy/conf/firefox/package.nix b/modules/home.legacy/conf/firefox/package.nix
deleted file mode 100644
index f7e4319b..00000000
--- a/modules/home.legacy/conf/firefox/package.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-# taken from the NixOS Firefox module: https://github.com/NixOS/nixpkgs/blob/7c9cc5a6e5d38010801741ac830a3f8fd667a7a0/nixos/modules/programs/firefox.nix
-{
- config,
- lib,
- pkgs,
- # options
- autoConfig ? "",
- extraNativeMessagingHosts ? [],
- wrapperConfig ? {},
- extraPolicies ? {},
- base_package ? pkgs.firefox,
-}: let
- pkg = base_package.override (old: {
- extraPrefsFiles =
- (old.extraPrefsFiles or [])
- ++ [
- (pkgs.writeText "autoConfig.js" autoConfig)
- ];
- nativeMessagingHosts = old.nativeMessagingHosts or [] ++ extraNativeMessagingHosts;
- cfg = (old.cfg or {}) // wrapperConfig;
- extraPoliciesFiles =
- (old.extraPoliciesFiles or [])
- ++ [
- (
- pkgs.writeText "policies.json" (builtins.toJSON extraPolicies)
- )
- ];
- });
-in
- pkg
diff --git a/modules/home.legacy/conf/firefox/scripts/default.nix b/modules/home.legacy/conf/firefox/scripts/default.nix
deleted file mode 100644
index 1127662b..00000000
--- a/modules/home.legacy/conf/firefox/scripts/default.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- pkgs,
- sysLib,
- ...
-}: let
- unzip_mozlz4 = pkgs.stdenv.mkDerivation {
- name = "unzip_mozlz4";
- propagatedBuildInputs = [
- (pkgs.python3.withPackages (pythonPackages:
- with pythonPackages; [
- lz4
- ]))
- ];
- dontUnpack = true;
- installPhase = "install -Dm755 ${./unzip_mozlz4.py} $out/bin/unzip_mozlz4";
- };
- extract_cookies = sysLib.writeShellScript {
- name = "extract_cookies";
- src = ./extract_cookies.sh;
- dependencies = with pkgs; [
- bash
- sqlite
- mktemp
- coreutils
- ];
- };
-in {
- inherit unzip_mozlz4 extract_cookies;
-}
diff --git a/modules/home.legacy/conf/firefox/scripts/extract_cookies.sh b/modules/home.legacy/conf/firefox/scripts/extract_cookies.sh
deleted file mode 100755
index e3d50d43..00000000
--- a/modules/home.legacy/conf/firefox/scripts/extract_cookies.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env bash
-# copied from https://superuser.com/a/1239036
-# extract_cookies.sh:
-#
-# Convert from Firefox's cookies.sqlite format to Netscape cookies,
-# which can then be used by wget and curl. (Why don't wget and curl
-# just use libsqlite if it's installed? Mysteries abound.)
-#
-# Note: This script reads directly from the standard cookie jar file,
-# which means cookies which are kept only in memory ("session cookies")
-# will not be extracted. You will need an extension to do that.
-
-# USAGE:
-#
-# $ extract_cookies.sh > /tmp/cookies.txt
-# or
-# $ extract_cookies.sh ~/.mozilla/firefox/*default*/cookies.sqlite > /tmp/cookies.txt
-
-# USING WITH WGET:
-# $ wget --load-cookies=/tmp/cookies.txt http://example.com
-
-# USING WITH CURL:
-# $ curl --cookie /tmp/cookies.txt http://example.com
-
-# Note: If you do not specify an SQLite filename, this script will
-# intelligently find it for you.
-#
-# A) Usually it will check all profiles under ~/.mozilla/firefox/ and
-# use the cookies.sqlite that was updated most recently.
-#
-# B) If you've redirected stdin (with < or |) , then that will be used.
-
-# HISTORY: I believe this is circa 2010 from:
-# http://slacy.com/blog/2010/02/using-cookies-sqlite-in-wget-or-curl/
-# However, that site is down now.
-
-# Cleaned up by Hackerb9 (2017) to be more robust and require less typing.
-
-cleanup() {
- rm -f "$TMPFILE"
- exit 0
-}
-trap cleanup EXIT INT QUIT TERM
-
-if [ "$#" -ge 1 ]; then
- SQLFILE="$1"
-else
- SQLFILE="$HOME/.mozilla/firefox/default/cookies.sqlite"
-fi
-
-if ! [ -r "$SQLFILE" ]; then
- echo "Error. File $SQLFILE is not readable." >&2
- exit 1
-fi
-
-# We have to copy cookies.sqlite, because FireFox has a lock on it
-TMPFILE=$(mktemp /tmp/cookies.sqlite.XXXXXXXXXX)
-cat "$SQLFILE" >>"$TMPFILE"
-
-# This is the format of the sqlite database:
-# CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER);
-
-echo "# Netscape HTTP Cookie File"
-sqlite3 -separator $'\t' "$TMPFILE" <<EOF
-.mode tabs
-.header off
-select host,
-case substr(host,1,1)='.' when 0 then 'FALSE' else 'TRUE' end,
-path,
-case isSecure when 0 then 'FALSE' else 'TRUE' end,
-expiry,
-name,
-value
-from moz_cookies;
-EOF
-
-cleanup
diff --git a/modules/home.legacy/conf/firefox/scripts/unzip_mozlz4.py b/modules/home.legacy/conf/firefox/scripts/unzip_mozlz4.py
deleted file mode 100755
index 71e4e6bc..00000000
--- a/modules/home.legacy/conf/firefox/scripts/unzip_mozlz4.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-# source: https://unix.stackexchange.com/a/497861
-# Command-line tool to decompress mozLz4 files used for example by Firefox to store various kinds of session backup information.
-# Works in both Python 2.7.15 and 3.6.7, as of version 2.1.6 of the LZ4 Python bindings at pypi.org/project/lz4.
-# To use in another script, simply cut and paste the import statement and the mozlz4_to_text() function (lines 8 to 17).
-
-import lz4.block # pip install lz4 --user
-
-
-def mozlz4_to_text(filepath):
- # Given the path to a "mozlz4", "jsonlz4", "baklz4" etc. file,
- # return the uncompressed text.
- bytestream = open(filepath, "rb")
- bytestream.read(8) # skip past the b"mozLz40\0" header
- valid_bytes = bytestream.read()
- text = lz4.block.decompress(valid_bytes)
- return text
-
-
-def main(args):
- # Given command-line arguments of an input filepath for a ".mozlz4" file
- # and optionally an output filepath, write the decompressed text to the
- # output filepath.
- # Default output filepath is the input filepath minus the last three characters
- # (e.g. "foo.jsonlz4" becomes "foo.json")
- filepath_in = args[0]
- if len(args) < 2:
- filepath_out = filepath_in[:-3]
- else:
- filepath_out = args[1]
- text = mozlz4_to_text(filepath_in)
- with open(filepath_out, "wb") as outfile:
- outfile.write(text)
- if filepath_out != "/dev/stdout":
- print("Wrote decompressed text to {}".format(filepath_out))
-
-
-if __name__ == "__main__":
- import sys
-
- args = sys.argv[1:]
- if args and args[0] not in ("--help", "-h"):
- main(args)
- else:
- print("Usage: mozlz4.py <mozlz4 file to read> <location to write>")
diff --git a/modules/home.legacy/conf/firefox/scripts/update_extensions.sh b/modules/home.legacy/conf/firefox/scripts/update_extensions.sh
deleted file mode 100755
index 86bd843c..00000000
--- a/modules/home.legacy/conf/firefox/scripts/update_extensions.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-tmp=$(mktemp)
-cat <<EOF | awk '!/^\s*#/' >"$tmp"
- darkreader:navbar
- keepassxc-browser:navbar
- vhack-libredirect:navbar
- torproject-snowflake:navbar
- tridactyl-vim:menupanel
- ublock-origin:menupanel
-EOF
-
-# The bin is provided in the devshell;
-# The cat execution should be unquoted;
-# shellcheck disable=SC2046
-generate_extensions $(cat "$tmp") >"$(dirname "$0")"/../config/extensions/extensions.json
-
-rm "$tmp"
diff --git a/modules/home.legacy/conf/taskwarrior/firefox/default.nix b/modules/home.legacy/conf/taskwarrior/firefox/default.nix
deleted file mode 100644
index fb5daaa8..00000000
--- a/modules/home.legacy/conf/taskwarrior/firefox/default.nix
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- config,
- lib,
- # options
- prefConfig,
- profile_size,
- search,
- userChrome,
- ...
-}: let
- inherit (config.soispha.taskwarrior.projects) projects;
-
- mkFirefoxProfile = {
- name,
- id,
- }: {
- inherit name;
- value = {
- isDefault = false;
- extraConfig = prefConfig;
- inherit id name search userChrome;
- };
- };
- projects_id =
- lib.imap0 (id: project: {
- name = project;
- id = id + profile_size;
- })
- projects;
- firefoxProfiles = builtins.listToAttrs (builtins.map mkFirefoxProfile projects_id);
-in
- firefoxProfiles
diff --git a/modules/home.legacy/default.nix b/modules/home.legacy/default.nix
index 0944b505..706e2045 100644
--- a/modules/home.legacy/default.nix
+++ b/modules/home.legacy/default.nix
@@ -1,6 +1,7 @@
{
nixVim,
nix-index-database,
+ arkenfox-nixos,
...
}: let
username = "soispha";
@@ -21,6 +22,7 @@ in {
nixVim.homeManagerModules.nixvim
nix-index-database.hmModules.nix-index
+ arkenfox-nixos.hmModules.arkenfox
];
# I don't know what this does, but I've seen it a lot online, so it should be good, right?
diff --git a/update.sh b/update.sh
index 77cb9482..b4408bea 100755
--- a/update.sh
+++ b/update.sh
@@ -10,7 +10,7 @@ __update_sh_run() {
unset __update_sh_command
}
-__update_sh_run ./modules/home.legacy/conf/firefox/scripts/update_extensions.sh "$@"
+__update_sh_run ./modules/by-name/fi/firefox/update_extensions.sh "$@"
__update_sh_run ./pkgs/update_pkgs.sh "$@"
echo "Also update out-of tree dependencies, like yt!" 2>&1