flake-programs-sqlite icon indicating copy to clipboard operation
flake-programs-sqlite copied to clipboard

"command-not-found itself is not enabled" error prevents building

Open volkswagenfeature opened this issue 1 year ago • 1 comments

Adding flake-programs-sqlite on line 70 of my system config fails with the error message below. I am on NixOS 24.05, and using fish as my shell. What am I doing wrong?

error:
       … while calling the 'head' builtin

         at /nix/store/qszplw617r895nbcprgyj139c9a3r0xs-source/lib/attrsets.nix:1575:11:

         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         else

       … while evaluating the attribute 'value'

         at /nix/store/qszplw617r895nbcprgyj139c9a3r0xs-source/lib/modules.nix:809:9:

          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error:
       Failed assertions:
       - Using programs.sqlite was requested but command-not-found itself is not enabled.
    ```

volkswagenfeature avatar Jul 24 '24 18:07 volkswagenfeature

I can see that you are also using nix-index - please check if you have programs.command-not-found.enable = false; (as suggested in the nix-index readme) in your config. If so, re-enable it as requested by the error message.

wamserma avatar Jul 24 '24 20:07 wamserma

I do not have nix-index enabled, and I am getting the error.

My flake

Logs:

$ nixos-rebuild switch --impure --sudo --flake ~andy3153/src/nix/nixos-rice/ --show-trace

building the system configuration...
warning: Git tree '/home/andy3153/src/nix/nixos-rice' is dirty
error:
       … while calling anonymous lambda
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/attrsets.nix:1529:14:
         1528|         zipAttrsWith (
         1529|           n: values:
             |              ^
         1530|           let

       … while calling the 'head' builtin
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/attrsets.nix:1534:13:
         1533|           if length values == 1 || pred here (elemAt values 1) (head values) then
         1534|             head values
             |             ^
         1535|           else

       … while calling anonymous lambda
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/attrsets.nix:1182:17:
         1181|         mapAttrs (
         1182|           name: value:
             |                 ^
         1183|           if isAttrs value && cond value then recurse (path ++ [ name ]) value else f (path ++ [ name ]) value

       … from call site
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/attrsets.nix:1183:85:
         1182|           name: value:
         1183|           if isAttrs value && cond value then recurse (path ++ [ name ]) value else f (path ++ [ name ]) value
             |                                                                                     ^
         1184|         );

       … while calling anonymous lambda
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:274:71:
          273|           # For definitions that have an associated option
          274|           declaredConfig = mapAttrsRecursiveCond (v: !isOption v) (_: v: v.value) options;
             |                                                                       ^
          275|

       … while evaluating the attribute 'value'
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1086:7:
         1085|     // {
         1086|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1087|       inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating the attribute 'mergedValue'
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1133:5:
         1132|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
         1133|     mergedValue =
             |     ^
         1134|       if isDefined then

       … while evaluating a branch condition
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1134:7:
         1133|     mergedValue =
         1134|       if isDefined then
             |       ^
         1135|         if all (def: type.check def.value) defsFinal then

       … while evaluating the attribute 'values'
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1127:9:
         1126|       {
         1127|         values = defs''';
             |         ^
         1128|         inherit (defs'') highestPrio;

       … while evaluating a branch condition
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1121:11:
         1120|           # Avoid sorting if we don't have to.
         1121|           if any (def: def.value._type or "" == "order") defs''.values then
             |           ^
         1122|             sortProperties defs''.values

       … while calling the 'any' builtin
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1121:14:
         1120|           # Avoid sorting if we don't have to.
         1121|           if any (def: def.value._type or "" == "order") defs''.values then
             |              ^
         1122|             sortProperties defs''.values

       … while evaluating the attribute 'values'
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1254:7:
         1253|     {
         1254|       values = concatMap (def: if getPrio def == highestPrio then [ (strip def) ] else [ ]) defs;
             |       ^
         1255|       inherit highestPrio;

       … while calling the 'concatMap' builtin
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1254:16:
         1253|     {
         1254|       values = concatMap (def: if getPrio def == highestPrio then [ (strip def) ] else [ ]) defs;
             |                ^
         1255|       inherit highestPrio;

       … while calling the 'concatMap' builtin
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1101:17:
         1100|         # Process mkMerge and mkIf properties.
         1101|         defs' = concatMap (
             |                 ^
         1102|           m:

       … while calling anonymous lambda
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1102:11:
         1101|         defs' = concatMap (
         1102|           m:
             |           ^
         1103|           map (

       … while calling the 'map' builtin
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1103:11:
         1102|           m:
         1103|           map (
             |           ^
         1104|             value:

       … while evaluating definitions from `/nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/nixos/modules/system/activation/top-level.nix':

       … from call site
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1112:80:
         1111|               }
         1112|           ) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                ^
         1113|         ) defs;

       … while calling 'dischargeProperties'
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1205:5:
         1204|   dischargeProperties =
         1205|     def:
             |     ^
         1206|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:1206:5:
         1205|     def:
         1206|     if def._type or "" == "merge" then
             |     ^
         1207|       concatMap dischargeProperties def.contents

       … while evaluating the attribute 'value'
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/modules.nix:772:21:
          771|             inherit (module) file;
          772|             inherit value;
             |                     ^
          773|           }) module.config

       … from call site
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/nixos/modules/system/activation/top-level.nix:80:26:
           79|   # Handle assertions and warnings
           80|   baseSystemAssertWarn = lib.asserts.checkAssertWarn config.assertions config.warnings baseSystem;
             |                          ^
           81|

       … while calling 'checkAssertWarn'
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/asserts.nix:193:27:
          192|   checkAssertWarn =
          193|     assertions: warnings: val:
             |                           ^
          194|     let

       … while calling the 'throw' builtin
         at /nix/store/gi1bdb5fzaqn0qhhhqwr3v46p6zndvsh-source/lib/asserts.nix:198:7:
          197|     if failedAssertions != [ ] then
          198|       throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
             |       ^
          199|     else

       error:
       Failed assertions:
       - Using programs.sqlite was requested but command-not-found itself is not enabled.
Command '['nix', '--extra-experimental-features', 'nix-command flakes', 'build', '--print-out-paths', 'git+file:///home/andy3153/src/nix/nixos-rice#nixosConfigurations."sparkle".config.system.build.toplevel', '--show-trace', '--impure', '--no-link']' returned non-zero exit status 1.

Andy3153 avatar Jun 25 '25 12:06 Andy3153

I do not have nix-index enabled, and I am getting the error.

Thank you for reporting this!

Upstream changed the default setting in https://github.com/NixOS/nixpkgs/commit/4241fb5eaeb33e8a673a547d1eb1bb2d3fc7d34f so you now have to add

programs.command-not-found.enable = true;

to your configuration.

I created https://github.com/wamserma/flake-programs-sqlite/issues/31 to keep track of this.

wamserma avatar Jun 25 '25 15:06 wamserma