nix-community / dream2nix

Simplified nix packaging for various programming language ecosystems [maintainer=@DavHau]
https://dream2nix.dev
MIT License
976 stars 122 forks source link

Using local dependencies for development #1040

Open bmoore01 opened 2 weeks ago

bmoore01 commented 2 weeks ago

Hey I'm trying to use dream2nix to build a python application, with a single application it works however. I have a library which I also develop which is used in one of my projects. Is it possible to set dream2nix to use my local copy of the library in a 'development mode' so that i can develop both of them on my machine in parallel?

The thing is at the moment everything is using pip and I don't want to move everything to nix right away so it would be nice if i can just have a devshell for one project which uses the local python dependancy.

phaer commented 2 weeks ago

Hello,

I recently updated documentation on python development shells with pip a bit, see https://dream2nix.dev/guides/pip/#development-shells (if you haven't yet).

The devshell in that example would automatically include the generated pip.editablesShellHook.

If you set pip.editables i.e. pip.editables.my_project = "/home/user/src/my_project";, my_project will be added to your shell as an "editable install" as pip calls it. You need to use an absolute path outside nix store though, as anything inside the nix store would be immutable.

Does that help?

bmoore01 commented 2 weeks ago

That did help, thanks!