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

Upstream overrides #1796

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

PerchunPak
Copy link

These are overrides I made for my projects, just upstreaming them

@PerchunPak PerchunPak force-pushed the upstream-overrides branch 2 times, most recently from a298ba5 to f984ba5 Compare September 6, 2024 18:01
in
{
inherit src;
cargoDeps = pkgs.rustPlatform.importCargoLock {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is using IFD. Please use cargoVendorHash instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean cargoHash? I cannot find anything about cargoVendorHash in nixpkgs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you meant pkgs.rustPlatform.fetchCargoTarball, but why? importCargoLock gives an ability to have less maintenance burden because of not having hash for every single release. This would still be reproducible, as hashes are in poetry.lock, but also will make that any new version of libcst is automatically supported:

libcst = prev.libcst.overridePythonAttrs (
  old: lib.optionalAttrs (!(old.src.isWheel or false)) (
    let
      unpackedSrc = stdenv.mkDerivation {
        name = "unpacked-${old.src.name}";
        inherit (old) src;
        buildPhase = "cp -r . $out";
      };
    in
    {
      cargoDeps = pkgs.rustPlatform.importCargoLock {
        lockFile = "${unpackedSrc.out}/native/Cargo.lock";
      };
      cargoRoot = "native";
      nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
        pkgs.rustPlatform.cargoSetupHook # handles `importCargoLock`
        pkgs.rustc
        pkgs.cargo
      ];
    }
  )
);

There are also multiple other places, where poetry2nix could automatically get dependencies, but instead you chose to manually add them to every package. E.g. if poetry or setuptools are required for build: https://github.com/py-mine/mcstatus/blob/0bbd4842178fa1db252371ce5599651e4b867efd/pyproject.toml#L164

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adisbladis can you elaborate?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learned about IFD since then and will try to fix the issue

@PerchunPak
Copy link
Author

Should I add an IFD alternative for versions older than 1.0.0? (libcst is not that popular after all)

$ du -sh overrides/libcst
348K	overrides/libcst

gitpython = prev.gitpython.overridePythonAttrs {
postPatch = ''
substituteInPlace git/cmd.py \
--replace 'git_exec_name = "git"' 'git_exec_name = "${pkgs.gitMinimal}/bin/git"'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gitpython should not decide on it's own to pull in a specific git as a dependency imo

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How it will function then? It is a general approach to patch packages to provide their dependencies without propagating them. You can change git version used using an overlay

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provide the git binary in PATH or override the variable in your application code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not expect gitpython the python package to install git for me

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it was introduced 6 years ago in upstream: NixOS/nixpkgs#41844

I guess I'm fine with this behaviour then

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

Successfully merging this pull request may close these issues.

4 participants