From 78541003582ad6abc4899c75c7d3a2c6d2a804f9 Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Fri, 31 Jan 2025 08:24:40 -0600 Subject: [PATCH 1/3] apply formatter --- home/modules/firefox.nix | 2 +- sys/platforms/vps/srv/net.nix | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/home/modules/firefox.nix b/home/modules/firefox.nix index 43a0c92..e0b1425 100644 --- a/home/modules/firefox.nix +++ b/home/modules/firefox.nix @@ -9,7 +9,7 @@ with lib; let in { options.local.apps.browsers = { enable = mkEnableOption "firefox settings"; - + workspace = mkOption { type = types.nullOr types.str; default = null; diff --git a/sys/platforms/vps/srv/net.nix b/sys/platforms/vps/srv/net.nix index 6a83997..3d36c01 100644 --- a/sys/platforms/vps/srv/net.nix +++ b/sys/platforms/vps/srv/net.nix @@ -52,6 +52,7 @@ in { }; }; }; + fail2ban = { enable = true; bantime = "10m"; From 86cf5177386df3dd9d56fcde083fe788322e80ae Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Fri, 31 Jan 2025 08:28:46 -0600 Subject: [PATCH 2/3] update firefox module --- home/modules/firefox.nix | 15 +++++++++++++-- home/modules/gui/default.nix | 1 - home/platforms/fabian@posixlycorrect/default.nix | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/home/modules/firefox.nix b/home/modules/firefox.nix index e0b1425..ec2c867 100644 --- a/home/modules/firefox.nix +++ b/home/modules/firefox.nix @@ -5,9 +5,9 @@ ... }: with lib; let - cfg = config.local.apps.browsers; + cfg = config.local.apps.firefox; in { - options.local.apps.browsers = { + options.local.apps.firefox = { enable = mkEnableOption "firefox settings"; workspace = mkOption { @@ -22,6 +22,17 @@ in { config = mkIf cfg.enable { programs.firefox.enable = true; + xdg = { + mimeApps = { + enable = true; + defaultApplications = { + "text/uri-list" = with pkgs; ["firefox"]; + "x-scheme-handler/http" = with pkgs; ["firefox"]; + "x-scheme-handler/https" = with pkgs; ["firefox"]; + }; + }; + }; + xsession.windowManager.i3.config.startup = optional (cfg.workspace != null) { command = "${lib.getExe pkgs.i3-gaps} 'workspace ${cfg.workspace}; exec ${lib.getExe pkgs.firefox}'"; }; diff --git a/home/modules/gui/default.nix b/home/modules/gui/default.nix index bca09e9..3869944 100644 --- a/home/modules/gui/default.nix +++ b/home/modules/gui/default.nix @@ -120,7 +120,6 @@ in { enable = true; defaultApplications = { "application/pdf" = with pkgs; ["qpdfview"]; - "text/uri-list" = with pkgs; ["firefox"]; "x-scheme-handler/file" = with pkgs; ["kitty"]; }; }; diff --git a/home/platforms/fabian@posixlycorrect/default.nix b/home/platforms/fabian@posixlycorrect/default.nix index 13167d9..3834d9d 100644 --- a/home/platforms/fabian@posixlycorrect/default.nix +++ b/home/platforms/fabian@posixlycorrect/default.nix @@ -43,7 +43,7 @@ defaultDesktopPack.enable = true; firefox = { enable = true; - workspace = 1; + workspace = "1"; #make this an int later }; }; From 6b2163c050a3ea243929d11d7aa6a2ac3cb739e7 Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Fri, 7 Feb 2025 12:36:22 -0600 Subject: [PATCH 3/3] improve firefox module --- home/modules/firefox.nix | 47 +++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/home/modules/firefox.nix b/home/modules/firefox.nix index ec2c867..f03ab92 100644 --- a/home/modules/firefox.nix +++ b/home/modules/firefox.nix @@ -14,27 +14,44 @@ in { type = types.nullOr types.str; default = null; description = '' - Workspace in which Firefox should open. If not set, Firefox will not open at startup. + i3 Workspace in which Firefox should open. If not set, Firefox will not open at startup + ''; + }; + + makeDefaultBrowser = mkOption { + type = types.bool; + default = true; + description = '' + Take a guess ''; }; }; - config = mkIf cfg.enable { - programs.firefox.enable = true; + config = mkIf cfg.enable (mkMerge [ + { + programs.firefox.enable = true; - xdg = { - mimeApps = { - enable = true; - defaultApplications = { - "text/uri-list" = with pkgs; ["firefox"]; - "x-scheme-handler/http" = with pkgs; ["firefox"]; - "x-scheme-handler/https" = with pkgs; ["firefox"]; + xsession.windowManager.i3.config.startup = optional (cfg.workspace != null) { + command = "${lib.getExe pkgs.i3-gaps} 'workspace ${cfg.workspace}; exec ${lib.getExe pkgs.firefox}'"; + }; + } + + (mkIf cfg.makeDefaultBrowser { + xdg = { + mimeApps = { + enable = true; + defaultApplications = { + "text/html" = ["firefox"]; + "text/uri-list" = ["firefox"]; + "x-scheme-handler/http" = ["firefox"]; + "x-scheme-handler/https" = ["firefox"]; + "x-scheme-handler/about" = ["firefox"]; + "x-scheme-handler/unknown" = ["firefox"]; + }; }; }; - }; - xsession.windowManager.i3.config.startup = optional (cfg.workspace != null) { - command = "${lib.getExe pkgs.i3-gaps} 'workspace ${cfg.workspace}; exec ${lib.getExe pkgs.firefox}'"; - }; - }; + home.sessionVariables.DEFAULT_BROWSER = mkIf cfg.makeDefaultBrowser "${lib.getExe pkgs.firefox}"; + }) + ]); }