Repository navigation
command-not-found: enable and default to channel release's dbPath - #489532
Conversation
ec2541b to
203a8fb
Compare
f881bb6 to
b1e2630
Compare
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
| config = lib.mkMerge [ | ||
| { | ||
| programs.command-not-found = { | ||
| enable = lib.mkDefault (builtins.pathExists cfg.dbPath); |
There was a problem hiding this comment.
Is that IFD import-from-derivation?
There was a problem hiding this comment.
I'm afraid yes, I just checked nix's documentation and this fits the description of what IFD is. See the reply below.
I heard that IFD is disabled to make hydra work better. Does that constraint apply to NixOS as well?
There was a problem hiding this comment.
@SuperSandro2000 Actually, it's not IFD. I was confused about CppNix's documentation about what IFD is.
I asked on nixos discourse here and was told that importing a store path is not the same as importing a derivation (constructed with builtins.derivation), and is not an IFD.
Furthermore, I have tested to evaluate the module change with allow-import-from-derivation set to false. The evaluation proceeded correctly.
$ nix repl -f test.nix --option allow-import-from-derivation false
Lix 2.93.3
Type :? for help.
Loading installable ''...
Added 11 variables.
nix-repl> config.programs.command-not-found
{
dbPath = /home/leana/wt/NixOS/nixpkgs/enable-command-not-found/programs.sqlite;
enable = true;
}
nix-repl>
There was a problem hiding this comment.
This will be IFD if nixpkgs was imported via FOD, instead of builtin fetchers. But in that case, already evaluating this module would be IFD, so it doesn't make a difference AFAIU.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
DavHau
left a comment
There was a problem hiding this comment.
reviewed the changes, but didn't test it.
| config = lib.mkMerge [ | ||
| { | ||
| programs.command-not-found = { | ||
| enable = lib.mkDefault (builtins.pathExists cfg.dbPath); |
There was a problem hiding this comment.
This will be IFD if nixpkgs was imported via FOD, instead of builtin fetchers. But in that case, already evaluating this module would be IFD, so it doesn't make a difference AFAIU.
c52a716 to
9f8ffcc
Compare
21c44fd to
93e8c9e
Compare
|
@DavHau I made the requested changes, could this be merged before the upcoming 26.05 release? Thanks :) |
|
@NixOS/nixos-release-managers I think this would be great to get back into NixOS for 26.05. What do you think? |
|
From a release manager's perspective, there is nothing holding us back from introducing this again for 26.05, as we are not in the feature freeze yet. |
|
@yayayayaka sorry for the ping, but it's been a while and the deadline to restrict all breaking changes is near. Are there any plans to merge this? Thank you! |
yayayayaka
left a comment
There was a problem hiding this comment.
Diff is looking fine by me. I think we can get this in.
|
This causes eval failure: Fix in: #512102 |
…ttps://discourse.nixos.org/t/psa-use-nixos-org-tarballs-for-your-flake-inputs/79950, this also enables `programs.command-not-found`: NixOS/nixpkgs#489532 * rename the GitHub username in flake url `github:vic/*` to `denful`: denful/import-tree#29 @ inputs.nix
NixOS module "command-not-found" was disabled in #416425 because it didn't integrate out-of-the-box with flakes. This PR resolves this issue by pointing
dbPathto the programs.sqlite in the nixpkgs sources.Concretely:
Implementation details
programs.command-not-found.dbPathnow points to the database in the nixpkgs source (likely in the store). Only if this database exists,programs.command-not-found.enablewill default to true. This also guarantees that the script uses the programs.sqlite database of the very same nixpkgs used to evaluate the system, providing more coherent results out-of-the-box.I tested this by copying a
programs.sqliteto the root of nixpkgs, similar to a release expression. The fish handler for unknown command builds and works correctly.If this patch is accepted, we would need to revert #438654 which disables command-not-found for a perl-less build.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.