oxalica/nil

Can not evaluate input if no lock-file

LittleAmara opened this issue · 2 comments

Hey, I don't know if it is the desired behaviour but if an input of a flake does not have a lock file then nil will throw this (see image below).
image

A simple flake to reproduce:

{
  description = "A very basic flake";
  inputs = {
    poetry2nix.url = "github:nix-community/poetry2nix";
  };

  outputs = { self, nixpkgs }: {

    packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;

    packages.x86_64-linux.default = self.packages.x86_64-linux.hello;

  };
}

Edit:
I'm on version 2023-05-02

Just run into this too:

LSP[nil_ls] Flake input "home-manager" cannot be evaluated: `nix flake show path:/nix/store/1h8yz1jsh2pck91kfhrpxvkci6m0c1iy-source` failed with exit status: 1. Stderr:                                             
copying '/nix/store/1h8yz1jsh2pck91kfhrpxvkci6m0c1iy-source'...                                                                                                                                                      
evaluating file '/nix/store/1h8yz1jsh2pck91kfhrpxvkci6m0c1iy-source/flake.nix'                                                                                                                                       
downloading 'https://channels.nixos.org/flake-registry.json'...                                                                                                                                                      
downloading 'https://api.github.com/repos/NixOS/nixpkgs/commits/nixpkgs-unstable'...                                                                                                                                 
downloading 'https://api.github.com/repos/NixOS/nixpkgs/tarball/0b6445b611472740f02eae9015150c07c5373340'...                                                                                                         
evaluating file '/nix/store/bwps706g6ywl1811r7bwv32py12129ci-source/flake.nix'                                                                                                                                       
warning: creating lock file '/nix/store/1h8yz1jsh2pck91kfhrpxvkci6m0c1iy-source/flake.lock'                                                                                                                          
error: opening file '/nix/store/1h8yz1jsh2pck91kfhrpxvkci6m0c1iy-source/flake.lock': Read-only file system                                                                                                           
(use '--show-trace' to show detailed location information)

Seems we need --inputs-from <current-flake> <input_name> instead of directly using the input store path. But this would dump the current flake more often (we don't have lazy dumping yet NixOS/nix#6530), which is bad for big repo like nixpkgs.

BTW: You can temporarily disable the evaluation workspace-wide via nix.flake.autoEvalInputs = false since 21d0870