Skip to content

Commit

Permalink
emacs: add overrides option
Browse files Browse the repository at this point in the history
This option enables overriding packages within the generated Emacs
package set.

Fixes nix-community#486
  • Loading branch information
rycee authored and marzipankaiser committed Dec 18, 2018
1 parent 80b5828 commit 1052e51
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions modules/programs/emacs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 1052e51

Please sign in to comment.