From d53b9f1e62edf2a9bc3a7a4819870c9d1d68550c Mon Sep 17 00:00:00 2001
From: matt1432 <matt@nelim.org>
Date: Sat, 4 Jan 2025 22:48:39 -0500
Subject: [PATCH] refactor(hm): make sure nothing is added without setting
 enable

---
 README.md                              |  5 ++---
 configurations/binto/default.nix       |  2 ++
 configurations/wim/default.nix         |  2 ++
 homeManagerModules/firefox/default.nix | 12 +++++++++++-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 71600ecf..263d2b87 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,8 @@
 
 TODO: add directory structure info and enforce it
     - [x] every root folder in the repo represents a flake output except inputs
-    - [] every root folder only has an optional `default.nix` and subfolders for each
-         of its attrs
-    - [] in a subfolder, there should always be a `default.nix`
+    - [x] every root folder only has an optional `default.nix` and subfolders for each
+          of its attrs
     - [] if there is non nix code, it will be in a `config` folder
     - [] redo docs
     - [] every module should not do anything if imported
diff --git a/configurations/binto/default.nix b/configurations/binto/default.nix
index 7e2651f8..f079a241 100644
--- a/configurations/binto/default.nix
+++ b/configurations/binto/default.nix
@@ -87,6 +87,8 @@
         promptMainColor = "purple";
       };
 
+      firefox.enableCustomConf = true;
+
       neovim = {
         enable = true;
         user = mainUser;
diff --git a/configurations/wim/default.nix b/configurations/wim/default.nix
index 2f093f2a..837dee6a 100644
--- a/configurations/wim/default.nix
+++ b/configurations/wim/default.nix
@@ -106,6 +106,8 @@
         promptMainColor = "purple";
       };
 
+      firefox.enableCustomConf = true;
+
       neovim = {
         enable = true;
         user = mainUser;
diff --git a/homeManagerModules/firefox/default.nix b/homeManagerModules/firefox/default.nix
index 0e7f29bb..be09e9b3 100644
--- a/homeManagerModules/firefox/default.nix
+++ b/homeManagerModules/firefox/default.nix
@@ -1,16 +1,26 @@
 self: {
   config,
+  lib,
   pkgs,
   ...
 }: let
   inherit (self.scopedPackages.${pkgs.system}) firefoxAddons;
 
+  inherit (lib) mkIf mkOption types;
+
+  cfg = config.programs.firefox;
+
   rounding = (config.wayland.windowManager.hyprland.settings.decoration.rounding or 2) - 2;
 
   firefox-gx = pkgs.callPackage ./firefox-gx {inherit self;};
   custom-css = pkgs.callPackage ./custom-css {inherit rounding firefox-gx;};
 in {
-  config = {
+  options.programs.firefox.enableCustomConf = mkOption {
+    type = types.bool;
+    default = false;
+  };
+
+  config = mkIf cfg.enableCustomConf {
     home.file = {
       ".mozilla/firefox/matt/chrome/userContent.css".source = "${firefox-gx}/chrome/userContent.css";
       ".mozilla/firefox/matt/chrome/components".source = "${firefox-gx}/chrome/components";