mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 13:13:26 +00:00
e68d6e7924
This option enables overriding packages within the generated Emacs package set. Fixes #486
70 lines
1.6 KiB
Nix
70 lines
1.6 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.emacs;
|
|
|
|
# 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
|
|
|
|
{
|
|
meta.maintainers = [ maintainers.rycee ];
|
|
|
|
options = {
|
|
programs.emacs = {
|
|
enable = mkEnableOption "Emacs";
|
|
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = pkgs.emacs;
|
|
defaultText = "pkgs.emacs";
|
|
example = literalExample "pkgs.emacs25-nox";
|
|
description = "The Emacs package to use.";
|
|
};
|
|
|
|
extraPackages = mkOption {
|
|
default = self: [];
|
|
defaultText = "epkgs: []";
|
|
example = literalExample "epkgs: [ epkgs.emms epkgs.magit ]";
|
|
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;
|
|
readOnly = true;
|
|
description = "The Emacs package including any extra packages.";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.packages = [ cfg.finalPackage ];
|
|
|
|
programs.emacs.finalPackage = emacsWithPackages cfg.extraPackages;
|
|
};
|
|
}
|