`self` input for flakes in sub directories

I am trying to understand why the self input seems to behave differently in my flake depending on how I call it. I have created a reproducible example here:

The README.md explains that when flake.nix is in a sub directory of a git repository the path of self is different depending on how it is called.

I would greatly appreciate any help in understanding what I’m missing :bowing_man:


1 Like

I hate to do this but… ping

I’m guessing getFlake has different behaviour than referring to . with :lf. One loads the flake as part of a directory and other recognizes it is a git repository, so it bases everything on the root of the repo?

I do agree, this is quite confusing. Might even be good to open an issue about this on github.com/nixos/nix ?

Then again, flakes are still ‘experimental’ :sweat_smile:

1 Like

Thanks @bobvanderlinden. For reference, issue filed.

1 Like