configs/emacs: allow disabling of emacs install

This commit is contained in:
Aaron Bieber 2024-09-30 18:31:46 -06:00
parent 87b8e0d9ad
commit 71e3925991
No known key found for this signature in database

View File

@ -1,10 +1,12 @@
{ pkgs { pkgs
, isUnstable , isUnstable
, lib , lib
, config
, ... , ...
}: }:
let let
myEmacs = pkgs.callPackage ../pkgs/emacs.nix { inherit isUnstable; }; myEmacs = pkgs.callPackage ../pkgs/emacs.nix { inherit isUnstable; };
cfg = config.myEmacs;
editorScript = pkgs.writeShellScriptBin "emacseditor" '' editorScript = pkgs.writeShellScriptBin "emacseditor" ''
if [ -z "$1" ]; then if [ -z "$1" ]; then
exec ${myEmacs}/bin/emacsclient --create-frame --alternate-editor ${myEmacs}/bin/emacs exec ${myEmacs}/bin/emacsclient --create-frame --alternate-editor ${myEmacs}/bin/emacs
@ -14,7 +16,13 @@ let
''; '';
in in
{ {
config = { options = {
myEmacs = {
enable = lib.mkEnableOption "Enable my emacs stuff";
default = true;
};
};
config = lib.mkIf cfg.enable {
environment = { environment = {
variables.EDITOR = lib.mkOverride 900 "emacseditor"; variables.EDITOR = lib.mkOverride 900 "emacseditor";
systemPackages = with pkgs; [ systemPackages = with pkgs; [