From 4c13fa2dcc7ce443950c5cc70a82f567d8183f84 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Sat, 21 Sep 2024 13:51:39 +0300 Subject: [PATCH] Add more firefox settings --- flake.lock | 35 +++++- flake.nix | 21 +++- home/.config/nvim/mason-lock.json | 5 +- nixos_common.nix | 34 +++++- users/functionalhacker/home.nix | 176 +++++++++++++++++++++--------- 5 files changed, 207 insertions(+), 64 deletions(-) diff --git a/flake.lock b/flake.lock index 9eb6b3df..cbc5482d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "firefox-gnome-theme": { + "flake": false, + "locked": { + "lastModified": 1723137499, + "narHash": "sha256-MOE9NeU2i6Ws1GhGmppMnjOHkNLl2MQMJmGhaMzdoJM=", + "owner": "rafaelmardojai", + "repo": "firefox-gnome-theme", + "rev": "fb5b578a4f49ae8705e5fea0419242ed1b8dba70", + "type": "github" + }, + "original": { + "owner": "rafaelmardojai", + "repo": "firefox-gnome-theme", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -37,10 +53,27 @@ "type": "github" } }, + "nur": { + "locked": { + "lastModified": 1726858247, + "narHash": "sha256-IUYdQSkMqvFl1ZpxEkepTaHwHfbqH2cZi3xt2k3pvqw=", + "owner": "nix-community", + "repo": "NUR", + "rev": "22ebfb84d1effa4cdff534e52a8683415d8b77d0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, "root": { "inputs": { + "firefox-gnome-theme": "firefox-gnome-theme", "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nur": "nur" } } }, diff --git a/flake.nix b/flake.nix index 2df7ebe8..9551e79d 100644 --- a/flake.nix +++ b/flake.nix @@ -3,27 +3,38 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + nur.url = "github:nix-community/NUR"; home-manager = { url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; }; + + firefox-gnome-theme = { + url = "github:rafaelmardojai/firefox-gnome-theme"; + flake = false; + }; }; - outputs = { nixpkgs, home-manager, ... }: + outputs = { nixpkgs, home-manager, nur, ... } @inputs: { nixosConfigurations.Mirkwood = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./hosts/Mirkwood/configuration.nix ./nixos_common.nix + { nixpkgs.overlays = [ nur.overlay ]; } home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.functionalhacker = - import ./users/functionalhacker/home.nix; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; + backupFileExtension = "bak"; + users.functionalhacker = + import ./users/functionalhacker/home.nix; + }; } ]; }; diff --git a/home/.config/nvim/mason-lock.json b/home/.config/nvim/mason-lock.json index 76c90739..29de084e 100644 --- a/home/.config/nvim/mason-lock.json +++ b/home/.config/nvim/mason-lock.json @@ -6,18 +6,15 @@ "eslint-lsp": "4.10.0", "google-java-format": "v1.23.0", "html-lsp": "4.10.0", - "java-debug-adapter": "0.58.0", "jdtls": "v1.38.0", "json-lsp": "4.10.0", - "lemminx": "0.27.1", "lua-language-server": "3.10.6", "nil": "2024-08-06", "nixpkgs-fmt": "1.3.0", "prettier": "3.3.3", "prettierd": "0.25.3", - "stylua": "v0.20.0", "taplo": "0.9.3", "tree-sitter-cli": "v0.23.0", "typescript-language-server": "4.3.3", "yaml-language-server": "1.15.0" -} +} \ No newline at end of file diff --git a/nixos_common.nix b/nixos_common.nix index 0718c245..76a50d95 100644 --- a/nixos_common.nix +++ b/nixos_common.nix @@ -9,7 +9,6 @@ system.stateVersion = "24.05"; nix.settings.experimental-features = [ "nix-command" "flakes" ]; - time.timeZone = "Europe/Helsinki"; i18n = { @@ -85,8 +84,39 @@ programs = { firefox = { enable = true; - nativeMessagingHosts.packages = [ pkgs.browserpass ]; + languagePacks = [ + "en-US" + "fi" + "th" + ]; + policies = { + DisablePocket = true; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + DisplayBookmarksToolbar = "never"; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + ExtensionSettings = with builtins; + let + extension = shortId: uuid: { + name = uuid; + value = { + install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; + installation_mode = "normal_installed"; + }; + }; + in + listToAttrs [ + (extension "ublock-origin" "uBlock0@raymondhill.net") + (extension "decentraleyes" "jid1-BoFifL9Vbdl2zQ@jetpack") + ]; + }; }; + zsh.enable = true; }; diff --git a/users/functionalhacker/home.nix b/users/functionalhacker/home.nix index dde6b912..e17d93f7 100644 --- a/users/functionalhacker/home.nix +++ b/users/functionalhacker/home.nix @@ -1,6 +1,7 @@ -{ config, pkgs, ... }: +{ config, pkgs, inputs, ... }: { + imports = [ inputs.nur.hmModules.nur ]; home = { username = "functionalhacker"; homeDirectory = "/home/functionalhacker"; @@ -16,19 +17,24 @@ neovide nerdfonts nodejs - pass ripgrep trash-cli tree-sitter usbutils wl-clipboard yarn + zip ]; - # Just symlink neovim configuration for now. - # Declarative configuration coming soon™ - file.".config/nvim".source = - config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/git/dotfiles/home/.config/nvim"; + file = { + # Just symlink neovim configuration for now. + # Declarative configuration coming soon™ + ".config/nvim".source = + config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/git/dotfiles/home/.config/nvim"; + + # Get firefox-gnome-theme files from flake inputs + ".mozilla/firefox/functionalhacker/chrome/firefox-gnome-theme".source = inputs.firefox-gnome-theme; + }; }; programs = { @@ -56,62 +62,61 @@ ]; }; initExtra = '' - # key timeout - export KEYTIMEOUT=1 + # key timeout + export KEYTIMEOUT=1 - # prompt customization - export PURE_PROMPT_SYMBOL="λ" - export PURE_PROMPT_VICMD_SYMBOL="y" - - # fzf settings - export FD_COMMAND='fd -HLt' - export FZF_DEFAULT_COMMAND="$FD_COMMAND f" - export FZF_ALT_C_COMMAND="$FD_COMMAND d" - export FZF_ALT_C_OPTS="--preview 'eza -l {}'" - export FZF_DEFAULT_OPTS='-m --ansi --bind ctrl-a:toggle-all,ctrl-d:deselect-all,ctrl-t:toggle-all' - export FZF_COMPLETION_TRIGGER='**' - export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND --strip-cwd-prefix" - export FZF_CTRL_T_OPTS='--preview "bat --color=always --style=numbers --line-range=:500 {}"' - _fzf_compgen_path() { - resultcmd="$FZF_DEFAULT_COMMAND . $1" - eval "''${resultcmd} - } - _fzf_compgen_dir() { - resultcmd="$FZF_ALT_C_COMMAND . $1" - eval "''${resultcmd} - } + # prompt customization + export PURE_PROMPT_SYMBOL="λ" + export PURE_PROMPT_VICMD_SYMBOL="y" + # fzf settings + export FD_COMMAND='fd -HLt' + export FZF_DEFAULT_COMMAND="$FD_COMMAND f" + export FZF_ALT_C_COMMAND="$FD_COMMAND d" + export FZF_ALT_C_OPTS="--preview 'eza -l {}'" + export FZF_DEFAULT_OPTS='-m --ansi --bind ctrl-a:toggle-all,ctrl-d:deselect-all,ctrl-t:toggle-all' + export FZF_COMPLETION_TRIGGER='**' + export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND --strip-cwd-prefix" + export FZF_CTRL_T_OPTS='--preview "bat --color=always --style=numbers --line-range=:500 {}"' + _fzf_compgen_path() { + resultcmd="$FZF_DEFAULT_COMMAND . $1" + eval "''${resultcmd} + } + _fzf_compgen_dir() { + resultcmd="$FZF_ALT_C_COMMAND . $1" + eval "''${resultcmd} + } # nvim ftw! - export PAGER="$EDITOR -R +\"lua require 'pager'\"" - export GIT_PAGER="$EDITOR -c 'set ft=git' -R +\"lua require 'pager'\"" - export MANPAGER="$EDITOR +\"lua require 'pager'\" +Man!" - export SYSTEMD_EDITOR=$EDITOR - export SYSTEMD_PAGER=less + export PAGER="$EDITOR -R +\"lua require 'pager'\"" + export GIT_PAGER="$EDITOR -c 'set ft=git' -R +\"lua require 'pager'\"" + export MANPAGER="$EDITOR +\"lua require 'pager'\" +Man!" + export SYSTEMD_EDITOR=$EDITOR + export SYSTEMD_PAGER=less - if [ "''${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then - export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" - fi + if [ "''${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + fi - # use e to open command in editor - autoload edit-command-line; zle -N edit-command-line - bindkey -M vicmd e edit-command-line + # use e to open command in editor + autoload edit-command-line; zle -N edit-command-line + bindkey -M vicmd e edit-command-line - # bind delete in normal mode - bindkey -M vicmd '^[[3~' delete-char + # bind delete in normal mode + bindkey -M vicmd '^[[3~' delete-char - # Rebind fzf to ctrl+f - bindkey '^F' fzf-file-widget - bindkey '^T' transpose-chars + # Rebind fzf to ctrl+f + bindkey '^F' fzf-file-widget + bindkey '^T' transpose-chars - # Remove grc alias from forgit since it - # collides with the grc colorizer - unalias grc; + # Remove grc alias from forgit since it + # collides with the grc colorizer + unalias grc; - # Launch or attach zellij to existing session if logging in over ssh - if [[ -z "$ZELLIJ" && -n "$SSH_CONNECTION" ]]; then - exec zellij attach -c SSH - fi + # Launch or attach zellij to existing session if logging in over ssh + if [[ -z "$ZELLIJ" && -n "$SSH_CONNECTION" ]]; then + exec zellij attach -c SSH + fi ''; shellAliases = { # Navigation @@ -206,5 +211,72 @@ }; }; }; + + firefox = { + enable = true; + + profiles.functionalhacker = { + name = "FunctionalHacker"; + userChrome = '' + @import "firefox-gnome-theme/userChrome.css"; + ''; + userContent = '' + @import "firefox-gnome-theme/userContent.css"; + ''; + settings = { + ## Firefox gnome theme ## - https://github.com/rafaelmardojai/firefox-gnome-theme/blob/1c32013cdbe17406de496cdf5f6899b84c4bbfed/configuration/user.js + # (copied into here because home-manager already writes to user.js) + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # Enable customChrome.cs + # Set UI density to normal + "browser.uidensity" = 0; + + # Enable SVG context-propertes + "svg.context-properties.content.enabled" = true; + + # Disable private window dark theme + "browser.theme.dark-private-windows" = false; + + # Enable rounded bottom window corners + "widget.gtk.rounded-bottom-corners.enabled" = true; + + # Firefox gnome theme optional settings + "gnomeTheme.hideSingleTab" = true; + "gnomeTheme.hideWebrtcIndicator" = true; + + # Auto enable installed addons + "extensions.autoDisableScopes" = 0; + }; + search = { + default = "Korhonen Search"; + engines = { + "Korhonen Search" = { + urls = [ + { + template = "https://search.korhonen.cc/search?q={searchTerms}"; + iconUpdateURL = "https://search.korhonen.cc/favicon.ico"; + updateInterval = 24 * 60 * 60 * 1000; # Once a day + } + ]; + }; + }; + }; + + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + browserpass + darkreader + ]; + + }; + }; + + password-store = { + enable = true; + package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]); + }; + + browserpass = { + enable = true; + browsers = [ "firefox" ]; + }; }; }