Questions tagged [nix-shell]
29 questions
7
votes
2 answers
Equivalent of passing `-p zlib` argument to `nix-shell` in `shell.nix`
If I build my Haskell project under nix-shell it gives error about missing zlib.
If I build the project in nix-shell using nix-shell -p zlib then the project sees zlib and builds successfully.
How can I add the zlib package to shell.nix file so that…

Răzvan Flavius Panda
- 21,730
- 17
- 111
- 169
6
votes
2 answers
How to install postgresql-client / psql on Nixos
I'm wondering how to install the psql command on NixOS. To be clear: I'm only interested in the client, not the server.
I've looked at the derivation but couldn't find any pointers.
Is there a way to create a derivation without building from…

Melle
- 7,639
- 1
- 30
- 31
4
votes
3 answers
What is the `nix-shell` equivalent of `nix-env -f -iA ...`?
Or is this only possible by writing a custom shell.nix?
Where path-to-my-local-nixpkgs-repo is a directory with a default.nix file containing a valid Nix expression. This directory may hold one's personal collection of Nix packages or a local clone…

toraritte
- 6,300
- 3
- 46
- 67
4
votes
1 answer
What is the equivalent shell.nix for nix-shell '' -A gnused
I am trying to explore the gnu sed code base.
I can do this from the command line:
nix-shell '' -A gnused
unpackPhase
cd sed-4.8
configurePhase
buildPhase
and then edit the code under sed etc
However, I would like to use ctags which is not…

potong
- 55,640
- 6
- 51
- 83
4
votes
1 answer
What's the shortest `shell.nix` equivalent of the following cmdline arguments?
What's the shortest shell.nix equivalent of the following cmdline arguments?
nix-shell -p "haskell.packages.ghc865.ghcWithPackages (p: [p.ghci-pretty])"
This works, but it's verbose:
# contents of shell.nix file
# run with the following cmd:
#…

v217
- 765
- 1
- 6
- 17
3
votes
1 answer
Change nix-build's TMPDIR from shell.nix
I'm trying to use nix-shell with a shell.nix file to get a clean development environment but I don't know how to change the location of the temporary build directories.
The buildInputs packages are built in /tmp but this path doesn't have enough…

Michaël Witrant
- 7,525
- 40
- 44
3
votes
1 answer
How to run `corepack enable` to install Yarn berry?
For modern versions of Yarn, aka Yarn Berry, the preferred installation is through Corepack, and Corepack is included by default with Node.js installs (>=16.10). See https://yarnpkg.com/getting-started/install
This is what I've tried to do corepack…

mitchelllc
- 1,607
- 4
- 20
- 24
3
votes
2 answers
Nix: How a derivation sets up PATH in nix-shell without calling builder?
A derivation takes lots of arguments but only one of them, builder, is executable right?
And nix-shell doesn't really execute the builder, which means there's no way of running commands such as export PATH=....
But I found some other derivations…

Ingun전인건
- 672
- 7
- 12
3
votes
0 answers
Launching IDE directly from nix-shell
I am new to NixOs and nix-shell and am still getting to know its idioms. Right now I have a Java project which I am using nix-shell via direnv to load up the build tool chain, including a jdk and bazel.
I would like the IDE - in my case ItelliJ - to…

Ben Tomasini
- 33
- 5
3
votes
0 answers
nix-shell slow execution of program
I am working with clash (haskell -> verilog) compilation the demo project at https://github.com/mheinzel/clash-yosys-demo provides both a nix branch and one using stack.
running
time clash -v --verilog src/Top.hs -outputdir build
takes
~ 1m if I…

epsilonhalbe
- 15,637
- 5
- 46
- 74
2
votes
1 answer
Can I start nix-shell with packages from different revisions?
I can start nix-shell with a package from a particular revision, e.g.
nix-shell -p ktlint -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/141439f6f11537ee349a58aaf97a5a5fc072365c.tar.gz
nix-shell -p jq -I…

Matt R
- 9,892
- 10
- 50
- 83
2
votes
1 answer
configuring fish shell prompt inside nix-shell
I tried following the steps here to configure the prompt: https://nixos.wiki/wiki/Fish
Combined with the information here about the location and content of a basic file: https://fishshell.com/docs/current/faq.html#how-do-i-set-my-prompt
If I…

Răzvan Flavius Panda
- 21,730
- 17
- 111
- 169
2
votes
1 answer
Is it possible to break up a long `#! nix-shell -p` line into multiple lines?
Is it possible to break up a long #! nix-shell -p line into multiple lines?
Example:
#!/usr/bin/env nix-shell
#! nix-shell -p "haskell.packages.ghc822.ghcWithPackages (p: with p; [lens text bytestring hspec brick async])"
#! nix-shell -i…

Wizek
- 4,854
- 2
- 25
- 52
2
votes
1 answer
How to use already installed ghc with stack inside nix-shell?
I have already installed ghc using stack build tool. It compiles my project. But when I enter nix-shell inside project directory and want to compile my project from nix-shell I see error like this:
No compiler found, expected minor version match…

Shersh
- 9,019
- 3
- 33
- 61
1
vote
0 answers
Error when managing pinned Nix packages using niv
I'm starting to learn how to use nix-shell in order for me to have reproductibles envs for dev and devops operations.
I'm trying to have a shell.nix file with pinned packages version (kustomize v3.6.1, git X.Y.Z etc.), but I can't make it work.…

hacb
- 175
- 2
- 10