mlvzk / manix

A fast CLI documentation searcher for Nix.
Mozilla Public License 2.0
361 stars 19 forks source link

Failed to load Home Manager Options cache file: Os { code: 2, kind: NotFound, message: "No such file or directory" } #17

Closed bbigras closed 4 years ago

bbigras commented 4 years ago

I don't know if it's related but I'm using home-manager.users to use home-manager in my configuration.nix. And I'm using niv so I don't have any home-manager channel.

manix 1272c45ac2b4f07c74702e8bd9417d3bbfcab56b

❯ manix notmuch                                                               nix-shell
Failed to load Home Manager Options cache file: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Here's what I found in nixpkgs: python39Packages.notmuch pkgsTargetTarget.notmuch-mutt pkgsTargetTarget.notmuch-addrlookup pkgsTargetTarget.notmuch-bower pkgsTargetTarget.notmuch python37Packages.notmuch buildPackages.notmuch-mutt buildPackages.notmuch buildPackages.notmuch-bower buildPackages.notmuch-addrlookup notmuch-mutt python3Packages.notmuch python38Packages.notmuch pkgsMusl.notmuch-bower pkgsMusl.notmuch-mutt pkgsMusl.notmuch-addrlookup pkgsMusl.notmuch pkgsBuildHost.notmuch-addrlookup pkgsBuildHost.notmuch pkgsBuildHost.notmuch-bower pkgsBuildHost.notmuch-mutt pkgsBuildTarget.notmuch-mutt pkgsBuildTarget.notmuch-addrlookup pkgsBuildTarget.notmuch pkgsBuildTarget.notmuch-bower python27Packages.notmuch vimPlugins.deoplete-notmuch __splicedPackages.notmuch-addrlookup __splicedPackages.notmuch __splicedPackages.notmuch-mutt __splicedPackages.notmuch-bower emacs27Packages.counsel-notmuch emacs27Packages.notmuch-bookmarks emacs27Packages.helm-notmuch emacs27Packages.notmuch emacs27Packages.notmuch-labeler pkgsStatic.notmuch-addrlookup pkgsStatic.notmuch-mutt pkgsStatic.notmuch-bower pkgsStatic.notmuch notmuch-addrlookup targetPackages.notmuch targetPackages.notmuch-addrlookup targetPackages.notmuch-mutt targetPackages.notmuch-bower pypyPackages.notmuch pkgsHostTarget.notmuch pkgsHostTarget.notmuch-bower pkgsHostTarget.notmuch-mutt pkgsHostTarget.notmuch-addrlookup and 38 more.
mhhf commented 4 years ago

For me it was because i didn't had home-manager in my nix channels see here

maybe this could be checked and a sane error could be written

fixed this by doing

$ nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager
$ nix-channel --update
mlvzk commented 4 years ago

I disabled the "Failed to load Home Manager Options cache file" error and added a message recommending to run mhhf's snippet when building home-manager options cache fails.

In the future I might attempt at supporting home-manager installed through configuration.nix without this workaround.

bbigras commented 4 years ago

It's weird, I still see "Failed to update Home Manager Options".

manix 0.6.2

nix-config on  master [⇕$!?] via ❄️  impure took 14s                                                                                                                                                      [5/1104]
❯ nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager && nix-channel --update
these derivations will be built:
  /nix/store/dnczh8jgdxhys9ky2m0vlqq00kggd8yy-home-manager.drv
building '/nix/store/dnczh8jgdxhys9ky2m0vlqq00kggd8yy-home-manager.drv'...
unpacking channels...
created 1 symlinks in user environment

nix-config on  master [⇕$!?] via ❄️  impure
❯ manix notmuch                                                               nix-shell
Here's what I found in nixpkgs: notmuch-bower haskellPackages.notmuch-haskell haskellPackages.notmuch-web haskellPackages.notmuch pkgsTargetTarget.notmuch-bower pkgsTargetTarget.notmuch-mutt pkgsTargetTarget.no
tmuch-addrlookup pkgsTargetTarget.notmuch notmuch-mutt pypy2Packages.notmuch pkgsBuildHost.notmuch pkgsBuildHost.notmuch-addrlookup pkgsBuildHost.notmuch-mutt pkgsBuildHost.notmuch-bower notmuch pypyPackages.no
tmuch python27Packages.notmuch pkgsBuildTarget.notmuch-mutt pkgsBuildTarget.notmuch pkgsBuildTarget.notmuch-bower pkgsBuildTarget.notmuch-addrlookup pkgsMusl.notmuch-mutt pkgsMusl.notmuch-addrlookup pkgsMusl.no
tmuch pkgsMusl.notmuch-bower pkgsStatic.notmuch pkgsStatic.notmuch-bower pkgsStatic.notmuch-mutt pkgsStatic.notmuch-addrlookup python2Packages.notmuch python38Packages.notmuch pythonPackages.notmuch pkgsHostHos
t.notmuch-mutt pkgsHostHost.notmuch-bower pkgsHostHost.notmuch pkgsHostHost.notmuch-addrlookup pkgsi686Linux.notmuch-addrlookup pkgsi686Linux.notmuch-bower pkgsi686Linux.notmuch pkgsi686Linux.notmuch-mutt pytho
n36Packages.notmuch notmuch-addrlookup buildPackages.notmuch-bower buildPackages.notmuch buildPackages.notmuch-mutt buildPackages.notmuch-addrlookup python39Packages.notmuch emacs26Packages.notmuch-labeler emac
s26Packages.notmuch emacs26Packages.notmuch-bookmarks and 38 more.

nix-config on  master [⇕$!?] via ❄️  impure
❯ manix notmuch -u                                                            nix-shell
Building Home Manager Options cache...
Failed to update Home Manager Options

Caused by:
    0: Failed to perform IO on a cache file
    1: No such file or directory (os error 2)
Tip: If you installed your home-manager through configuration.nix you can fix this error by adding the home-manager channel with this command: nix-channel --add https://github.com/rycee/home-manager/archive/mas
ter.tar.gz home-manager && nix-channel --update
Building NixOS Options cache...
Building Nixpkgs Tree cache...
Building Nixpkgs Documentation cache...
Here's what I found in nixpkgs: python36Packages.notmuch pypy27Packages.notmuch emacsPackages.counsel-notmuch emacsPackages.notmuch-labeler emacsPackages.notmuch-bookmarks emacsPackages.notmuch emacsPackages.he
lm-notmuch emacsPackagesNg.notmuch-bookmarks emacsPackagesNg.helm-notmuch emacsPackagesNg.notmuch emacsPackagesNg.counsel-notmuch emacsPackagesNg.notmuch-labeler pkgsi686Linux.notmuch-mutt pkgsi686Linux.notmuch
-bower pkgsi686Linux.notmuch-addrlookup pkgsi686Linux.notmuch pkgsHostTarget.notmuch pkgsHostTarget.notmuch-addrlookup pkgsHostTarget.notmuch-mutt pkgsHostTarget.notmuch-bower python27Packages.notmuch python39P
ackages.notmuch emacs26Packages.counsel-notmuch emacs26Packages.notmuch emacs26Packages.helm-notmuch emacs26Packages.notmuch-bookmarks emacs26Packages.notmuch-labeler __splicedPackages.notmuch __splicedPackages
.notmuch-addrlookup __splicedPackages.notmuch-bower __splicedPackages.notmuch-mutt pkgsTargetTarget.notmuch pkgsTargetTarget.notmuch-addrlookup pkgsTargetTarget.notmuch-mutt pkgsTargetTarget.notmuch-bower notmu
ch pypy3Packages.notmuch buildPackages.notmuch-addrlookup buildPackages.notmuch buildPackages.notmuch-bower buildPackages.notmuch-mutt python38Packages.notmuch pkgsStatic.notmuch-addrlookup pkgsStatic.notmuch-m
utt pkgsStatic.notmuch-bower pkgsStatic.notmuch pypyPackages.notmuch pypy2Packages.notmuch pythonPackages.notmuch pkgsHostHost.notmuch-addrlookup and 38 more.
mlvzk commented 4 years ago

@bbigras could you try running this command:

find "$(nix-build -E "{ pkgs ? import <nixpkgs> {} }:
            let
                hmargs = { pkgs = pkgs; lib = import (<home-manager/modules/lib/stdlib-extended.nix>) pkgs.lib; };
                docs = import (<home-manager/doc>) hmargs;
            in (if builtins.isFunction docs then docs hmargs else docs).options.json")"

and paste the output?

bbigras commented 4 years ago
[bbigras@desktop:~]$ find "$(nix-build -E "{ pkgs ? import <nixpkgs> {} }:
>             let
>                 hmargs = { pkgs = pkgs; lib = import (<home-manager/modules/lib/stdlib-extended.nix>) pkgs.lib; };
>                 docs = import (<home-manager/doc>) hmargs;
>             in (if builtins.isFunction docs then docs hmargs else docs).options.json")"
error: file 'home-manager/doc' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):4:32
find: ‘’: No such file or directory
mlvzk commented 4 years ago

Strange. I can't reproduce your error, not sure if I'll be able to help. Maybe try running it in a new terminal so your environment variables are updated.

bbigras commented 4 years ago

Sorry. Rebooting fixed it. I tried in a new terminal but maybe I had to log out and log back in. Thanks.