Every time I enter nix-shell, I need to execute the following command, otherwise nix-build and other nix-* commands are not found.

source /home/xxx/.nix-profile/etc/profile.d/nix.sh

I have added the following into file ~/.profile, but it does not seem to be working.

if [ -e /home/xxx/.nix-profile/etc/profile.d/nix.sh ]; then source /home/xxx/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer

What's the reason for that? How can I get source /home/xxx/.nix-profile/etc/profile.d/nix.sh automatically when I run nix-shell?

  • Welcome to Cardano SE! As a new user be sure to take the Tour. Also, this seems to be a nix question rather than a Cardano question and it should not be on this site if that is the case.
    – gRebel
    Commented Jan 16, 2022 at 3:45
  • This is fairly odd and should not happen. nix-shell would know how to set your profile. So what you are saying is it works in your regular shell, but fails in nix-shell. Can you please provide more info around the context? What system do you run on, ...?
    – angerman
    Commented Jan 16, 2022 at 13:44
  • Yes, context information is going to be essential to find the problem here. Perhaps the shell is overwritting the PATH a bit too aggresively. If you have a link or a relevant snippet from the shell.nix, please share
    – nrdxp
    Commented Jan 16, 2022 at 20:26
  • Thanks @nrdxp! I'm running on Ubuntu, I run shell.nix from plutus-apps, should I change the this file somehow?
    – Cyrus
    Commented Jan 17, 2022 at 12:11
  • Hi @gRebel, I had this problem when I run plutus-apps for plutus pioneer program.
    – Cyrus
    Commented Jan 17, 2022 at 12:13

1 Answer 1


I had trouble getting the plutus playground environment to run properly until I followed the directions in this link https://docs.plutus-community.com/docs/setup/Ubuntu.html and first did the uninstall at the bottom of the page and did the re-install (as explained on the same page from the link provided above) for multiple-user. The multi-user version is recommended on the actual Nix website. When I got to this line "Note If you will be working on the Plutus Pioneer Project, it will be necessary at this point to git checkout ... a specific commit to match the class materials. That commit hash is listed in the exercises week## directory in the cabal.project", I followed along with the tutorial listed below to compile the "English Auction" code from week01: https://youtu.be/zPaDp4R9X7o?t=177 Your folders might vary from the instructors, so listen carefully to where you clone the repositories he mentions.

  • Thanks! I'm aware of the specific commit for the repo, like I said everything works after I do source /home/xxx/.nix-profile/etc/profile.d/nix.sh each time entering nix-shell. I believe the path environment somehow is overwritten incorrectly after nix-shell, but don't know where to change it.
    – Cyrus
    Commented Jan 17, 2022 at 12:20
  • Perhaps related, I think I must have installed Nix twice, or a build or shell, still learning, but I think I created two different profile-link-1 and profile-link-2 in the directory /nix/var/nix/profiles/per-user/<username>. When I do a nix doctor --verbose I was getting a multiple versions fail (cardano.stackexchange.com/questions/6648/…). Maybe someone smarter than me can help on how this happens, and if linked.
    – TheStophe
    Commented Jan 20, 2022 at 2:41
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jan 22, 2022 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.