2017-01-07 18:16:26 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2018-12-29 20:21:11 +00:00
|
|
|
hmTypes = import ../lib/types.nix { inherit lib; };
|
|
|
|
|
2017-01-07 18:16:26 +00:00
|
|
|
cfg = config.programs.emacs;
|
|
|
|
|
2018-12-17 22:01:43 +00:00
|
|
|
# Copied from all-packages.nix, with modifications to support
|
|
|
|
# overrides.
|
|
|
|
emacsPackages =
|
|
|
|
let
|
|
|
|
epkgs = pkgs.emacsPackagesNgGen cfg.package;
|
|
|
|
in
|
|
|
|
epkgs.overrideScope' cfg.overrides;
|
2017-09-19 21:32:01 +00:00
|
|
|
emacsWithPackages = emacsPackages.emacsWithPackages;
|
|
|
|
|
2017-01-07 18:16:26 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2017-09-26 21:40:31 +00:00
|
|
|
meta.maintainers = [ maintainers.rycee ];
|
|
|
|
|
2017-01-07 18:16:26 +00:00
|
|
|
options = {
|
|
|
|
programs.emacs = {
|
|
|
|
enable = mkEnableOption "Emacs";
|
|
|
|
|
2017-09-19 21:32:01 +00:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.emacs;
|
|
|
|
defaultText = "pkgs.emacs";
|
|
|
|
example = literalExample "pkgs.emacs25-nox";
|
|
|
|
description = "The Emacs package to use.";
|
|
|
|
};
|
|
|
|
|
2017-01-07 18:16:26 +00:00
|
|
|
extraPackages = mkOption {
|
|
|
|
default = self: [];
|
2018-12-29 20:21:11 +00:00
|
|
|
type = hmTypes.selectorFunction;
|
2017-11-12 23:03:49 +00:00
|
|
|
defaultText = "epkgs: []";
|
|
|
|
example = literalExample "epkgs: [ epkgs.emms epkgs.magit ]";
|
2019-08-18 11:33:34 +00:00
|
|
|
description = ''
|
|
|
|
Extra packages available to Emacs. To get a list of
|
|
|
|
available packages run:
|
|
|
|
<command>nix-env -f '<nixpkgs>' -qaP -A emacsPackagesNg</command>.
|
|
|
|
'';
|
2017-01-07 18:16:26 +00:00
|
|
|
};
|
2018-09-11 19:23:11 +00:00
|
|
|
|
2018-12-17 22:01:43 +00:00
|
|
|
overrides = mkOption {
|
|
|
|
default = self: super: {};
|
2018-12-29 20:21:11 +00:00
|
|
|
type = hmTypes.overlayFunction;
|
2018-12-17 22:01:43 +00:00
|
|
|
defaultText = "self: super: {}";
|
|
|
|
example = literalExample ''
|
|
|
|
self: super: rec {
|
|
|
|
haskell-mode = self.melpaPackages.haskell-mode;
|
|
|
|
# ...
|
|
|
|
};
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
Allows overriding packages within the Emacs package set.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-09-11 19:23:11 +00:00
|
|
|
finalPackage = mkOption {
|
|
|
|
type = types.package;
|
2019-01-03 01:15:17 +00:00
|
|
|
visible = false;
|
2018-09-11 19:23:11 +00:00
|
|
|
readOnly = true;
|
2019-01-03 01:15:17 +00:00
|
|
|
description = ''
|
|
|
|
The Emacs package including any overrides and extra packages.
|
|
|
|
'';
|
2018-09-11 19:23:11 +00:00
|
|
|
};
|
2017-01-07 18:16:26 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2018-09-11 19:23:11 +00:00
|
|
|
home.packages = [ cfg.finalPackage ];
|
|
|
|
programs.emacs.finalPackage = emacsWithPackages cfg.extraPackages;
|
2017-01-07 18:16:26 +00:00
|
|
|
};
|
|
|
|
}
|