From 2770d8fb58caa912e536d63be027d0bd53881f5e Mon Sep 17 00:00:00 2001
From: Julien Malka <julien@malka.sh>
Date: Sat, 10 Jun 2023 19:28:42 +0200
Subject: [PATCH] nix index automatic

---
 base.nix        |  4 +++-
 flake.lock      | 21 +++++++++++++++++++++
 flake.nix       |  6 ++++++
 lib/default.nix |  1 +
 4 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/base.nix b/base.nix
index 1e53721..b089ee4 100644
--- a/base.nix
+++ b/base.nix
@@ -26,11 +26,13 @@
     rxvt_unicode
     xorg.xbacklight
     neovim
-    comma
   ];
 
   environment.variables.EDITOR = "nvim";
 
+  programs.command-not-found.enable = false;
+  programs.nix-index-database.comma.enable = true;
+
   networking.firewall.checkReversePath = "loose";
 
   systemd.services.NetworkManager-wait-online.enable = false;
diff --git a/flake.lock b/flake.lock
index 9e0eabb..df702a1 100644
--- a/flake.lock
+++ b/flake.lock
@@ -325,6 +325,26 @@
         "type": "github"
       }
     },
+    "nix-index-database": {
+      "inputs": {
+        "nixpkgs": [
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1685764721,
+        "narHash": "sha256-CIy1iwQTEKfZRrid4gBLA+r/LPGA9IUFo0lKJVyECGI=",
+        "owner": "Mic92",
+        "repo": "nix-index-database",
+        "rev": "669ca1f2e2bc401abab6b837ae9c51503edc9b49",
+        "type": "github"
+      },
+      "original": {
+        "owner": "Mic92",
+        "repo": "nix-index-database",
+        "type": "github"
+      }
+    },
     "nix-rfc-92": {
       "inputs": {
         "flake-compat": "flake-compat_3",
@@ -473,6 +493,7 @@
         "hyprpaper": "hyprpaper",
         "linkal": "linkal",
         "nil": "nil",
+        "nix-index-database": "nix-index-database",
         "nix-rfc-92": "nix-rfc-92",
         "nixos-apple-silicon": "nixos-apple-silicon",
         "nixpkgs": "nixpkgs_5",
diff --git a/flake.nix b/flake.nix
index 6147564..9d2f003 100644
--- a/flake.nix
+++ b/flake.nix
@@ -70,6 +70,12 @@
       inputs.nixpkgs.follows = "unstable";
     };
 
+    nix-index-database =
+      {
+        url = "github:Mic92/nix-index-database";
+        inputs.nixpkgs.follows = "nixpkgs";
+      };
+
     nix-rfc-92.url = "github:obsidiansystems/nix/dynamic-drvs";
 
   };
diff --git a/lib/default.nix b/lib/default.nix
index daaa0a3..50cf757 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -24,6 +24,7 @@ in
       inputs.simple-nixos-mailserver.nixosModule
       inputs.hyprland.nixosModules.default
       inputs.attic.nixosModules.atticd
+      inputs.nix-index-database.nixosModules.nix-index
       {
         home-manager.useGlobalPkgs = true;
         nixpkgs.overlays = [