Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tooling & documentation for dealing with file collisions #220

Open
adisbladis opened this issue Dec 25, 2024 · 0 comments
Open

Add tooling & documentation for dealing with file collisions #220

adisbladis opened this issue Dec 25, 2024 · 0 comments

Comments

@adisbladis
Copy link
Member

Problem

It's a relatively common packaging bug to write files such as README.txt & LICENSE outside of the intended directories:

       > FileCollisionError: Two or more packages are trying to provide the same file with different contents
       >
       >         Files: /nix/store/76fd84qmzg7n9w5yif61cmv5rr80i686-alive-progress-3.2.0/LICENSE /nix/store/r4hn0hx1bjdrshik3cw9f6h33vwk7iii-about-time-4.2.1/LICENSE

You can already work around around this issue by overriding a package & deleting the colliding files from the origin package:

pyprojectOverrides = final: prev: {
  alive-progress = prev.alive-progress.overrideAttrs(_: { postInstall = "rm $out/LICENSE"; });
  about-time = prev.about-time.overrideAttrs(_: { postInstall = "rm $out/LICENSE"; });
}

But this is less than ideal and should be able to be fixed in the venv creation script instead.

Solutions

I see three possible, not mutually exclusive, solutions to the problem in the venv creation:

  • Ignore collisions for a certain path:
(mkVirtualEnv "foo-env" { foo = []; }).overrideAttrs(old: {
  venvIgnoreCollisions = [
    "lib/python${final.python.pythonVersion}/site-packages/build_tools"
  ];
})
  • Skip a path completely:
(mkVirtualEnv "foo-env" { foo = []; }).overrideAttrs(old: {
  venvSkip = [
    "lib/python${final.python.pythonVersion}/site-packages/build_tools"
  ];
})
  • Control which path is the origin for a certain path:
(mkVirtualEnv "foo-env" { foo = []; }).overrideAttrs(old: {
  venvOverrides = {
    "lib/python${final.python.pythonVersion}/site-packages/build_tools" = "${pythonSet.foo}/lib/python${final.python.pythonVersion}/site-packages/build_tools";
  };
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant