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

emacsPackages*: Move to emacs*.pkgs #107152

Merged
merged 2 commits into from
Jan 13, 2021

Conversation

adisbladis
Copy link
Member

@adisbladis adisbladis commented Dec 18, 2020

Motivation for this change

This makes it much easier to create customisations around emacs via
the two new convenience passthru attrs:

  • emacs.pkgs.withPackages: like emacsWithPackages but now exists on all emacsen derivations
  • emacs.pkgs: What used to be emacsPackages is now emacs.pkgs

The previous versioned names emacs*Packages have been moved to
aliases.nix and are now considered deprecated in favour of emacs*.pkgs.

I believe that it's much easier to use this API correctly than the previous API.
I also believe that this provides a much better UX which is more symmetrical (the -nox derivations did not have package sets available, so if you wanted to use emacsWithPackages with them you had to figure it out on your own), but I'm open to inputs on something I might have missed or other perspectives.

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.

cc @etu @bqv @alyssais @bendlas @tadfisher
Also cc @FRidh for how this possibly could be replicated for the Python package sets (to be clear I'm talking about deprecation of the python*Packages names).

@adisbladis adisbladis marked this pull request as draft December 18, 2020 13:49
@FRidh
Copy link
Member

FRidh commented Dec 18, 2020

set which contains emacs.withPackages. For example, to override
emacs.pkgs.emacs.withPackages,

This is the reason we have with Python let mypython = python3.override { self = mypython;}; in mypython;. An alternative to this or having to write python3.pkgs.python.withPackages is to move withPackages into the package set like Haskell does it, so you get python3.pkgs.withPackages. I find the Haskell approach clearest.

@bqv
Copy link
Contributor

bqv commented Dec 18, 2020

No reason python3.withPackages couldn't be the endorsed way, no?

@FRidh
Copy link
Member

FRidh commented Dec 19, 2020

No reason python3.withPackages couldn't be the endorsed way, no?

Maybe I wasn't clear enough. With the approach in this PR, one has to use python3.pkgs.python.withPackages if overrides need to be taken into account. There is still a python3.withPackages but that won't consider the overrides unless one uses let mypython = python3.override { self = mypython;}; in mypython;.. This has caused quite some confusion, and that is why I think the Haskell approach is clearest.

@FRidh
Copy link
Member

FRidh commented Dec 19, 2020

Related PR for PHP #107044. We really need to converge on a single interface here (partially NixOS/rfcs#67).

@FRidh
Copy link
Member

FRidh commented Dec 19, 2020

Wrote a draft for an RFC on this topic NixOS/rfcs#83.

@ofborg ofborg bot added 6.topic: emacs Text editor 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Dec 20, 2020
This makes it much easier to create customisations around emacs via
the a new convenience passthru attr:
- `emacs.pkgs`: What used to be emacsPackages is now `emacs.pkgs`

The previous versioned names `emacs*Packages` have been moved to
aliases.nix and are now considered deprecated in favour of `emacs*.pkgs`.
…gs.withPackages

The previous names are now aliases and shouldn't be used anywhere inside nixpkgs.
@adisbladis adisbladis marked this pull request as ready for review January 13, 2021 16:13
@FRidh
Copy link
Member

FRidh commented Jan 13, 2021

@adisbladis and I had a short chat. RFC 83 will still take a while, and this follows the spirit of it very closely. The most invasive possible change would likely be emacs.pkgs versus emacsPackages, but its too early to say. Let's not wait on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: emacs Text editor 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants