2017-01-07 19:16:26 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.emacs;
|
|
|
|
|
2018-12-17 23:01:43 +01: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 23:32:01 +02:00
|
|
|
emacsWithPackages = emacsPackages.emacsWithPackages;
|
|
|
|
|
2017-01-07 19:16:26 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2017-09-26 23:40:31 +02:00
|
|
|
meta.maintainers = [ maintainers.rycee ];
|
|
|
|
|
2017-01-07 19:16:26 +01:00
|
|
|
options = {
|
|
|
|
programs.emacs = {
|
|
|
|
enable = mkEnableOption "Emacs";
|
|
|
|
|
2017-09-19 23:32:01 +02: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 19:16:26 +01:00
|
|
|
extraPackages = mkOption {
|
|
|
|
default = self: [];
|
2017-11-13 00:03:49 +01:00
|
|
|
defaultText = "epkgs: []";
|
|
|
|
example = literalExample "epkgs: [ epkgs.emms epkgs.magit ]";
|
2019-08-18 13:33:34 +02: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 19:16:26 +01:00
|
|
|
};
|
2018-09-11 21:23:11 +02:00
|
|
|
|
2018-12-17 23:01:43 +01:00
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-09-11 21:23:11 +02:00
|
|
|
finalPackage = mkOption {
|
|
|
|
type = types.package;
|
2019-01-03 02:15:17 +01:00
|
|
|
visible = false;
|
2018-09-11 21:23:11 +02:00
|
|
|
readOnly = true;
|
2019-01-03 02:15:17 +01:00
|
|
|
description = ''
|
|
|
|
The Emacs package including any overrides and extra packages.
|
|
|
|
'';
|
2018-09-11 21:23:11 +02:00
|
|
|
};
|
2017-01-07 19:16:26 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2018-09-11 21:23:11 +02:00
|
|
|
home.packages = [ cfg.finalPackage ];
|
|
|
|
programs.emacs.finalPackage = emacsWithPackages cfg.extraPackages;
|
2017-01-07 19:16:26 +01:00
|
|
|
};
|
|
|
|
}
|