shajra / direnv-nix-lorelei

Alternative Nix extension of Direnv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add "installing with home-manager" to README

vroad opened this issue · comments

commented

I'm managing my home-manager package versions with niv, using the method described here:

https://github.com/ryantm/home-manager-template

It's worth noting that direnv-nix-lorelei can also be installed with home-manager.
I prefer this method over manual method mentioned in README, because niv allows pinning package versions in a simple manner.

niv add shajra/direnv-nix-lorelei -b master -n direnv-nix-lorelei
{ ... }:
let
  sources = import ./nix/sources.nix;
  direnv-nix-lorelei = import sources.direnv-nix-lorelei;
in
{
  home.username = "yourUserName";
  home.homeDirectory = "/home/yourUserName";

  home.stateVersion = "21.05";

  programs.bash = {
    enable = true;
  };
  programs.direnv = {
    enable = true;
    stdlib = ''
      source ${direnv-nix-lorelei.direnv-nix-lorelei}/share/direnv-nix-lorelei/nix-lorelei.sh
    '';
  };
}

I'm really apprehensive to suggesting to a user that they need to concern themself with yet another complex tool to install and configure, just to use Lorelei. If someone knows about Home-manager and is using it, is it possible that they would be advanced enough to figure out how to do what you're suggesting? Maybe the sourcing you're doing as part of Direnv configuration is kind of clever, and not something people would figure out.

Give me a moment to think about this. Maybe I'll start using home-manager and have some clarity. But if I modify this documentation to include anything about Home-manager, I'd likely update all of the READMEs for all my Nix projects. I just want these READMEs to be easy to read, and not confusing, because Nix is complex enough as it is.

commented

Maybe the sourcing you're doing as part of Direnv configuration is kind of clever, and not something people would figure out.

At least for me it was not very obvious, since I never worked with direnv's stdlib configuration. It took me a while to figure out that I could configure direnv in this way.

I could put above configuration to somewhere else such as unofficial nixos wiki, if you think that adding this to README.md is not a good idea.

commented

Or, we could provide an out-of-tree home-manager module that can be used simply by importing and enabling it.

Give me a moment to think about this. Maybe I'll start using home-manager and have some clarity. But if I modify this documentation to include anything about Home-manager, I'd likely update all of the READMEs for all my Nix projects. I just want these READMEs to be easy to read, and not confusing, because Nix is complex enough as it is.

Have you created other tools that needs installation to user's ~/.config directory, like direnv-nix-lorelei? If you have, could show me some examples?

commented

To simplify install and upgrade for existing home-manager use that don't currently use niv, I created a pull request that adds home-manager module to lorelei.
I leave it draft because I haven't add description of the module to README.

#5

Hey @vroad thanks for hanging in there. I get really busy with personal stuff and work. But I'm actually slowly migrating one of my configurations to use home-manager. So the good part is that I'll finally be able to test anything I document. So not sure if I'll use your PR or not, but I'm trying to make some forward progress resolving this issue now.

@vroad it took forever, but I did finally get a Home Manager module into the latest version of this code. I wanted to actually consume it myself, so that I could verify typos and the instructions for using it. I feel somewhat justified in that decision because I did indeed have typos and steps that didn't work as authored originally.

Anyway, it's all in the main branch now. See the top-level README.md, and the module itself under nix/home.nix. The module is unsurprisingly close to what you submitted. It's not like there's a lot of room for innovation when it comes to laying down a single symlink. Differences were just naming/wording to meet my own preferences.

Closing this ticket now. Feel free to reopen or open another if there's a problem.