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

Manual's build example doesn't build #2259

Closed
pushcx opened this issue Jun 27, 2018 · 19 comments
Closed

Manual's build example doesn't build #2259

pushcx opened this issue Jun 27, 2018 · 19 comments

Comments

@pushcx
Copy link

pushcx commented Jun 27, 2018

Chapter 13. A Simple Nix Expression (from doc/manual/expressions/simple-expression.xml) introduces building packages with a worked example of building GNU hello. I attempted to use this to learn to build nix packages and was unable to build the package. I don't know where I went wrong, so this bug report is something of a step-by-step. (For context, I'm a longtime professional linux sysadmin and developer who's totally new to nix. I was able to set up a NixOS box from its manual to play around with.)

The chapter is structured around three steps: writing a nix expression (13.1), writing a build script (13.2), and adding the package (13.3).

13.1 doesn't explain where to create default.nix, but from the note "It is customary to place each package in a separate directory" I figured I should create a test directory with this default.nix in it. In 13.2 I also put builder.sh in this directory.

Then instead of the section heading for 13.3 ("Arguments and Variables") matching the third bullet point in the intro, it's kind of a random name. It talks about editing all-packages.nix but the syntax is invalid. As a newbie, I don't have the experience to fill in ... so the example is unusable. Additionally it talks about editing pkgs/top-level/all-packages.nix like that directory already exists, and the only file by that name that find turned up is /nix/store/ilagh0i1vxhp68hd9r73lh0f2mjqbj5x-nixos-18.09pre143771.a8c71037e04/nixos/pkgs/top-level/all-packages.nix. The description of the nix store in 5.3 has a wishy-washy warning against editing files in /nix/store and I don't see any way to regenerate that hash (or maybe I don't need to? The introduction to the hash at the top of chapter 1 says it's only based on dependencies, not contents). Still, it isn't clear at all what I'm supposed to be doing to what file, or why this is required for building hello.

Then section 13.4 starts "You can now try to build Hello." and nix-build -A hello looks like it's assuming I put those files in a directory named hello, though after renaming my directory I got the error error: getting status of '/home/pushcx/default.nix': No such file or directory from outside the directory and from inside I got error: cannot auto-call a function that has an argument without a default value ('stdenv') (with no file name or line-number). The error message is useless because I'm trying to build a package, not auto-call a function, and "auto-call" does not appear in the manual. I don't see anything more to experiment with to try to fix this.

After chatting with infinisil in #nixos, I think the two causes of my confusion are:

  1. The manual does not provide a complete, worked example of building a package.
  2. The manual conflates building a package and contributing publicly to nixpkgs.

He suggested (via the bot, so is this a frequent problem?), "If a Nix file ./foo.nix starts with something like { bar, baz }:, you can build it with nix-build -E '(import <nixpkgs> {}).callPackage ./foo.nix {}'" This doesn't match the description of callPackage in the manual, which only explains callPackage as something you'd write in all-packages.nix rather than a command-line tool. And it doesn't account for writing a builder.sh.

Additionally, it would probably be worthwhile for someone on the team to watch a newbie try to work through the doc without answering any questions, because this wasn't the first issue I had to puzzle out, just the issue I couldn't puzzle out.

@vaibhavsagar
Copy link
Member

It is frustrating that the example in the manual doesn't build, especially when only small changes are required to default.nix:

let
  pkgs = import <nixpkgs> {};
in
pkgs.stdenv.mkDerivation {
  name = "hello-2.1.1";
  builder = ./builder.sh;
  src = pkgs.fetchurl {
    url = ftp://ftp.nluug.nl/pub/gnu/hello/hello-2.1.1.tar.gz;
    sha256 = "1md7jsfd8pa45z73bz1kszpp01yw6x5ljkjk2hx7wl800any6465";
  };
  perl = pkgs.perl;
}

@pushcx
Copy link
Author

pushcx commented Jul 4, 2018

Thanks very much for the improvement, @vaibhavsagar, I can see how this looks more like a complete example. What command are you using to build? Do you have it in a hello directory? Are you running nix-build from within that directory, or a parent? Are you able to run nix-shell or nix-env?

(Asking because I've tried a bunch of variations like nix-build -A hello and nix-build -A . with no luck.)

@pushcx
Copy link
Author

pushcx commented Jul 4, 2018

I sort of got it to start a build, but got a strange failure out of configure. I tried to run nix-shell because that seemed like the right tool but it also lacks newbie docs. There's a section over in the "nixpkgs" manual (though I'm not trying to contribute to a public package so I don't understand why it's there) but its description of "phases" don't at all match what's present in the shell and lead to a whole 'nother set of bugs and underdocumented topics. One again, I don't see any way forward with building a package.

I appreciate the folks who've tried to help, but I've reached my limit of time and frustration on this experiment. I'm unsubscribing from this issue; I don't know what your project standards are around closing or keeping issues open, so I'll leave it to a contributor to handle.

@vaibhavsagar
Copy link
Member

Oops, that's meant to go in a default.nix file that you then run by executing nix-build default.nix or just nix-build (which looks for a default.nix if no filename is provided).

@cmal
Copy link

cmal commented Nov 15, 2018

@vaibhavsagar Hi, Thanks for your fix. I am stepping over the errors mentioned by the original author. I am using nix-build default.nix to build GNU Hello, but still errors:


...
...
make[2]: Entering directory '/private/tmp/nix-build-hello-2.1.1.drv-0/hello-2.1.1/src'
source='hello.c' object='hello.o' libtool=no \
depfile='.deps/hello.Po' tmpdepfile='.deps/hello.TPo' \
depmode=gcc3 /nix/store/n9hba031gjky8hpjgx9fnlaxhidyzxbz-bash-4.4-p23/bin/bash ../depcomp \
clang -DLOCALEDIR=\"/nix/store/vh1c9dv71ggh4viyvlvjr4gbvvnv6az8-hello-2.1.1/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I. -I. -I.. -I../intl -I../intl    -g -O2 -c `test -f 'hello.c' || echo './'`hello.c
hello.c:332:17: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
        printf (_("hello, world\n"));
                ^~~~~~~~~~~~~~~~~~~
hello.c:47:19: note: expanded from macro '_'
#define _(String) gettext (String)
                  ^~~~~~~~~~~~~~~~
hello.c:332:17: note: treat the string as an argument to avoid this
        printf (_("hello, world\n"));
                ^
                "%s",
hello.c:47:19: note: expanded from macro '_'
#define _(String) gettext (String)
                  ^
hello.c:340:10: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
        printf (_("\
                ^~~~
hello.c:47:19: note: expanded from macro '_'
#define _(String) gettext (String)
                  ^~~~~~~~~~~~~~~~
hello.c:340:10: note: treat the string as an argument to avoid this
        printf (_("\
                ^
                "%s",
hello.c:47:19: note: expanded from macro '_'
#define _(String) gettext (String)
                  ^
2 errors generated.
make[2]: *** [Makefile:199: hello.o] Error 1
make[2]: Leaving directory '/private/tmp/nix-build-hello-2.1.1.drv-0/hello-2.1.1/src'
make[1]: *** [Makefile:175: all-recursive] Error 1
make[1]: Leaving directory '/private/tmp/nix-build-hello-2.1.1.drv-0/hello-2.1.1'
make: *** [Makefile:131: all] Error 2
builder for '/nix/store/6h7c2np6z1j29fci1ck721q1x8s533qw-hello-2.1.1.drv' failed with exit code 2
error: build of '/nix/store/6h7c2np6z1j29fci1ck721q1x8s533qw-hello-2.1.1.drv' failed

How can I fix this?

$ uname -a                                                                                                   
Darwin xxx.local 18.2.0 Darwin Kernel Version 18.2.0: Fri Oct  5 19:41:49 PDT 2018; root:xnu-4903.221.2~2/RELEASE_X86_64 x86_64

@vaibhavsagar
Copy link
Member

These look like macOS-specific issues with clang. I don't think I can help.

@gloaming
Copy link

gloaming commented May 3, 2019

Out of curiosity I tried to reproduce this by building with clang on NixOS, but it works fine, even though the same warnings are enabled. I would guess that the compiler has special logic for the use of gettext that doesn't work on Darwin for some reason, maybe.

@cmal Could you try with this line inside the mkDerivation?

hardeningDisable = stdenv.lib.optional stdenv.isDarwin "format";

Relevant links I found:
NixOS/nixpkgs#12895
https://fedoraproject.org/wiki/Format-Security-FAQ

@mawis
Copy link

mawis commented Jun 6, 2019

I also have problems just at this very basic point of trying to learn how to write packages. I was following the manual with the same problems as the original author of this issue. Indeed it is very frustrating if even the hello world example in the documentation cannot be build.

With the changes in default.nix mentioned above I came a bit futher. (Thanks @vaibhavsagar ). Still it doesn't build successfully. I get the following error message:

[…]
source='getopt1.c' object='getopt1.o' libtool=no \
depfile='.deps/getopt1.Po' tmpdepfile='.deps/getopt1.TPo' \
depmode=gcc3 /nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash ../depcomp \
gcc -DLOCALEDIR=\"/nix/store/qwqg5ah3n4wg29h4m1h65b4sxbydk3v0-hello-2.1.1/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I. -I. -I.. -I../intl -I../intl    -g -O2 -c `test -f 'getopt1.c' || echo './'`getopt1.c
gcc  -g -O2   -o hello  hello.o version.o getopt.o getopt1.o
make[2]: Leaving directory '/build/hello-2.1.1/src'
Making all in man
make[2]: Entering directory '/build/hello-2.1.1/man'
help2man --name="Friendly Greeting Program" ../src/hello >hello.1
/nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash: help2man: command not found
make[2]: *** [Makefile:282: hello.1] Error 127
make[2]: Leaving directory '/build/hello-2.1.1/man'
make[1]: *** [Makefile:175: all-recursive] Error 1
make[1]: Leaving directory '/build/hello-2.1.1'
make: *** [Makefile:131: all] Error 2
builder for '/nix/store/mvg07i5xl1g71bpj7ic9q2r1wrh2565v-hello-2.1.1.drv' failed with exit code 2
error: build of '/nix/store/mvg07i5xl1g71bpj7ic9q2r1wrh2565v-hello-2.1.1.drv' failed

Maybe I should also mention, that I changed the hash value in default.nix to c510e3ad0200517e3a14534e494b37dc0770efd733fc35ce2f445dd49c96a7d5 is this is the sha256sum I get for ftp://ftp.nluug.nl/pub/gnu/hello/hello-2.1.1.tar.gz

I'm trying this on NixOS 19.03.

@mawis
Copy link

mawis commented Jun 6, 2019

Okay, finally I got it building. I needed to make the help2man package accessible to the build process. So what worked for me is this:

file default.nix:

let
  pkgs = import <nixpkgs> {};
in
pkgs.stdenv.mkDerivation {
  name = "hello-2.1.1";
  builder = ./builder.sh;
  src = pkgs.fetchurl {
    url = ftp://ftp.nluug.nl/pub/gnu/hello/hello-2.1.1.tar.gz;
    sha256 = "c510e3ad0200517e3a14534e494b37dc0770efd733fc35ce2f445dd49c96a7d5";
  };
  perl = pkgs.perl;
  help2man = pkgs.help2man;
}

file builder.sh:

source $stdenv/setup                                                             
                                                                                 
PATH=$perl/bin/:$help2man/bin/:$PATH                                             
                                                                                 
tar xvfz $src                                                                    
cd hello-*                                                                       
./configure --prefix=$out                                                        
make                                                                             
make install

And building this with nix-build in the folder these two files are in.

@burbon
Copy link

burbon commented Dec 6, 2019

Following documentation further

Discerning readers will note that the buildInputs could just as well have been set in the Nix expression, like this:
buildInputs = [ perl ];
which seems to solve help2man dependency so

let
  pkgs = import <nixpkgs> {};
in
pkgs.stdenv.mkDerivation {
  name = "hello-2.1.1";
  buildInputs = [ pkgs.perl ];
  src = pkgs.fetchurl {
    url = ftp://ftp.nluug.nl/pub/gnu/hello/hello-2.1.1.tar.gz;
    sha256 = "1md7jsfd8pa45z73bz1kszpp01yw6x5ljkjk2hx7wl800any6465";
  };
}

this is just building fine for me using nix-build

@bburdette
Copy link
Contributor

Ok I found a relevant stackoverflow for this. A quote:

And finally, there are two common formats for derivations in default.nix: derivation, and callPackage derivation. You can't nix-build the latter. Almost any package in nixpkgs is written in this style, see hello. But you can
nix-build -E 'with import { }; callPackage ./path/to/default.nix { }'
as a workaround. nix-shell also supports this -E argument.

Sure enough, with the original default.nix and builder.sh in a directory, I can make it work:

bburdette@BB-5520:~/op-code/nix-example$ ls
builder.sh  default.nix
bburdette@BB-5520:~/op-code/nix-example$ nix-build -E 'with import <nixpkgs> { }; callPackage ./default.nix { }'
/nix/store/fkr5ab4lc1k0cn98lp13615pvc8r1nyh-hello-2.1.1
bburdette@BB-5520:~/op-code/nix-example$ ls
builder.sh  default.nix  result
bburdette@BB-5520:~/op-code/nix-example$ ./result/bin/hello 
Hello, world!

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixos-on-prgmr-and-failing-to-learn-nix-push-cx/9672/3

@stale
Copy link

stale bot commented Jun 2, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Jun 2, 2021
@rigille
Copy link

rigille commented Aug 23, 2021

Thanks for this thread, it fixed that problem with the documentation for me.

@stale stale bot removed the stale label Aug 23, 2021
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/who-uses-nixos-who-are-you-people-and-good-bye/16507/15

@cstroe
Copy link

cstroe commented Jun 1, 2022

I built nix from source on Linux Mint 20.3 (based on Ubuntu 20.04, based on Debian 11), and I get a different error with the default.nix from #2259 (comment) :

 % nix-build --version
nix-build (Nix) 2.8.2
 % nix-build default.nix
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at /home/cosmin/Zoo/mypkgs/applications/misc/hello/ex-1/default.nix:2:17:

            1| let
            2|   pkgs = import <nixpkgs> {};
             |                 ^
            3| in
(use '--show-trace' to show detailed location information)

Looks like I need to setup my NIX_PATH (I keep my nixpkgs git repo in $HOME/Zoo/nixpkgs):

export NIX_PATH="nixpkgs=$HOME/Zoo/nixpkgs"

After that, it looks like it gets going, but only to fail with:

 % nix-build default.nix
these 2 derivations will be built:
  /nix/store/lp206lkj9pal01yha9m50n21230lqr54-hello-2.1.1.tar.gz.drv
  /nix/store/pd8cwbnsai8pwjbq5j3al3gl5qpy0c0w-hello-2.1.1.drv
these 17 paths will be fetched (3.19 MiB download, 11.17 MiB unpacked):
  /nix/store/10whwgyjajsnf72qrgrwc3xijybnhyi4-mirrors-list
  /nix/store/1m77bcwy5vj0vvy816120cj84lxggz6z-curl-7.83.1-dev
  /nix/store/2dv61sygj6hv547aznpqlksrzcazqqlx-libssh2-1.10.0-dev
  /nix/store/2p2gs1fin4hnnly0ximyapfl264cvbn6-openssl-1.1.1o
  /nix/store/578s40zbpa12842yspqrzf31dp765ckv-nghttp2-1.47.0
  /nix/store/6ycryfmqv9x5h1d52yl3jxhwyxczk3c1-libssh2-1.10.0
  /nix/store/7cifvbmgjm5y9ds5a7c6c861g1xcm1qr-stdenv-linux
  /nix/store/7fjsd3sw4j2qllf7x3n46pd2bl92j67q-nghttp2-1.47.0-lib
  /nix/store/aw8lvrb6vagzd5pp9mjsv5dh3r8h18hd-libkrb5-1.19.3-dev
  /nix/store/dq74hwfjr8rnyka9yj3hxv05rg4x8jbj-curl-7.83.1
  /nix/store/fvwn12wkpnc61cvd7i8q0a4xmsh37a3c-openssl-1.1.1o-bin
  /nix/store/jpzizwnh5lxyc02pivid8ni4isag3rs4-nghttp2-1.47.0-bin
  /nix/store/kz9zyv3z4z883vb6z0rw6588mvyrmczh-libkrb5-1.19.3
  /nix/store/pdhq4yndsv6m60dlwswd6ik1i68y6d3x-nghttp2-1.47.0-dev
  /nix/store/qm6s2l3ql906rr0lmw0fnxw2zrlaz0gi-curl-7.83.1-man
  /nix/store/shs5mmslksfjkds8qz5pk7942y2g5bk3-curl-7.83.1-bin
  /nix/store/xggasclsjvc95zdz0fkx9yhpfyfi2szg-openssl-1.1.1o-dev
copying path '/nix/store/10whwgyjajsnf72qrgrwc3xijybnhyi4-mirrors-list' from 'https://cache.nixos.org'...
copying path '/nix/store/qm6s2l3ql906rr0lmw0fnxw2zrlaz0gi-curl-7.83.1-man' from 'https://cache.nixos.org'...
copying path '/nix/store/kz9zyv3z4z883vb6z0rw6588mvyrmczh-libkrb5-1.19.3' from 'https://cache.nixos.org'...
copying path '/nix/store/578s40zbpa12842yspqrzf31dp765ckv-nghttp2-1.47.0' from 'https://cache.nixos.org'...
copying path '/nix/store/aw8lvrb6vagzd5pp9mjsv5dh3r8h18hd-libkrb5-1.19.3-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/jpzizwnh5lxyc02pivid8ni4isag3rs4-nghttp2-1.47.0-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/7fjsd3sw4j2qllf7x3n46pd2bl92j67q-nghttp2-1.47.0-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/2p2gs1fin4hnnly0ximyapfl264cvbn6-openssl-1.1.1o' from 'https://cache.nixos.org'...
copying path '/nix/store/pdhq4yndsv6m60dlwswd6ik1i68y6d3x-nghttp2-1.47.0-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/6ycryfmqv9x5h1d52yl3jxhwyxczk3c1-libssh2-1.10.0' from 'https://cache.nixos.org'...
copying path '/nix/store/fvwn12wkpnc61cvd7i8q0a4xmsh37a3c-openssl-1.1.1o-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/dq74hwfjr8rnyka9yj3hxv05rg4x8jbj-curl-7.83.1' from 'https://cache.nixos.org'...
copying path '/nix/store/2dv61sygj6hv547aznpqlksrzcazqqlx-libssh2-1.10.0-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/shs5mmslksfjkds8qz5pk7942y2g5bk3-curl-7.83.1-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/xggasclsjvc95zdz0fkx9yhpfyfi2szg-openssl-1.1.1o-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/7cifvbmgjm5y9ds5a7c6c861g1xcm1qr-stdenv-linux' from 'https://cache.nixos.org'...
copying path '/nix/store/1m77bcwy5vj0vvy816120cj84lxggz6z-curl-7.83.1-dev' from 'https://cache.nixos.org'...
building '/nix/store/lp206lkj9pal01yha9m50n21230lqr54-hello-2.1.1.tar.gz.drv'...

trying https://tarballs.nixos.org/sha256/1md7jsfd8pa45z73bz1kszpp01yw6x5ljkjk2hx7wl800any6465
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  380k  100  380k    0     0   240k      0  0:00:01  0:00:01 --:--:--  642k
building '/nix/store/pd8cwbnsai8pwjbq5j3al3gl5qpy0c0w-hello-2.1.1.drv'...
unpacking sources
unpacking source archive /nix/store/9bw6xyn3dnrlxp5vvis6qpmdyj4dq4xy-hello-2.1.1.tar.gz
source root is hello-2.1.1
setting SOURCE_DATE_EPOCH to timestamp 1023601263 of file hello-2.1.1/ChangeLog
patching sources
configuring
configure flags: --disable-dependency-tracking --prefix=/nix/store/igjkwxsq0sf5nmm2rj4c8a8n5w4zskna-hello-2.1.1
/nix/store/28hqpbwpzvpff7ldbhxdhzcpdc34lgsa-stdenv-linux/setup: ./configure: /bin/sh: bad interpreter: No such file or directory

Finally ran after I did this (fix is from NixOS/nixpkgs#123970 (comment)):

 % BUSYBOX_PATH=`nix-build --no-out-link '<nixpkgs>' -A busybox`/bin/busybox
 % echo $BUSYBOX_PATH
/nix/store/1knkrc6fijq181h16qs6xxcv6j5qkzl7-busybox-1.35.0/bin/busybox
 % nix-build --option extra-sandbox-paths /bin/sh=$BUSYBOX_PATH default.nix
this derivation will be built:
  /nix/store/pd8cwbnsai8pwjbq5j3al3gl5qpy0c0w-hello-2.1.1.drv
building '/nix/store/pd8cwbnsai8pwjbq5j3al3gl5qpy0c0w-hello-2.1.1.drv'...
unpacking sources
unpacking source archive /nix/store/9bw6xyn3dnrlxp5vvis6qpmdyj4dq4xy-hello-2.1.1.tar.gz
source root is hello-2.1.1
setting SOURCE_DATE_EPOCH to timestamp 1023601263 of file hello-2.1.1/ChangeLog
patching sources
configuring
configure flags: --disable-dependency-tracking --prefix=/nix/store/igjkwxsq0sf5nmm2rj4c8a8n5w4zskna-hello-2.1.1
...
<many lines removed>
...
shrinking RPATHs of ELF executables and libraries in /nix/store/igjkwxsq0sf5nmm2rj4c8a8n5w4zskna-hello-2.1.1
shrinking /nix/store/igjkwxsq0sf5nmm2rj4c8a8n5w4zskna-hello-2.1.1/bin/hello
gzipping man pages under /nix/store/igjkwxsq0sf5nmm2rj4c8a8n5w4zskna-hello-2.1.1/share/man/
strip is /nix/store/r7r10qvsqlnvbzjkjinvscjlahqbxifl-gcc-wrapper-11.3.0/bin/strip
stripping (with command strip and flags -S) in /nix/store/igjkwxsq0sf5nmm2rj4c8a8n5w4zskna-hello-2.1.1/bin
patching script interpreter paths in /nix/store/igjkwxsq0sf5nmm2rj4c8a8n5w4zskna-hello-2.1.1
checking for references to /build/ in /nix/store/igjkwxsq0sf5nmm2rj4c8a8n5w4zskna-hello-2.1.1...
/nix/store/igjkwxsq0sf5nmm2rj4c8a8n5w4zskna-hello-2.1.1

@rgoulter
Copy link

rgoulter commented Jun 1, 2022

@cstroe you probably need to run:

nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update

This puts nixpkgs at ~/.nix-defexpr/channels/nixpkgs.

/home/<username>/.nix-defexpr/channels is probably already in your NIX_PATH.

For a longer explanation (as to <nixpkgs> and what ~/.nix-defexpr is), these pages would be useful:

https://nixos.org/manual/nix/stable/command-ref/env-common.html
https://nixos.org/manual/nix/stable/command-ref/nix-env.html

@cstroe
Copy link

cstroe commented Jun 2, 2022

@rgoulter, thanks, that seems to have helped:

 % nix-instantiate --eval -E '<nixpkgs>'
/home/cosmin/.nix-defexpr/channels/nixpkgs

I don't have to set NIX_PATH manually.

@fricklerhandwerk
Copy link
Contributor

Closing this as the section was removed from the manual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests