Open crop2000 opened 4 months ago
~~this is happening because too old nix (nix_2_3 2.3.18) is used in shell.nix see #97~~
this is happening because too old nix (nix_2_3 2.3.18) is used in shell.nix see #97
can you define "too old"?
today i cannot reproduce the problem. i don't know anymore which nix-version and exact npins project revision I used. but the problem description appeared before as well on the lix matrix channel.
Because i didn't came across the problem again i close this issue.
this recently begun happening to me with both lix
and lix's nixos-module
. with npins 0.2.4, npins update
from the previously working version leaves me with sources.json
as follows:
{
"pins": {
...
"lix": {
"type": "GitRelease",
"repository": {
"type": "Git",
"url": "https://git.lix.systems/lix-project/lix"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"version": "2.91.1",
"revision": "ad9d06f7838a25beec425ff406fe68721fef73be",
"url": null,
"hash": "0ibpbvc6871bqyab0msml2g2y3c6jvg6yb169lykg4257izss8c6"
},
"lix-nixos-module": {
"type": "GitRelease",
"repository": {
"type": "Git",
"url": "https://git.lix.systems/lix-project/nixos-module"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"version": "2.91.1",
"revision": "6478f624b2a00367e0e3d750a2c7a9f3afb72712",
"url": null,
"hash": "1mq5741iwa10r93shg1y8q6cxa2zjppc2w10hsrv1gfac76p8nmj"
},
...
},
"version": 3
}
which then gives the following error when i rebuild:
fetching git input 'git+https://git.lix.systems/lix-project/nixos-module'
error:
… while evaluating the attribute 'config.system.build.toplevel'
at /nix/store/cariq6xs0m5yzjkxd85wqqj7bgh4a3af-source/lib/modules.nix:322:9:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
… while evaluating 'eval.config' to select 'system' on it
at /nix/store/cariq6xs0m5yzjkxd85wqqj7bgh4a3af-source/nixos/default.nix:17:12:
16|
17| system = eval.config.system.build.toplevel;
| ^
18|
(stack trace truncated; use '--show-trace' to show the full trace)
error: Cannot find Git revision '6478f624b2a00367e0e3d750a2c7a9f3afb72712' in ref 'refs/heads/main' of repository 'https://git.lix.systems/lix-project/nixos-module'! Please make sure that the rev exists on the ref you've specified or add allRefs = true; to fetchGit.
if i only npins update lix
(avoiding updating nixos-module
), i instead get:
fetching git input 'git+https://git.lix.systems/lix-project/lix'
error:
… while calling the 'head' builtin
at /nix/store/cariq6xs0m5yzjkxd85wqqj7bgh4a3af-source/lib/attrsets.nix:1575:11:
1574| || pred here (elemAt values 1) (head values) then
1575| head values
| ^
1576| else
… while evaluating the attribute 'value'
at /nix/store/cariq6xs0m5yzjkxd85wqqj7bgh4a3af-source/lib/modules.nix:809:9:
808| in warnDeprecation opt //
809| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
810| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: Cannot find Git revision 'ad9d06f7838a25beec425ff406fe68721fef73be' in ref 'refs/heads/main' of repository 'https://git.lix.systems/lix-project/lix'! Please make sure that the rev exists on the ref you've specified or add allRefs = true; to fetchGit.
im really confused about this. why does branch matter at all when it knows exactly what revision it's after? why has the revision reference been updated to something it'll refuse to check out?
the problem seems to be this: "Seems like npins indeed breaks for tags that are not on the default branch." I think it is builtins.fetchGit that has this problem.
nix-repl> builtins.fetchGit { url = "https://git.lix.systems/lix-project/lix.git"; rev = "ad9d06f7838a25beec425ff406fe68721fef73be"; }
...
error: Cannot find Git revision 'ad9d06f7838a25beec425ff406fe68721fef73be' in ref 'refs/heads/main' of repository 'https://git.lix.systems/lix-project/lix.git'! Please make sure that the rev exists on the ref you've specified or add allRefs = true; to fetchGit.
so
nix-repl> builtins.fetchGit { url = "https://git.lix.systems/lix-project/lix.git"; rev = "ad9d06f7838a25beec425ff406fe68721fef73be"; allRefs = true; }
{
lastModified = 1729298361;
lastModifiedDate = "20241019003921";
narHash = "sha256-hiGtfzxFkDc9TSYsb96Whg0vnqBVV7CUxyscZNhed0U=";
outPath = "/nix/store/59hbcmxmj23mpf04qw28yrks7cdsplkj-source";
rev = "ad9d06f7838a25beec425ff406fe68721fef73be";
revCount = 16139;
shortRev = "ad9d06f";
submodules = false;
}
so how about using allRefs = true in https://github.com/andir/npins/blob/master/src/default.nix ?
Note: this situation is a bit spicy as it involves:
With Nix starting somewhen after 2.18, passing allRefs
isn't necessary anymore...
... but still there is that problematic issue where Nix 2.18 and Lix (nix (Lix, like Nix) 2.91.0
/2.18.3-lix
) exhibit that behaviour...
... which is made even more annoying when you see that if you get a Nix 2.24 to fetchGit
it successfully, it then lives in the user's evaluation cache for 2.18 to see.
Perhaps there is apetite in the Lix community to fix this issue once and for all? Perhaps using fetchTree
would be a workaround if we require a newer Nix version / use it when available? I don't like the idea of advocating for newer Nix as that usually causes tons of other issues and then people will think the old version is "buggy" while it is just an unfortunate combination of versions and forks :(
adds
but
produces the following error:
the problem is that nix expect main as branch but the release is on release-2.90 branch. i wonder if this is a inherent problem of buildins.fetchGit or if it can be somehow mitigated. with information we have in npins (but do not store yet).