Dear Maintainer,
*** Reporter, please consider answering these questions, where appropriate ***
* What led up to the situation?
* What exactly did you do (or not do) that was effective (or
ineffective)?
* What was the outcome of this action?
* What outcome did you expect instead?
*** End of the template - remove these template lines ***
This is my first time trying out nix, however I could not get it to
work.
~$ sudo nix-shell -p cowsay
[sudo] password for farhad:
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «string»:1:25:
1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (cowsay) ]; } ""
| ^
(use '--show-trace' to show detailed location information)
whenever I try nix-shel or nix-env to use a package it seems to not be
able to find nixpkgs and fails to proceed anyh further.
I tried to manually upgrade nix from this link:
https://nixos.org/manual/nix/stable/installation/upgrading
however nothing changed
I also tried to use Arch Wiki's guide:
https://wiki.archlinux.org/index.php?title=Nix&oldid=684715
but adding a channel did not seem to resolve the issue either.
Needless to say i performed a full reboot after each action and nothing
seemed to be affected.
I could poke around further but lack of documentation for this package
and my lack of knowledge about nix is holding me back. I do not want to
use packages outside of debian 12 stable, or run random shell scripts on
my machine.
Do you want to run this as root (sudo)? If you add your user to the
nix-users group, I think you should be able to run `nix-shell -p
cowsay` as your user without sudo. (Assuming you also added a channel
like mention in the nix-channel man page.)
Oh, I also manually added this in ~/.bashrc:
if [ -e "$HOME/.nix-defexpr/channels" ]; then
export NIX_PATH="$HOME/.nix-defexpr/channels${NIX_PATH:+:$NIX_PATH}"
fi
This seems like something we might want to consider handling in the
nix debian packaging by updating /etc/profile.d. (Or, at least mention
in /usr/share/doc/nix-bin/README.Debian.)