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

error running with nix run and flake input #35

Open
haztecaso opened this issue Nov 22, 2024 · 4 comments
Open

error running with nix run and flake input #35

haztecaso opened this issue Nov 22, 2024 · 4 comments
Assignees
Labels
under investigation This issue is currently being reviewed

Comments

@haztecaso
Copy link

I encountered an error while trying to use autofirma-nix both with nix run and when importing it into my NixOS flake to use it as a NixOS module. The error I get is the same in both cases. When I run it with nix run I get an extra warning about the substituter that I suspect may be related with the cause of the problem.

$ nix run --accept-flake-config github:nilp0inter/autofirma-nix
warning: ignoring untrusted substituter 'https://autofirma-nix.cachix.org', you are not a trusted user.
Run `man nix.conf` for more information on the `substituters` configuration option.
error:
       … in the left operand of the update (//) operator

         at «string»:56:13:

           55|             # This is shadowed in the next //
           56|             // sourceInfo
             |             ^
           57|             // {

       … while evaluating the attribute 'lib.mkFlake'

         at /nix/store/6n86v7gp9na15rfj5b6s7zv51qcjl58y-source/flake.nix:9:5:

            8|   outputs = { nixpkgs-lib, ... }: {
            9|     lib = import ./lib.nix {
             |     ^
           10|       inherit (nixpkgs-lib) lib;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: getting status of '/nix/store/l04ifn08y80fcd3iblpzfr0fj0pqc58z-source': No such file or directory

The first time I ran the command it asked me if I wanted to include the substituter and signatures, I said yes to everything and the app worked without any problem. After that first run I started getting this error.

In the case of nix flakes I get the error just by adding it to my inputs, without even trying to use it anywhere. This is very weird to me, as in my mind nix is lazy, so it shouldn't try to evaluate something if I'm not using it.

Thanks a lot for the help and all the development effort!

@panchoh
Copy link
Contributor

panchoh commented Nov 22, 2024

Hi, @haztecaso!
Are you tracking nixos-unstable or nixos-24.05?
(Just run nix run --accept-flake-config github:nilp0inter/autofirma-nix on my system tracking nixos-unstable and it worked ok to me.)
Also, can you provide the version of nix you are using?
In my case it is:

❯ nix --version
nix (Nix) 2.24.10

@haztecaso
Copy link
Author

Hi! Thanks for your answer. My nix version is 2.18.8.
I'm tracking nixos-24.05 but I also have unstable in my inputs for some packages.
I've tried using autofirma-nix both with nixos-24.05 and unstable, with the following input declarations, and I get the same error every time.

    autofirma-nix = {
      url = "github:nilp0inter/autofirma-nix/release-24.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };

and

    autofirma-nix = {
      url = "github:nilp0inter/autofirma-nix";
      inputs.nixpkgs.follows = "unstable";
    };

@panchoh
Copy link
Contributor

panchoh commented Nov 24, 2024

Hi, @haztecaso.

We’ve just tried (@CesarGallego & myself) unsuccessfully to reproduce¹ the issue on a NixOS system tracking nixos-24.05.

After reviewing the error message you provided, I think that the issue might lie somewhere else, because of the "No such file or directory" error message. This makes me think that perhaps you have added a file on your flake that is not yet under version control? If that was to be the case, just git add the file so that it enters into the git index, and it can be copied to the nix store to be accessed by nixos-rebuild switch. Remeber that you can identify any such file by running git status on your flake dir.

EDIT: maybe lib.nix is the file that has not been git added.

Also, and out of an abundance of caution, make sure that you don’t invoke nixos-rebuild switch with the --fast flag, so that if a newer nix version is available in the update, it is properly evaluated.

Hope that it helps, keep us posted!

¹: $ nix run --accept-flake-config github:nilp0inter/autofirma-nix

@nilp0inter nilp0inter added the under investigation This issue is currently being reviewed label Dec 24, 2024
Copy link
Contributor

github-actions bot commented Jan 8, 2025

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added stale and removed stale labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
under investigation This issue is currently being reviewed
Projects
None yet
Development

No branches or pull requests

3 participants