nix-update icon indicating copy to clipboard operation
nix-update copied to clipboard

error : `.../lib/attresets.nix` is not in `...-source`

Open traxys opened this issue 9 months ago • 3 comments

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];
  };
}

traxys avatar May 10 '24 08:05 traxys