home-manager: set services.emacs.package only if it is defined

Fixes #263
This commit is contained in:
László Vaskó
2021-07-27 17:02:36 +02:00
parent 418a0ab5bc
commit fee14d217b

View File

@ -1,8 +1,8 @@
{ self, ... }@inputs:
{ config, lib, pkgs, ... }:
{ options, config, lib, pkgs, ... }:
let
cfg = config.programs.doom-emacs;
inherit (lib) literalExample mkEnableOption mkIf mkOption types;
inherit (lib) literalExample mkEnableOption mkIf mkMerge mkOption optional types;
overlayType = lib.mkOptionType {
name = "overlay";
description = "Emacs packages overlay";
@ -89,6 +89,7 @@ in
dependencyOverrides = inputs;
};
in
mkMerge ([
{
home.file.".emacs.d/init.el".text = ''
(load "default.el")
@ -99,10 +100,13 @@ in
programs.emacs.package = emacs;
programs.emacs.enable = true;
# Set the service's package but don't enable. Leave that up to the user
services.emacs.package = emacs;
programs.doom-emacs.package = emacs;
}
]
# this option is not available on darwin platform.
++ optional (options.services ? emacs) {
# Set the service's package but don't enable. Leave that up to the user
services.emacs.package = emacs;
})
);
}