2017-01-07 19:16:26 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.emacs;
|
|
|
|
|
2017-09-19 23:32:01 +02:00
|
|
|
# Copied from all-packages.nix.
|
|
|
|
emacsPackages = pkgs.emacsPackagesNgGen cfg.package;
|
|
|
|
emacsWithPackages = emacsPackages.emacsWithPackages;
|
|
|
|
|
2017-01-07 19:16:26 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
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: [];
|
|
|
|
example = literalExample ''
|
|
|
|
epkgs: [ epkgs.emms epkgs.magit ]
|
|
|
|
'';
|
|
|
|
description = "Extra packages available to Emacs.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2017-09-19 23:32:01 +02:00
|
|
|
home.packages = [ (emacsWithPackages cfg.extraPackages) ];
|
2017-01-07 19:16:26 +01:00
|
|
|
};
|
|
|
|
}
|