Neovim: Error installing file outside $HOME

I use this custom option to work with mkOutOfStoreSymlink:

# home.nix 
  options = {
    dotfiles = lib.mkOption {
      type = lib.types.path;
      apply = toString;
      default = "${config.home.homeDirectory}/.config/home-manager/dotfiles";
      example = "${config.home.homeDirectory}/.config/home-manager/dotfiles";
      description = "Location of the dotfiles working copy";
    };
  };

config = {
      home = rec {
      username = "sharpchen";
      homeDirectory = "/home/${username}";
      stateVersion = "24.05"; # Please read the comment before changing.
    };
};

And then use the it as interpolation:

  home.file.".config/nvim" = {
    source = config.lib.file.mkOutOfStoreSymlink "${config.dotfiles}/nvim-config";
  };

But suddenly it no longer work, looks like the interpolation was evaluated as empty string. I am pretty sure it works fine in previous build and I didn’t made relevant change

Error installing file '.config/nvim/init.lua' outside $HOME

You enabled HMs neovim module that wants to create the file from the error, though that’s not possible as the parent folder is already a symlink to the store.

2 Likes

right. It seems they moved the default from wrapper script to generated init.lua. programs.neovim.sideloadInitLua = true; resolves this. Or just use home.packages instead if one like to manage config outside nix