How to fetch flake in shell.nix?


I’d like to add a nix shell to a project I don’t own, for my own convenience.
I can add shell.nix file, but can I import a flake there? With the aim of providing in the shell a package that’s available as a flake output.

Alternatively I could add a flake.nix file, but this doesn’t work as I can’t add the file to repository. Is best I can do to create a separate flake and run it’s shell with something like nix run ../shell-flake/.#.default?


You may be able to use builtins.getFlake for this.

This isn’t mine, but per a search on gh you probably want something like

1 Like

oh damn! How did I miss this! thanks

1 Like