Coder Social home page Coder Social logo

nixpkgs not found about nix-init HOT 9 CLOSED

tcurdt avatar tcurdt commented on May 26, 2024
nixpkgs not found

from nix-init.

Comments (9)

viperML avatar viperML commented on May 26, 2024

What is the output of the following commands?

printenv NIX_PATH
nix-instantiate --eval --expr '<nixpkgs>'

from nix-init.

tcurdt avatar tcurdt commented on May 26, 2024
# printenv NIX_PATH
/root/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels

# nix-instantiate --eval --expr '<nixpkgs>'
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error:
       … while calling the 'findFile' builtin

         at «string»:1:1:

            1| <nixpkgs>
             | ^

       error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

Looking at this, it feels more like a newbie (me) getting stuck in between channels and flakes rather than a nix-init problem.

from nix-init.

viperML avatar viperML commented on May 26, 2024

Why do you think that's the problem? Did you remove any channels?

EDIT: Also why running the commands as root (#) ?

from nix-init.

tcurdt avatar tcurdt commented on May 26, 2024

Why do you think that's the problem? Did you remove any channels?

My channels were empty at some stage. The system is setup via flake.
But I re-added unstable to give it a try.

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

But that didn't help

EDIT: Also why running the commands as root (#) ?

No particular reason. It's just a throw-away vm for now.

But I am getting the same error as user

[tcurdt@nixos:~]$ nix-instantiate --eval --expr '<nixpkgs>'
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error:
       … while calling the 'findFile' builtin

         at «string»:1:1:

            1| <nixpkgs>
             | ^

       error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

TBH I don't understand the per-user/root when I am user tcurdt

from nix-init.

viperML avatar viperML commented on May 26, 2024

Root's channels are propagated to regular users

from nix-init.

tcurdt avatar tcurdt commented on May 26, 2024

This helped

$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
$ nix-channel --list
nixpkgs https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --update nixpkgs
$  nix-instantiate --eval --expr '<nixpkgs>'
/root/.nix-defexpr/channels/nixpkgs

Can't say I understand the problem/fix yet, but I now have a default.nix 🥳

{ lib
, buildGoModule
, fetchFromGitHub
}:

buildGoModule rec {
  pname = "release-go";
  version = "1.0.3";

  src = fetchFromGitHub {
    owner = "tcurdt";
    repo = "release-go";
    rev = "v${version}";
    hash = "sha256-Ai4uvLkl4e4Z6x1wZb5BzpLvWhxHhg4D1QpCdSjwQ5I=";
  };

  vendorHash = null;

  ldflags = [
    "-s"
    "-w"
    "-X=main.version=${version}"
    "-X=main.commit=${src.rev}"
    "-X=main.date=1970-01-01T00:00:00Z"
    "-X=main.treeState=false"
    "-X=main.builtBy=goreleaser"
  ];

  meta = with lib; {
    description = "";
    homepage = "https://github.com/tcurdt/release-go";
    license = licenses.unfree; # FIXME: nix-init did not find a license
    maintainers = with maintainers; [ ];
    mainProgram = "release-go";
  };
}

from nix-init.

nixos-discourse avatar nixos-discourse commented on May 26, 2024

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

https://discourse.nixos.org/t/making-packages-projects-available-to-nixos/38462/4

from nix-init.

viperML avatar viperML commented on May 26, 2024

Should the issue be closed?

from nix-init.

tcurdt avatar tcurdt commented on May 26, 2024

I am still stuck actually getting the build to work - but that's probably another more unrelated matter. Let's close it.

from nix-init.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.