Add nix-index-database and comma

Nix-index-database is a premade database for nix-index. The process of
downloading a database is often rather slow, so building one into the
system config automatically makes sense

Comma is a command which integrates with nix-index to autorun commands
with the ability to detect what package a command is in. Using it allows
you to more easily run commands without having to go to search.nixos.org
and use nix shell or nix run

Change-Id: Ib44b65294152354a9ca433ad2315ddb2fcd8caa4
Reviewed-on: https://git.clicks.codes/c/Chimera/NixFiles/+/427
Tested-by: Skyler Grey <minion@clicks.codes>
Reviewed-by: Skyler Grey <minion@clicks.codes>
diff --git a/flake.nix b/flake.nix
index e93f5fd..9f08db1 100644
--- a/flake.nix
+++ b/flake.nix
@@ -45,15 +45,12 @@
       	inputs.anyrun.homeManagerModules.default
       	inputs.hyprland.homeManagerModules.default
       	inputs.nur.hmModules.nur
+        inputs.nix-index-database.hmModules.nix-index
       ];
     in inputs.snowfall-lib.mkFlake {
       inherit inputs;
       src = ./.;
 
-      # homes.modules = [
-      # TODO: inputs.nix-index-database.hmModules.nix-index
-      # ];
-
       homes.users."coded@shorthair".modules = extraHomeModules;
 
       homes.users."minion@greylag".modules = extraHomeModules;
diff --git a/modules/home/nix-index/default.nix b/modules/home/nix-index/default.nix
deleted file mode 100644
index 7ff8acb..0000000
--- a/modules/home/nix-index/default.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-  config,
-  lib,
-  pkgs,
-  ...
-}:
-
-{
-  xdg.enable = true;
-
-  home.packages = [ pkgs.nix-index ];
-}
diff --git a/modules/home/nixIndex/default.nix b/modules/home/nixIndex/default.nix
new file mode 100644
index 0000000..003a6fd
--- /dev/null
+++ b/modules/home/nixIndex/default.nix
@@ -0,0 +1,35 @@
+{
+  config,
+  lib,
+  pkgs,
+  ...
+}:
+{
+  options = {
+    chimera.nixIndex.enable = lib.mkOption {
+      type = lib.types.bool;
+      description = "Enables nix-index (from nix-index-database)";
+      default = true;
+      example = false;
+    };
+
+    chimera.nixIndex.comma.enable = lib.mkOption {
+      type = lib.types.bool;
+      description = "Enables nix-community/comma";
+      default = true;
+      example = false;
+    };
+  };
+
+  config = {
+    xdg.enable = lib.mkIf config.chimera.nixIndex.enable true;
+
+    programs.nix-index = {
+      enable = config.chimera.nixIndex.enable;
+      enableBashIntegration = config.chimera.shell.bash.enable;
+      enableZshIntegration = config.chimera.shell.zsh.enable;
+    };
+
+    programs.nix-index-database.comma.enable = lib.mkIf config.chimera.nixIndex.enable config.chimera.nixIndex.comma.enable;
+  };
+}