From 31cf19c39f8b7ead49f709045a45ee695c440506 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Mon, 15 Feb 2021 19:08:54 +0100 Subject: 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). --- modules/core/common.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'modules/core') 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"; }; } -- cgit 1.4.1