error : `.../lib/attresets.nix` is not in `...-source`
When trying to update a package in a flake I encountered the following error:
❯ nix-update -F warcraftlogs
$ nix eval --json --impure --expr
let
inherit (builtins) getFlake stringLength substring;
currentSystem = builtins.currentSystem;
flake = getFlake "/home/boyerq/Nixfiles";
pkg = flake.packages.${currentSystem}."warcraftlogs" or flake."warcraftlogs";
inherit (flake) outPath;
outPathLen = stringLength outPath;
sanitizePosition = { file, ... }@pos:
assert substring 0 outPathLen file != outPath
-> throw "${file} is not in ${outPath}";
pos // { file = "/home/boyerq/Nixfiles" + substring outPathLen (stringLength file - outPathLen) file; };
raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);
position = if pkg ? isRubyGem then
raw_version_position
else if pkg ? isPhpExtension then
raw_version_position
else
sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
in {
name = pkg.name;
old_version = pkg.version or (builtins.parseDrvName pkg.name).version;
inherit raw_version_position;
filename = position.file;
line = position.line;
urls = pkg.src.urls or null;
url = pkg.src.url or null;
rev = pkg.src.rev or null;
hash = pkg.src.outputHash or null;
go_modules = pkg.goModules.outputHash or null;
go_modules_old = pkg.go-modules.outputHash or null;
cargo_deps = pkg.cargoDeps.outputHash or null;
raw_cargo_lock =
if pkg ? cargoDeps.lockFile then
let
inherit (pkg.cargoDeps) lockFile;
res = builtins.tryEval (sanitizePosition {
file = toString lockFile;
});
in
if res.success then res.value.file else false
else
null;
composer_deps = pkg.composerRepository.outputHash or null;
npm_deps = pkg.npmDeps.outputHash or null;
yarn_deps = pkg.offlineCache.outputHash or null;
maven_deps = pkg.fetchedMavenDeps.outputHash or null;
tests = builtins.attrNames (pkg.passthru.tests or {});
has_update_script = false;
src_homepage = pkg.src.meta.homepage or null;
changelog = pkg.meta.changelog or null;
maintainers = pkg.meta.maintainers or null;
} --extra-experimental-features flakes nix-command
warning: input 'nur' has an override for a non-existent input 'nixpkgs'
error:
… while evaluating attribute 'raw_version_position'
at «string»:26:10:
25| old_version = pkg.version or (builtins.parseDrvName pkg.name).version;
26| inherit raw_version_position;
| ^
27| filename = position.file;
… in the condition of the assert statement
at «string»:11:9:
10| sanitizePosition = { file, ... }@pos:
11| assert substring 0 outPathLen file != outPath
| ^
12| -> throw "${file} is not in ${outPath}";
(stack trace truncated; use '--show-trace' to show the full trace)
error: /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix is not in /nix/store/l3hss47a3wqkx275p5by3kyhhc620nly-source
I'm not sure exactly what is the problem...
The derivation file is the following:
{
appimageTools,
lib,
fetchurl,
}:
appimageTools.wrapType2 rec {
pname = "warcraftlogs";
version = "6.0.2";
src = fetchurl {
url = "https://github.com/RPGLogs/Uploaders-warcraftlogs/releases/download/v${version}/Warcraft-Logs-Uploader-${version}.AppImage";
hash = "sha256-b1Lt8ssL+Isd/Twv6ef3AK4/BkxWA/TtleameONo/2Q=";
};
extraInstallCommands = let
appimageContents = appimageTools.extractType2 {inherit pname version src;};
in ''
install -m 444 -D ${appimageContents}/${pname}.desktop $out/share/applications/${pname}.desktop
substituteInPlace $out/share/applications/${pname}.desktop --replace 'Exec=AppRun' 'Exec=${pname}-${version}'
install -m 444 -D ${appimageContents}/usr/share/icons/hicolor/256x256/apps/${pname}.png \
$out/share/icons/hicolor/256x256/apps/${pname}png
'';
meta = with lib; {
homepage = "https://www.warcraftlogs.com/";
description = "Tool to upload world of warcraft combat logs";
license = licenses.unfree;
platforms = ["x86_64-linux"];
maintainers = with maintainers; [traxys];
};
}
Looks like one flake tries to access another flake with an absolute import path?
error: /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix is not in /nix/store/l3hss47a3wqkx275p5by3kyhhc620nly-source
Can you check out what /nix/store/l3hss47a3wqkx275p5by3kyhhc620nly-source and /nix/store/p69bcs7ma6ijj8v9xsrg3nq3nn8ryn95-source/lib/attrsets.nix is? The first might be NUR and the other one might be nixpkgs?
I think it has something to do with:
warning: input 'nur' has an override for a non-existent input 'nixpkgs'
I am also having this issue, this doesn't seem to have anything to do with extra flake inputs. I created a flake where the only flake input is nixpkgs. the "source" appears to be the flake.
error: /nix/store/7v6l2v247fmdgfpbs3w91mf6rinai4yk-source/lib/attrsets.nix is not in /nix/store/4kmip8a3k9n5z59wcah3jzrar7lwm3i9-source
melody in gameglass-flake.nix on main
at 13:20:17 ❯ ls /nix/store/4kmip8a3k9n5z59wcah3jzrar7lwm3i9-source
flake.lock flake.nix gameglass.nix
This issue looked to be because of the package using appimageTools:
❯ nix eval .\#gameglass.meta.position
"/nix/store/7v6l2v247fmdgfpbs3w91mf6rinai4yk-source/lib/attrsets.nix:984"
So I tried a different package..
{
lib,
stdenv,
fetchFromGitHub,
nix-update-script,
...
}:
stdenv.mkDerivation (finalAttrs: {
pname = "catppuccin-base16";
version = "git+${builtins.substring 0 8 finalAttrs.src.rev}";
src = fetchFromGitHub {
owner = "catppuccin";
repo = "base16";
rev = "99aa911b29c9c7972f7e1d868b6242507efd508c";
hash = "sha256-HHodDRrlcBVWGE3MN0i6UvUn30zY/JFEbgeUpnZG5C0=";
};
passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
meta = {
description = "Base16 Catppuccin theme";
homepage = "https://github.com/catppuccin/base16";
platforms = lib.platforms.all;
license = lib.licenses.mit;
};
installPhase = ''
mkdir -p $out/share
cp -r $src/base16 $out/share/themes
'';
})
This gives me a similar but different error:
error: /nix/store/mr50vwmkskid925jf21fg3w4n43jq558-l393p8dfvmbmydcjmc8iqqsd101b3fns-source/packages/catppuccin-base16/default.nix is not in /nix/store/l393p8dfvmbmydcjmc8iqqsd101b3fns-source
But the path does exist:
❯ , file /nix/store/l393p8dfvmbmydcjmc8iqqsd101b3fns-source/packages/catppuccin-base16/default.nix
/nix/store/l393p8dfvmbmydcjmc8iqqsd101b3fns-source/packages/catppuccin-base16/default.nix: ASCII text
Having the same issue with appimageTools.wrapType2.
As a workaround, you can explicitly pass the filename where the version number is defined via --override-filename.
~~I'm still getting a hash error afterwards though but that might be unrelated.~~
Edit: Was unrelated, nix-update picked up a beta version and nix-build failed to download it.