From 3554e1e7d44adc911e0f38abfd56271090ec41a1 Mon Sep 17 00:00:00 2001 From: Truxnell <9149206+truxnell@users.noreply.github.com> Date: Sun, 31 Mar 2024 21:40:20 +1100 Subject: [PATCH] feat: add firefox --- .../modules/programs/browsers/default.nix | 5 +++ .../programs/browsers/firefox/default.nix | 39 +++++++++++++++++++ nixos/home/modules/programs/default.nix | 5 +++ nixos/home/modules/shell/wezterm/default.nix | 16 ++++++++ .../home/truxnell/{default.nix => global.nix} | 4 +- nixos/home/truxnell/server.nix | 6 ++- nixos/home/truxnell/workstation.nix | 11 +++++- nixos/modules/nixos/de/gnome.nix | 5 +++ nixos/modules/nixos/template.nix | 1 + nixos/overlays/default.nix | 2 +- nixos/profiles/role-worstation.nix | 2 +- 11 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 nixos/home/modules/programs/browsers/default.nix create mode 100644 nixos/home/modules/programs/browsers/firefox/default.nix create mode 100644 nixos/home/modules/programs/default.nix rename nixos/home/truxnell/{default.nix => global.nix} (86%) diff --git a/nixos/home/modules/programs/browsers/default.nix b/nixos/home/modules/programs/browsers/default.nix new file mode 100644 index 0000000..3062d5e --- /dev/null +++ b/nixos/home/modules/programs/browsers/default.nix @@ -0,0 +1,5 @@ +{ ... }: { + imports = [ + ./firefox + ]; +} diff --git a/nixos/home/modules/programs/browsers/firefox/default.nix b/nixos/home/modules/programs/browsers/firefox/default.nix new file mode 100644 index 0000000..cd7e08e --- /dev/null +++ b/nixos/home/modules/programs/browsers/firefox/default.nix @@ -0,0 +1,39 @@ +{ lib +, config +, self +, pkgs +, osConfig +, ... +}: + +with lib; +let + cfg = config.myHome.programs.firefox; +in +{ + options.myHome.programs.firefox.enable = mkEnableOption "Firefox"; + + config = mkIf cfg.enable { + + programs.firefox = { + enable = true; + package = pkgs.firefox.override + { + extraPolicies = { + DontCheckDefaultBrowser = true; + DisablePocket = true; + # See nixpkgs' firefox/wrapper.nix to check which options you can use + nativeMessagingHosts = [ + # Gnome shell native connector + pkgs.gnome-browser-connector + # plasma connector + # plasma5Packages.plasma-browser-integration + ]; + }; + }; + }; + + }; + + +} diff --git a/nixos/home/modules/programs/default.nix b/nixos/home/modules/programs/default.nix new file mode 100644 index 0000000..232a70d --- /dev/null +++ b/nixos/home/modules/programs/default.nix @@ -0,0 +1,5 @@ +{ ... }: { + imports = [ + ./browsers + ]; +} diff --git a/nixos/home/modules/shell/wezterm/default.nix b/nixos/home/modules/shell/wezterm/default.nix index 8d2e64a..86631ab 100644 --- a/nixos/home/modules/shell/wezterm/default.nix +++ b/nixos/home/modules/shell/wezterm/default.nix @@ -17,8 +17,24 @@ in # Temporary make .config/wezterm/wezterm.lua link to the local copy config = mkIf cfg.enable { # xdg.configFile."wezterm/wezterm.lua".source = config.lib.file.mkOutOfStoreSymlink cfg.configPath; + programs.wezterm.package = pkgs.unstable.wezterm; programs.wezterm = { enable = true; + extraConfig = '' + local wez = require('wezterm') + return { + + color_scheme = "Dracula (Official)", + check_for_updates = false, + window_background_opacity = .90, + window_padding = { + left = '2cell', + right = '2cell', + top = '1cell', + bottom = '0cell', + }, + } + ''; }; }; } diff --git a/nixos/home/truxnell/default.nix b/nixos/home/truxnell/global.nix similarity index 86% rename from nixos/home/truxnell/default.nix rename to nixos/home/truxnell/global.nix index 5f530c8..040b488 100644 --- a/nixos/home/truxnell/default.nix +++ b/nixos/home/truxnell/global.nix @@ -9,9 +9,7 @@ with config; config = { myHome.username = "truxnell"; myHome.homeDirectory = "/home/truxnell/"; - myHome.shell.starship.enable = true; - myHome.shell.fish.enable = true; - myHome.shell.wezterm.enable = true; + # services.gpg-agent.pinentryPackage = pkgs.pinentry-qt; systemd.user.sessionVariables = { diff --git a/nixos/home/truxnell/server.nix b/nixos/home/truxnell/server.nix index 88c6f85..9015112 100644 --- a/nixos/home/truxnell/server.nix +++ b/nixos/home/truxnell/server.nix @@ -1,3 +1,7 @@ { lib, pkgs, self, config, ... }: with config; -{ } +{ + imports = [ + ./global.nix + ]; +} diff --git a/nixos/home/truxnell/workstation.nix b/nixos/home/truxnell/workstation.nix index a915b51..13a2a37 100644 --- a/nixos/home/truxnell/workstation.nix +++ b/nixos/home/truxnell/workstation.nix @@ -1,6 +1,14 @@ { lib, pkgs, self, config, ... }: with config; { + imports = [ + ./global.nix + ]; + + myHome.programs.firefox.enable = true; + myHome.shell.starship.enable = true; + myHome.shell.fish.enable = true; + myHome.shell.wezterm.enable = true; home = { # Install these packages for my user @@ -9,7 +17,8 @@ with config; steam spotify brightnessctl - prusaslicer + prusa-slicer + bitwarden bat dbus diff --git a/nixos/modules/nixos/de/gnome.nix b/nixos/modules/nixos/de/gnome.nix index 9301423..c7563e8 100644 --- a/nixos/modules/nixos/de/gnome.nix +++ b/nixos/modules/nixos/de/gnome.nix @@ -34,6 +34,11 @@ in layout = "us"; # `localctl` will give you }; + # GNOME connection to browsers - requires flag on browser as well + services.gnome.gnome-browser-connector.enable = lib.any + (user: user.programs.firefox.enable) + (lib.attrValues config.home-manager.users); + # TODO remove this when possible # workaround for GNOME autologin # https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229 diff --git a/nixos/modules/nixos/template.nix b/nixos/modules/nixos/template.nix index d901e8a..2d643b4 100644 --- a/nixos/modules/nixos/template.nix +++ b/nixos/modules/nixos/template.nix @@ -1,5 +1,6 @@ { lib , config +, pkgs , ... }: diff --git a/nixos/overlays/default.nix b/nixos/overlays/default.nix index 4d53b3e..711f076 100644 --- a/nixos/overlays/default.nix +++ b/nixos/overlays/default.nix @@ -4,7 +4,7 @@ { # deploy-rs overlay deploy-rs = inputs.deploy-rs.overlays.default; - + # The unstable nixpkgs set (declared in the flake inputs) will # be accessible through 'pkgs.unstable' unstable-packages = final: _prev: { diff --git a/nixos/profiles/role-worstation.nix b/nixos/profiles/role-worstation.nix index b1a5a08..7916a5c 100644 --- a/nixos/profiles/role-worstation.nix +++ b/nixos/profiles/role-worstation.nix @@ -11,7 +11,7 @@ with config; de.gnome.enable = true; editor.vscodium.enable = true; - browser.firefox.enable = true; + # Lets see if fish everywhere is OK on the pi's # TODO decide if i drop to bash on pis? shell.fish.enable = true;