Skip to content
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

nix-shell -p hello, does not work. #18970

Closed
LinArcX opened this issue Feb 9, 2020 · 10 comments
Closed

nix-shell -p hello, does not work. #18970

LinArcX opened this issue Feb 9, 2020 · 10 comments
Labels
bug Something isn't working

Comments

@LinArcX
Copy link
Contributor

LinArcX commented Feb 9, 2020

System

  • xuname:
    Void 5.4.15_1 x86_64 GenuineIntel notuptodate hold rrDDDFFF
  • package:
    nix-2.3.2_2

Expected behavior

I want to see a properly working hello example of nix package manager without any issue.

Actual behavior

After installing nix package, if you try to use: nix-shell -p hello, it'll produce this error:

warning: Nix search path entry '/home/linarcx/.nix-defexpr/channels' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13

If you try it with sudo:
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:13

Also, whenever you want to login again, you'll we see this message:
Also when i restart and login again in my system, it says:

mkdir: cannot create directory '/nix/var/nix/profiles/per-user/linarcx': Permission denied
WARNING: bad ownership on /nix/var/nix/profiles/per-user/linarcx

Steps to reproduce the behavior

  1. Install nix package
  2. re-login
@LinArcX
Copy link
Contributor Author

LinArcX commented Feb 9, 2020

cc @xtraeme

@LinArcX
Copy link
Contributor Author

LinArcX commented Feb 9, 2020

You mean here?
https://nixos.org/nix/manual/#chap-installation

But it gives me errors:

╰   sh <(curl https://nixos.org/nix/install) --no-daemon
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2399  100  2399    0     0   2403      0 --:--:-- --:--:-- --:--:--  2401
downloading Nix 2.3.2 binary tarball for x86_64-linux from 'https://nixos.org/releases/nix/nix-2.3.2/nix-2.3.2-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.iXZZCLO5FP'...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15.1M  100 15.1M    0     0   373k      0  0:00:41  0:00:41 --:--:--  418k
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
/proc/self/fd/11: failed to unpack 'https://nixos.org/releases/nix/nix-2.3.2/nix-2.3.2-x86_64-linux.tar.xz'

If you mean this part:
https://nixos.org/nix/manual/#ch-basic-package-mgmt

I got these errors:

 nix-channel --update                      
unpacking channels...
while setting up the build environment: executing '/usr/bin/bash': No such file or directory
builder for '/nix/store/b8l4jqfrjdpb1mji2p162bbw98zia0lp-nixpkgs-20.03pre211998.57ed5db343f.drv' failed with exit code 1
error: build of '/nix/store/b8l4jqfrjdpb1mji2p162bbw98zia0lp-nixpkgs-20.03pre211998.57ed5db343f.drv' failed
error: program '/usr/bin/nix-env' failed with exit code 100

@yopito
Copy link
Contributor

yopito commented Feb 9, 2020

Read the log you copy/paste: you probably missing xz (case #1) and bash (case #2)

@LinArcX
Copy link
Contributor Author

LinArcX commented Feb 9, 2020

Read the log you copy/paste: you probably missing xz (case #1) and bash (case #2)

So, what can I do?

@mephistopheles-8
Copy link

mephistopheles-8 commented Feb 13, 2020

I also had issues getting Nix to work out-of-the box on Void.

The problems with bash and xz stem from those programs not being linked in the Nix sandbox. I temporarily added build-use-sandbox=false to /etc/nix/nix.conf before running nix-channel --update for the first time. It seems to work now.

There is an option, build-sandbox-paths, that may be of interest. Mine is set to the following, but I've only done limited testing and have not verified that it matters:

build-sandbox-paths = /bin/sh=/bin/sh /usr/bin/bash=/usr/bin/bash /usr/bin/bzip2=/usr/bin/bzip2 /usr/bin/env=/usr/bin/env /usr/bin/gzip=/usr/bin/gzip /usr/bin/mkdir=/usr/bin/mkdir /usr/bin/mv=/usr/bin/mv /usr/bin/tar=/usr/bin/tar /usr/bin/tr=/usr/bin/tr /usr/bin/xz=/usr/bin/xz

The following might be relevant:
NixOS/nix#3337
NixOS/nix#2673
https://github.com/asppsa/archlinux-nix

@kt0d
Copy link

kt0d commented Mar 19, 2020

I had exactly the same problem, but thanks to @mephistopheles-8's suggestion, I managed to run hello example. What I did:

  • add myself to nixbld group
  • enable nix-daemon: ln -s /etc/sv/nix-daemon/ /var/service/
  • add build-use-sandbox = false to /etc/nix/nix.conf
  • add nixpkgs-unstable channel: nix-channel --add http://nixos.org/channels/nixpkgs-unstable nixpkgs

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants
@LinArcX @yopito @mephistopheles-8 @kt0d and others