Comments (2)
Shells created by nix shell
are, confusingly, entirely different from those created by nix-shell
and nix develop
. The latter two create development shells, aka "the shell for building X package", the former creates "the shell for using X package"
Try using nix develop
See also: #4715
from nix.
Thanks I forgot to mention this thread (I have read before opening this issue). IIRC it also mentioned shellHooks that was not called so I opened this issue to track it. I understand the difference between the three:
- nix develop nixpkgs#X and then genericBuild build package X in the env in the sandbox without sandbox limitations
- nix-shell ./shell.nix with often mkShell put us in the building shell (but since mkShell is a fake builder it doesn build)
- nix shell nixpkgs#python3 does add python3 binary in path but it only import binary without hook to expose library.
with nix-shell we could do nix-shell -p 'python3.withPackages(p:[p.diagrams])'
and it create a python with a usable library. It is not a syntax usable with flake (that expect only attribute and not a function with args: we can't use --args/--argstr)
Here is the issue:
The documentation explain "the shell for using X package" but should be "the shell for using X binary package" or allow to also use library.
Try using
nix develop
nix shell nixpkgs#python3Packages.diagrams
only a non-existent path:
$ nix shell nixpkgs#python3Packages.diagrams --command sh -c 'env | grep diagrams'
PATH=/nix/store/ilnk4wsnfppadn74apcfbbcpj4a1f3zi-python3.11-diagrams-0.23.4/bin:...
$ ls /nix/store/ilnk4wsnfppadn74apcfbbcpj4a1f3zi-python3.11-diagrams-0.23.4/bin
ls: cannot access '/nix/store/ilnk4wsnfppadn74apcfbbcpj4a1f3zi-python3.11-diagrams-0.23.4/bin': No such file or directory
only python3: I get callable python
and both:
$ nix shell nixpkgs#python3 nixpkgs#python3Packages.diagrams --command sh -c 'env | grep diagrams; python3 -c "import diagrams"'
PATH=/nix/store/ilnk4wsnfppadn74apcfbbcpj4a1f3zi-python3.11-diagrams-0.23.4/bin:/nix/store/7wz6hm9i8wljz0hgwz1wqmn2zlbgavrq-python3-3.11.8/bin:...
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'diagrams'
I have tried hard before opening issue (but since I did many test I didn't put them all because I forgot)
from nix.
Related Issues (20)
- dont ignore the CFLAGS from pkg-config check for libseccomp. HOT 4
- Darwin installer: create a case sensitive APFS volume HOT 4
- run nix in a non root container in openshift - restricted SCC HOT 5
- `nix build` breaks inside `nix develop`
- install.in: fails to run the installer with `noexec` HOT 2
- `nix build --system` don't use remote builder HOT 6
- `StoreReference` -> `<Name>StoreConfig` -> `<Name>Store` HOT 1
- Error when installing Nix on my linux distro: useradd: UID 30012 is not unique HOT 2
- Add `:doc` to repl with `nix-doc`
- Crash with static nix if HOME is owned by a different user HOT 2
- `fetchGit` with a fixed rev and no ref repeatedly hits the network HOT 1
- Build error: no matching conversion for functional-style cast from 'std::string' HOT 2
- Include a sysusers config file and a user tmpfiles config file HOT 3
- Renaming a vcs/flake controlled directory doesn't correctly update the store
- Have our cake and eat it too derivation metadata HOT 2
- SSL certificate path does not propagate to builds during `nix-build` HOT 10
- Test repl completions HOT 4
- Removing static IP Configuration doesnt initiate dhcp renewal HOT 1
- the documentation of `nix_setting_get` requires calling `nix_libutil_init`, which achieves nothing HOT 1
- Issue with nix installation - syntax error *env-manifest.next1:1 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nix.