NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.75k stars 13.87k forks source link

Run time closure of duplicity includes mesa drivers #118410

Open gebner opened 3 years ago

gebner commented 3 years ago

To reproduce:

$ nix path-info -r (nix-build '<nixpkgs>' -A duplicity) | grep mesa
/nix/store/0inxqcjpcfw1syksd7d3w6s0kzm6g897-mesa-20.3.4-dev
/nix/store/a71113rnbykvfmapskscmivnd8i8bcqx-mesa-20.3.4
/nix/store/vh0k8fflhd32mvjb717k3alnsl33hwil-mesa-20.3.4-drivers

duplicity is a small command-line backup program, so this is a bit surprising to say the least. Even if it depended on some graphics libraries, I would have maybe expected glvnd to show up. But the actual mesa drivers is a bit too much. There seem to be several surprising issues here:

  1. The python wrappers automatically add the whole build-time PATH from the propagated build inputs to the wrapper. #102613 might help a bit here.
  2. cairo puts a whole lot of libraries into propagatedBuildInputs, including libGL. Even if they don't end up in the wrapper, they are written to nix-support/propagated-build-inputs.
  3. libGL.dev then depends on the mesa drivers, because the mesa pkg-config files depend on the drivers.

I don't really know where to start fixing this issue.

FRidh commented 3 years ago

We need to get rid of propagatedBuildInputs for Python packages entirely. https://github.com/NixOS/nixpkgs/pull/102613 shows how it could be done. After an RFC discussion on overriding of derivations I concluded we should use less Nix and instead use a file such as $out/nix-support/python-packages so https://github.com/NixOS/nixpkgs/pull/102613 won't go in.

gebner commented 3 years ago

Some other surprising observations:

  1. propagatedBuildInputs = [ pyobject3.out ]; means exactly the same as propagatedBuildInputs = [ pyobject3 ];. So you always have a dependency on the C headers of a python extension, whether you want them or not.
  2. Adding outputs = [ "out" "dev" ]; to duplicity breaks the python wrapper.
gebner commented 3 years ago

Related: checkInputs are in the runtime closure as well #118452

FRidh commented 3 years ago

Should update https://github.com/NixOS/nixpkgs/issues/1819 again, its been a while.

FRidh commented 3 years ago

Adding outputs = [ "out" "dev" ]; to duplicity breaks the python wrapper.

This was noticed in the past with if I recall correctly requests and some other packages. A work-around is to use pythonPath instead of propagatedBuildInputs.

SuperSandro2000 commented 3 years ago

Can this be closed?

gebner commented 3 years ago

Can this be closed?

I've fixed the closure size in #118459 and the mesa issue in #118479. But I'd still like some comments on propagatedBuildInputs.

FRidh commented 3 years ago
  1. https://github.com/NixOS/nixpkgs/pull/102613#discussion_r518265183. It could use a PR.
  2. https://github.com/NixOS/nixpkgs/pull/102613
  3. This confuses me. The dependent will not create a propagated-build-inputs, unless it also declares propagatedBuildInputs.

I should write out once how things work now and what should change.

gebner commented 3 years ago

This confuses me. The dependent will not create a propagated-build-inputs, unless it also declares propagatedBuildInputs.

Then I was also confused, sorry. This behavior sounds great, actually. If we move python away from propagatedBuildInputs, then this issue will be automatically gone.