-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples: add simple pip devShell example #789
base: main
Are you sure you want to change the base?
Conversation
oh no there are some buildbot fails, will look into them but am unsure of them. I think I need to properly format my files? Any advice appreciated. |
Just run 'nix fmt' |
6f9d317
to
289b89a
Compare
After looking into it further, I don't think that this example is allowable into the repo. I say this because of this buildbot check https://buildbot.nix-community.org/#/builders/222/builds/2 It is expecting each of the example flakes to have an output So maybe I should put my example in a seperate area of Or is there some workaround. My original thinking with only exposing devShell and lock was that because I sort of use a hack with
which would normally cause an error when you try to use the package itself returned by So I only want to expose the devShell and the lock to prevent that possible "misuse". Either way, I am curious on your thoughts of the "hack" |
Hi @DavHau ! I see this module nodejs-devshell-v3 has been added in this commit c25e889 Thanks :) |
I'm not sure to be honest. What we don't want for sure is having two separate dependency specifications or two separate lock files. If we make it individul modules we kind of rely on the user to set the options for dependencies correctly. Though there is a use case where one wants only a dev shell but not a package and that should be covered. |
I feel like a good usage interface could be to clearly expose the lock-file-parsing parts of the modules that deal with them from the dream2nix library. Something like evalModules but it only works on the lock file level? This way (in my use case) I could just have a repository of lock files representing different versions of dependencies I need, and a flake that just calls that "parseLock" function to get the devShell. parseLock could return other things as well. Idk if this could possibly work, given that more information may be needed at build time such as the drv overrides and stuff, so maybe you'd also have to supply that information too. |
Though I'm not sure the utility of this as opposed to just doing the "hack". Because the hack honestly works fine too, you just have to explicitly not expose the package just the devshell/lock. Instead of a "parseLock", there could just be a wrapper around evalModules that only exposes "meta" things like .lock, .devShell, maybe other things too that I'm unaware of. Or alternatively, just add a warning/error that warns you if you try to use the package without a proper mkDerivation. So you can still use the non package things like devShell but the moment you try to evaluate the package you get a descriptive error instead of a vague one |
289b89a
to
04f8bdc
Compare
What about adding a default package that is just a |
@yajo That is a good idea I think. I'm unware of editable packages though, still fairly new to nix. Could you please link some documentation if you have the time? I could only find some information about this for python packages (NixOS/nixpkgs#11957) but I'm unsure about it. |
Well, the common way of developing python projects is to run In a dream2nix devshell I'd expect the same to happen. But for that, the shell should run |
To test, navigate to the
python-devShell-hello
directory and runnix develop .#devShells.x86_64-linux.hello
. You will drop into a dev shell with python3.10 and pip package cryptography 41.0.5 available.I wanted to include an example to showcase the devShell attribute of a dream2nix package. Specifically with pip module, though it should be possible to do this with more modules.
I am open to any critiques as I am unsure myself if this is the best way to go about accomplishing this.
Thank you!