DavHau / mach-nix

Create highly reproducible python environments
MIT License
862 stars 106 forks source link

mach-nix error 'string is not allowed to refer to a store path' #403

Open MorganSP opened 2 years ago

MorganSP commented 2 years ago

Hi I'm attempting to generate a nix expression from a requirements.txt file mach-nix gen -r requirements.txt -o test.nix but I get the error

path is '/nix/store/ahaz90hy6lins0a56mdivrd2fjj3rcb5-554d2d8aa25b6e583575459c297ec23750adb6cb'
error: the string '{
         "nodes": {
           "flake-utils": {
             "locked": {
               "lastModified": 1642700792,
               "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
               "owner": "numtide",
               "repo": "flake-utils",
               "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
               "type": "github"
             },
             "original": {
               "owner": "numtide",
               "repo": "flake-utils",
               "type": "github"
             }
           },
           "nixpkgs": {
             "locked": {
               "lastModified": 1643805626,
               "narHash": "sha256-AXLDVMG+UaAGsGSpOtQHPIKB+IZ0KSd9WS77aanGzgc=",
               "owner": "NixOS",
               "repo": "nixpkgs",
               "rev": "554d2d8aa25b6e583575459c297ec23750adb6cb",
               "type": "github"
             },
             "original": {
               "id": "nixpkgs",
               "ref": "nixos-unstable",
               "type": "indirect"
             }
           },
           "pypi-deps-db": {
             "flake": false,
             "locked": {
               "lastModified": 1643877077,
               "narHash": "sha256-jv8pIvRFTP919GybOxXE5TfOkrjTbdo9QiCO1TD3ZaY=",
               "owner": "DavHau",
               "repo": "pypi-deps-db",
               "rev": "da53397f0b782b0b18deb72ef8e0fb5aa7c98aa3",
               "type": "github"
             },
             "original": {
               "owner": "DavHau",
               "repo": "pypi-deps-db",
               "type": "github"
             }
           },
           "root": {
             "inputs": {
               "flake-utils": "flake-utils",
               "nixpkgs": "nixpkgs",
               "pypi-deps-db": "pypi-deps-db"
             }
           }
         },
         "root": "root",
         "version": 7
       }
       ' is not allowed to refer to a store path (such as '/nix/store/190cnmivy4dy51ij6506r4m8w556vmzj-python3.9-resolvelib-0.3.0')

       at /nix/store/amblv1hi0dck9f7aswwypn3hgx3bnbl9-mach-nix-3.4.0/lib/python3.9/site-packages/mach_nix/nix/flake-inputs.nix:4:11:

            3| let
            4|   lock = (fromJSON (readFile ../flake.lock)).nodes;
             |           ^
            5|   get = input: {
(use '--show-trace' to show detailed location information)

I should mention, I'm on Mac OS Catalina and after installing nix i was unable to run it. I read the suggestion to . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh after which nix --version is nix (Nix) 2.6.0 and I was able to install and run mach-nix

DavHau commented 2 years ago

Hey, I'd guess that you are running an old version of mach-nix. That bug should be fixed by now. Could you check? Maybe also try mach-nix master. There have been a few macos related fixes in the past days as well.

MorganSP commented 2 years ago

Hi I'm on 3.4.0

DavHau commented 2 years ago

Oh then this is a bug in the CLI application. Until this is fixed, you should be able to successully build without the CLI, just using a nix expression, like described here

rht commented 2 years ago

I encountered the same problem, even with the latest master

nix-shell -p '(callPackage (fetchTarball https://github.com/DavHau/mach-nix/tarball/master) {}).mach-nix'
n8henrie commented 2 years ago

Seeing this on linux x86_64, master, installed via flake.

TyberiusPrime commented 2 years ago

I think it's related to https://github.com/NixOS/nix/issues/6647 and so depends on your nix + mach-nix version combination (ugh)

TyberiusPrime commented 1 year ago

It's still around on current master and nix 2.9.

shlevy commented 1 year ago

Had this issue with Nix 2.11, working now with 2.12.