Nix-reply and missing default.nix

When I execute nix repl, and then try to run :l, I am met with error: opening file '…/default.nix': No such file or directory.

I found this related post. However, there the command is nix-shell instead of nix. And, I can not see how I can add -p bash to repl.

Will I have to make a default.nix file? If I do, what should be in it? I found this old example, but that might be overkill? The only thing I want to achieve is to list available kernels (and overview is also found on kernel.org).

: : disclaimer: i am new to nixos : :

You realize that when it is written :l <nixpkgs>, you actually need to type the <nixpkgs> verbatim? This is not a placeholder of any kind, it will be replaced with the path to your channel called nixpkgs automatically.

Additionnally, you can directly type it in the command line, like:

$ nix repl '<nixpkgs>'
> pkgs.linuxPackages.#type TAB here
1 Like

Ah, I did not realise that. Thank you!

(I ended up getting a long list of errors when trying to list packages, but I guess it is better to open a new issue for that.)

UPDATE #1:
The error, nix-repl errorr: while calling the 'throw' builtin, only showed up as I pressed enter after pkgs.linuxPackages. So, if I only tabbed, as suggested above, I see all the kernels.

UPDATE #2:
Yes, tab, and not enter, as explained here.

1 Like