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

khal: standardize derivation #85993

Closed
wants to merge 7 commits into from
Closed

Conversation

@doronbehar
Copy link
Contributor

doronbehar commented Apr 25, 2020

Motivation for this change

A few days ago, when updating all of my packages, I encountered build errors for khal / vdirsyncer mostly due to failing tests. When quickly patching an overlay to fix that, I noticed a few bad things in khal's default.nix:

  1. pkgs is an argument to the derivation. This is not good because:
    • It's harder to change an input used inside khal such as pkgs.vdirsyncer. You have to use:
khal = super.khal.override {
  pkgs = pkgs // {
    vdirsyncer = vdirsyncer.override { ... };
  };
}
  • I think that If you override another derivation via another overlay, that doesn't apply to what passed to that pkgs argument.
  1. There's a with python3.pkgs; at the top - which makes it hard to derive python deps and non python deps (readability).
  2. pkgs.vdirsyncer was used in propagatedBuildInputs. This is bad because:
    • it is required only for tests and although used frequently together along with khal, it isn't strictly required by it to run.
    • It increases closure size if somebody uses vdirsyncerStable.

Now, on master (without this PR) the tests don't fail but I strongly think this change is beneficial, for general maintainability and conformism with other unwritten conventions in Nixpkgs.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@doronbehar
Copy link
Contributor Author

doronbehar commented Apr 25, 2020

pkgs/top-level/all-packages.nix Outdated Show resolved Hide resolved
@veprbl
Copy link
Member

veprbl commented Apr 25, 2020

There's a with python3.pkgs; at the top - which makes it hard to derive python deps and non python deps (readability)

How this improves the situation?

@doronbehar doronbehar force-pushed the doronbehar:improve-khal branch from 6cd0f03 to 56b6fd0 Apr 25, 2020
@doronbehar doronbehar requested review from FRidh and jonringer as code owners Apr 25, 2020
@doronbehar doronbehar force-pushed the doronbehar:improve-khal branch from 56b6fd0 to b464d2a Apr 25, 2020
@ofborg ofborg bot added the 6.topic: python label Apr 25, 2020
Copy link
Member

FRidh left a comment

If they need to be used as libraries, add them there. If they're also used as applications, use toPythonApplication in all-packages.nix.

@doronbehar doronbehar force-pushed the doronbehar:improve-khal branch 2 times, most recently from e7c9538 to 4ea8d2a Apr 26, 2020
pkgs/top-level/python-packages.nix Outdated Show resolved Hide resolved
@doronbehar doronbehar force-pushed the doronbehar:improve-khal branch from 29eb95d to a0c0ce3 Apr 26, 2020
@ofborg ofborg bot requested a review from loewenheim Apr 26, 2020
@doronbehar
Copy link
Contributor Author

doronbehar commented Apr 26, 2020

BTW @FRidh I encountered that overrideAttrs issue while encountering an issue where the tests failed for vdirsyncer. This PR might fix it so please if you could take 1 more look here.

@doronbehar doronbehar mentioned this pull request May 1, 2020
4 of 10 tasks complete
doronbehar added 5 commits Apr 25, 2020
Use toPythonApplication and use callPackage from python-packages.nix.
Make vdirsyncerStable somewhat functional again, but mark it as broken
for Python 3.6 or higher.
Don't know why they were there in the first place :/.
@doronbehar doronbehar force-pushed the doronbehar:improve-khal branch from 60f4c74 to 00ebca7 May 14, 2020
@doronbehar
Copy link
Contributor Author

doronbehar commented May 14, 2020

@FRidh I know it's been a long time but this is still bothering me. Also, today I noticed todoman references glibLocales which is ~210Mb in size. Commit 2260aed in this PR fixes this.

@doronbehar
Copy link
Contributor Author

doronbehar commented May 15, 2020

I'm closing in favor of smaller PRs which hopefully will be easier to review.

@doronbehar doronbehar closed this May 15, 2020
@doronbehar doronbehar deleted the doronbehar:improve-khal branch May 15, 2020
@doronbehar doronbehar mentioned this pull request May 15, 2020
5 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.