niv icon indicating copy to clipboard operation
niv copied to clipboard

niv tries to unpack local dependency

Open yaitskov opened this issue 4 years ago • 3 comments

Hi, niv revision "e0ca65c81a2d7a4d82a189f1e23a48d59ad42070"

sources.json:

    "prune-juice": {
        "type": "local",
        "path": "/home/dan/pro/prune-juice"
    },

Error

unpacking source archive /home/dan/pro/prune-juice
do not know how to unpack source archive /home/dan/pro/prune-juice
builder for '/nix/store/bvhjyi9p3hxi87zjl7f6xbr1xjy7yc8q-prune-juice-0.6.drv' failed with exit code 1
git clone [email protected]:dfithian/prune-juice.git

It was working before.

yaitskov avatar Nov 06 '21 02:11 yaitskov

Hi @yaitskov ,

I made a small demo that use a local source just fine without unpacking. In fact, I don't think niv is ever unpacking any sources. I would recommend checking how you are using this prune-juice source. You could share it here so I can take a look.

{ sources ? import ./nix/sources.nix
, nixpkgs ? import sources.nixpkgs {}
, juice ? sources.juice
}:
{
  test-command = nixpkgs.writeScriptBin "test-niv" ''
    #! ${nixpkgs.bash}/bin/bash
    echo '${juice}'
  '';
}

refnil avatar Nov 06 '21 07:11 refnil

How to run the snippet above?

nix-shell pj.nix

I think it is worth to mention nixpkgs repo version. I took master because I need HLS 1.4

    "nixpkgs": {
        "branch": "master",
        "description": "Nix Packages collection",
        "homepage": "",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "4217614266efccf9c5f8817532fbcbdbf31001e2",
        "sha256": "0xiiprzxm72xw0jrgr1fgz0lxkhhl0n6gk08wv2hn8l0ms5w2yl7",
        "type": "tarball",
        "url": "https://github.com/NixOS/nixpkgs/archive/4217614266efccf9c5f8817532fbcbdbf31001e2.tar.gz",
        "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
    },

I suspect the issue is caused by changes in nixpkgs itself.

yaitskov avatar Nov 06 '21 14:11 yaitskov

How to run the snippet above?

First, you should copy the script in the same folder containing the nix folder with sources.json and sources.nix. Then, you could change sources.juice in the script by sources.prune-juice to use the problematic source. To run it, you could do run it with

nix-shell -p "(import ./test.nix {}).test_command" --run test_niv

or

nix-build test.nix && result/bin/test_niv

Note that my file is named test.nix while yours is pj.nix (I think).

refnil avatar Nov 08 '21 18:11 refnil