nix-portable
nix-portable copied to clipboard
Idea: bootsrap via direnv source_url
direnv has this cool feature to download scripts to extend direnv functionality. I use this method here in nix-direnv: https://github.com/nix-community/nix-direnv#direnv-source_url
Would you be interested in having similar functionality for nix-portable? The script could check if nix is available and if not download nix-portable (with the appropriate arch check).
Not sure if I understand correctly. The use case for this would be, if one has direnv installed, but not nix, and some .envrc requires nix, it would automatically fetch nix-portable?
What would need to change in nix-portable to make this happen? I guess it would need a default.nix that returns a single derivation? Since the current default.nix strongly depends on stuff defined in flakes.nix, it is probably best to add a flakes-compat.nix
Guess I was thinking too complicated. The script could just download the pre-built binary from github. No need to build anything on the client. That wouldn't work anyways, since it doesn't have nix to begin with.
Right. It should also check if nix is already installed and only install it otherwise.
Sounds like a good idea. I'd be happy about a PR.
But... does direnv and nix-portable actually work well together? Because nix-portable does not write stuff in /nix, and AFAIK direnv expects that path when enabling nix, isn't it? Is there a workaround I don't know? See https://github.com/direnv/direnv/issues/875