about summary refs log tree commit diff
path: root/modules/core
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-15 19:08:54 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-19 01:31:03 +0100
commit31cf19c39f8b7ead49f709045a45ee695c440506 (patch)
treeb5856a423843d8218a6dff2f02ed0a92aa3eddb0 /modules/core
parent05cb73f4525b8bfc2d71ca6809bfe0a10e054d68 (diff)
modules/core/common: set correct dbPath for command-not-found
Since we now distribute the programs.sqlite database with the vuizvui
channel, we can make use of it in programs.command-not-found. We change
the default path used to use the nixpkgs sub directory of the vuizvui
channel (by default it expects a channel named nixos containing the
database).
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/common.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/core/common.nix b/modules/core/common.nix
index 9c9c7a67..3f9f4f5f 100644
--- a/modules/core/common.nix
+++ b/modules/core/common.nix
@@ -2,7 +2,11 @@
 
 with lib;
 
-{
+let
+  rootChannelsPath = "/nix/var/nix/profiles/per-user/root/channels";
+  channelPath = "${rootChannelsPath}/${config.vuizvui.channelName}";
+
+in {
   options.vuizvui = {
     modifyNixPath = mkOption {
       type = types.bool;
@@ -55,8 +59,6 @@ with lib;
     in mkIf config.vuizvui.enableGlobalNixpkgsConfig (mkForce nixpkgsCfg);
 
     nix.nixPath = let
-      rootChannelsPath = "/nix/var/nix/profiles/per-user/root/channels";
-      channelPath = "${rootChannelsPath}/${config.vuizvui.channelName}";
       nixosConfig = "/etc/nixos/configuration.nix";
       nixpkgsConfig = "nixpkgs-config=${pkgs.writeText "nixpkgs-config.nix" ''
         (import ${pkgs.path}/nixos/lib/eval-config.nix {
@@ -70,5 +72,9 @@ with lib;
         rootChannelsPath
       ] ++ optional config.vuizvui.enableGlobalNixpkgsConfig nixpkgsConfig;
     in mkIf config.vuizvui.modifyNixPath (mkOverride 90 nixPath);
+
+    # correct path used by command-not-found which is enabled by default
+    programs.command-not-found.dbPath =
+      mkDefault "${channelPath}/nixpkgs/programs.sqlite";
   };
 }