From dc9be1eee687d9a5519221fbc5a37de7e03e1ea7 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 17 Dec 2018 23:01:43 +0100 Subject: [PATCH] emacs: add `overrides` option This option enables overriding packages within the generated Emacs package set. Fixes #486 (cherry picked from commit e68d6e7924925b28ddd46bd7748be7aa3e5c57bd) --- modules/programs/emacs.nix | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/programs/emacs.nix b/modules/programs/emacs.nix index 87f47a76..751fc435 100644 --- a/modules/programs/emacs.nix +++ b/modules/programs/emacs.nix @@ -6,8 +6,13 @@ let cfg = config.programs.emacs; - # Copied from all-packages.nix. - emacsPackages = pkgs.emacsPackagesNgGen cfg.package; + # Copied from all-packages.nix, with modifications to support + # overrides. + emacsPackages = + let + epkgs = pkgs.emacsPackagesNgGen cfg.package; + in + epkgs.overrideScope' cfg.overrides; emacsWithPackages = emacsPackages.emacsWithPackages; in @@ -34,6 +39,20 @@ in description = "Extra packages available to Emacs."; }; + overrides = mkOption { + default = self: super: {}; + defaultText = "self: super: {}"; + example = literalExample '' + self: super: rec { + haskell-mode = self.melpaPackages.haskell-mode; + # ... + }; + ''; + description = '' + Allows overriding packages within the Emacs package set. + ''; + }; + finalPackage = mkOption { type = types.package; internal = true;