Closed shoo8eem1A closed 11 months ago
How do you keep this directory up-to-date? Something that uses fetchTarball might be more sustainable.
How do you keep this directory up-to-date?
My system's configuration is within a Git repository containing many Git submodules:
At least once a week, I do a git fetch --recurse-submodules
, update each module with new commits, and do a home-manager switch
. If everything is fine, I commit the result.
If you think a version of the code above should be added to the README, I can adapt it to use a tarball before opening a PR.
With https://github.com/nix-community/nix-index-database/pull/81/files we have move part of the module configuration into flake.nix. As such there is no way to use this without using the flake interface.
What you can do is importing packages.nix and than create your own nix-index wrapper: https://github.com/nix-community/nix-index-database/blob/main/packages.nix. But I wouldn't consider this an optional, stable interface (also it's not very likely to change any time soon.).
@Mic92. I have changed the above snippet to:
{ ... }:
let databases = (import ../../nix-index-database/packages.nix);
in {
imports = [
((import ../../nix-index-database/home-manager-module.nix) {
inherit databases;
})
];
# Provides Bash's command-no-found and a nix-index command:
programs.nix-index = { enableBashIntegration = true; };
programs.nix-index-database.comma.enable = true;
}
Is there a problem with this approach?
@Mic92. I have changed the above snippet to:
{ ... }: let databases = (import ../../nix-index-database/packages.nix); in { imports = [ ((import ../../nix-index-database/home-manager-module.nix) { inherit databases; }) ]; # Provides Bash's command-no-found and a nix-index command: programs.nix-index = { enableBashIntegration = true; }; programs.nix-index-database.comma.enable = true; }
Is there a problem with this approach?
No but you might have to manually upgrade this when we change the implementation.
@shoo8eem1A I just merged #86 which means that you won't have to pass the databases manually to the modules anymore.
So when you update, you can leave off that part and just import the module directly.
{
imports = [
../../nix-index-database/home-manager-module.nix
];
programs = { ... };
}
Since https://github.com/nix-community/nix-index-database/commit/ca7e10c63d06c7a66d58a1db48b3ba3bd1fd0adf, this no longer works
That's unfortunate. Maybe we should restore that functionality, I think it's useful.
The current README explains how to setup nix-index-database with home-manager and flake. But flake is still experimental and some of us (me included) have not enabled it yet.
I think I managed to setup nix-index-database with home-manager and no flake with the following code. Is it something we should add to the README? Is there any problem with this code?