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

Support removing python from zfs/grub closure #84129

Merged
merged 3 commits into from Apr 8, 2020

Conversation

infinisil
Copy link
Member

Motivation for this change

ZFS (and consequently grub) depends on python, I don't want that because it adds ~50M. With this PR you can remove python from its closure with the overlay

self: super: {
  zfs = super.zfs.override { enablePython = false; };
}

This overlay reduces the closure of grub2 from 249.9M to 190.7M, and the closure of ZFS from 236.0M to 176.7M.

No defaults were changed.

Ping @Mic92 @sorki @FRidh @edolstra @wkennington

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.

If turned off, all binaries that need python are excluded

With the argument disabled, this reduces closure size from 219.5M to
160.3M
@@ -16918,7 +16918,7 @@ in

zenpower = callPackage ../os-specific/linux/zenpower { };

inherit (callPackage ../os-specific/linux/zfs {
inherit (callPackages ../os-specific/linux/zfs {
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated to PR, but what's the difference between callPackage and callPackages

I could only find #36354 and what's in the source:

callPackages = lib.callPackagesWith splicedPackagesWithXorg;

but that still doesn't explain what's going on.

Copy link
Member Author

Choose a reason for hiding this comment

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

callPackage <file> is for when the file looks like

{ stdenv }: stdenv.mkDerivation { ... }

It makes the result of the call contain a .override attribute you can use to change the arguments.

callPackages <file> is for when the file looks like

{ stdenv }: {
  foo = stdenv.mkDerivation { ... };
  bar = stdenv.mkDerivation { ... };
}

It makes all the attributes of the result contain a .override attribute you can use to change the arguments for any package individually.

If callPackage is used on the latter, you'd get

{
  foo = ...;
  bar = ...;
  override = ...;
}

as a result, without any .override on the actual derivations, which is why you couldn't .override on pkgs.zfs before this change.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, that makes sense. I feel like this should be documented somewhere more formally.

Thank you for the explanation.

@Mic92
Copy link
Member

Mic92 commented Apr 3, 2020

Looks fine although I wonder what the usecase is because zfs is usually used on systems with plenty resources (RAM/storage space).

@infinisil
Copy link
Member Author

@Mic92 I'm using this on a system that gets deployed via DigitalOcean images (using #66978). The bigger the image, the longer it takes to upload (and possibly costs more and takes more time to load), so I'm trying to keep that to a minimum.

@jonringer
Copy link
Contributor

Looks fine although I wonder what the usecase is because zfs is usually used on systems with plenty resources (RAM/storage space)

I think it's still a good goal to have packages be minimally complete. Really impactful in a lot of cases where closure size has value.

@sorki
Copy link
Member

sorki commented Apr 3, 2020

+1 to minification. Regarding small systems ZFS is now enabled even on Raspberry Pi which doesn't seem very useful.

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

LGTM

failures are broken on master

https://github.com/NixOS/nixpkgs/pull/84129
6 package marked as broken and skipped:
linuxPackages_hardkernel_4_14.zfs linuxPackages_hardkernel_4_14.zfsStable linuxPackages_hardkernel_4_14.zfsUnstable linuxPackages_hardkernel_latest.zfs linuxPackages_hardkernel_latest.zfsStable linuxPackages_hardkernel_latest.zfsUnstable

7 package failed to build:
linuxPackages_5_6.zfs linuxPackages_latest-libre.zfs linuxPackages_latest_hardened.zfs linuxPackages_latest_xen_dom0.zfs linuxPackages_latest_xen_dom0_hardened.zfs linuxPackages_testing_bcachefs.zfs linuxPackages_testing_hardened.zfs

10 package built:
linuxPackages-libre.zfs linuxPackages.zfs linuxPackages_4_14.zfs linuxPackages_4_19.zfs linuxPackages_4_4.zfs linuxPackages_4_9.zfs linuxPackages_5_5.zfs linuxPackages_hardened.zfs linuxPackages_xen_dom0.zfs linuxPackages_xen_dom0_hardened.zfs

@infinisil
Copy link
Member Author

Hm wait, why does it rebuild stuff anyways, I don't think this should be

Reduces closure size with it disabled from 236.0M to 176.7M
@infinisil
Copy link
Member Author

Indeed, I had a mistake in there! I fixed it now, so there shouldn't be any rebuilds anymore.

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

LGTM

Nothing changed
https://github.com/NixOS/nixpkgs/pull/84129
$ nix-shell /home/jon/.cache/nixpkgs-review/pr-84129-1/shell.nix

@infinisil infinisil merged commit b293421 into NixOS:master Apr 8, 2020
@infinisil infinisil deleted the removing-python-from-grub branch April 8, 2020 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants