nilp0inter / autofirma-nix

Integración de AutoFirma y herramientas relacionadas en Nix/NixOS
MIT License
16 stars 4 forks source link

error running with nix run and flake input #35

Open haztecaso opened 1 week ago

haztecaso commented 1 week ago

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 commented 1 week ago

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 commented 1 week ago

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 commented 5 days ago

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