Open ephox-services opened 7 years ago
Note: I've also experienced this error when using channels. I constructed a channel out of these sources and got this error when the client was attempting to update the channel.
nix-copy-closure doesn't do anything with nix-env. You can add it to nix-env afterwards by doing a nix-env -i on the derivation.
Indeed, the usage of copy-closure isn't related to the error you're getting. I've minimized the testcase to:
let
_nixpkgs = import <nixpkgs> {};
nixpkgsSrc = _nixpkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs-channels";
rev = "25f4906da6387e132823417bc54ea86040fb9bd5";
sha256 = "0pa01hfsz1ddma5d3x41i049wrn176sggr290wpbbhw9arx3nx2i";
};
nixpkgs = import nixpkgsSrc {};
in {
inherit (nixpkgs) hello;
}
which still gives the same on nix-env -f repro.nix -qaP
:
error: cannot import ‘/nix/store/v2w72ydhc2sygmaqnzhfw7b04z3i54mv-nixpkgs-channels-25f4906da6387e132823417bc54ea86040fb9bd5-src’, since path ‘/nix/store/pkb1w9v39kz26fm109si5d6hxb699q32-nixpkgs-channels-25f4906da6387e132823417bc54ea86040fb9bd5-src.drv’ is not valid, at /tmp/nix-copy-closure-bug-replication/repro.nix
So it's somehow related to import-from-derivation inside nix-env -q
.
@dezgeg the dynamic nixpkgs import is probably the problem. Using fetchTarball will probably fix this.
See https://github.com/NixOS/nixpkgs/issues/27994 for more discussion about nixpkgs pinning.
@puffnfresh : fetchTarball does indeed resolve the issue in the repro case. for reference: the tarball url is:
https://github.com/NixOS/nixpkgs-channels/archive/96457d26dded05bcba8e9fbb9bf0255596654aab.tar.gz
To be clear, to get it working I changed repro to this. This sidesteps the need for a bootstrapping nixpkgs and just uses the builtin. Is this what you meant? Obviously in real code we'll need the new fetchTarball that can take a sha. :)
let
nixpkgsSrc = fetchTarball { url = https://github.com/NixOS/nixpkgs-channels/archive/96457d26dded05bcba8e9fbb9bf0255596654aab.tar.gz; };
nixpkgs = import nixpkgsSrc {};
in {
inherit (nixpkgs) hello;
}
nix-env runs nix in read-only mode => IFD does not work there
Forgive my ignorance, but what is IFD, @globin ?
@benkolera "import from derivation" - meaning you use Nix to build an output then you import from that output. The fetchFromGitHub
is a Nix derivation, so you're importing the output of that.
Instead, fetchTarball
is a special builtin which isn't a derivation. It's some magic instead :ghost:
I marked this as stale due to inactivity. → More info
I have a nix package that wraps Amazon Dynamodb Local. I wish to build it on a nixos machine, then nix-copy-closure it to another machine (in this case, a Fedora workstation).
As part of this, I wish to "pin" nixpkgs to a specific version for build repeatability. To achieve this, I'm following the approach detailed here: https://gist.github.com/zimbatm/de5350245874361762b6a4dfe5366530
It seems that nix-copy-closure can't deal with this pinning correctly.
My steps are:
Source machine:
Dest machine:
Expected:
Actual:
Logs:
Source machine:
Target machine:
Code is here: https://github.com/ephox-services/nix-copy-closure-bug-replication
Thanks!