split home-manager into their own submodules
This commit is contained in:
44
modules/dev/emacs/common.nix
Normal file
44
modules/dev/emacs/common.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
stylixEnabled,
|
||||
emacsExtraConfig,
|
||||
emacsExtraPackages,
|
||||
}:
|
||||
{
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs.xorg) xwininfo;
|
||||
inherit (pkgs)
|
||||
xdotool
|
||||
xclip
|
||||
wl-clipboard-rs
|
||||
fd
|
||||
fzf
|
||||
ripgrep
|
||||
tree-sitter
|
||||
graphviz
|
||||
tetex
|
||||
languagetool
|
||||
yaml-language-server
|
||||
markdownlint-cli
|
||||
;
|
||||
inherit (pkgs.nodePackages)
|
||||
vscode-json-languageserver
|
||||
prettier
|
||||
;
|
||||
};
|
||||
extraPackages =
|
||||
epkgs:
|
||||
let
|
||||
extra = emacsExtraPackages epkgs;
|
||||
themes = lib.optional stylixEnabled [
|
||||
(epkgs.trivialBuild {
|
||||
pname = "stylix-theme";
|
||||
src = pkgs.writeText "stylix-theme.el" emacsExtraConfig;
|
||||
version = "0.1.0";
|
||||
packageRequires = extra;
|
||||
})
|
||||
];
|
||||
in
|
||||
extra ++ themes;
|
||||
}
|
||||
61
modules/dev/emacs/home.nix
Normal file
61
modules/dev/emacs/home.nix
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
osConfig ? null,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
shellType = inputs.self.lib.hmShellType config osConfig;
|
||||
hm = inputs.self.lib.hmModule {
|
||||
inherit
|
||||
config
|
||||
inputs
|
||||
osConfig
|
||||
;
|
||||
optionPath = [ "emacs" ];
|
||||
};
|
||||
cfg = config.my.emacs;
|
||||
emacs = import ./common.nix {
|
||||
inherit lib pkgs;
|
||||
stylixEnabled = if osConfig == null then false else osConfig.my.stylix.enable;
|
||||
emacsExtraConfig = config.programs.emacs.extraConfig;
|
||||
emacsExtraPackages = config.programs.emacs.extraPackages;
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ inputs.doom-emacs.homeModule ];
|
||||
options.my.emacs.enable = lib.mkEnableOption "Doom Emacs configuration";
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
my.emacs.enable = lib.mkDefault hm.enabledByDefault;
|
||||
}
|
||||
(lib.mkIf cfg.enable {
|
||||
home.packages = emacs.packages;
|
||||
xdg.dataFile = {
|
||||
"doom/templates/events.org".source = ../../../dotfiles/doom/templates/events.org;
|
||||
"doom/templates/default.org".source = ../../../dotfiles/doom/templates/default.org;
|
||||
"doom/templates/programming.org".source = ../../../dotfiles/doom/templates/programming.org;
|
||||
};
|
||||
services = {
|
||||
lorri.enable = true;
|
||||
emacs = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
};
|
||||
};
|
||||
programs.${shellType}.shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases {
|
||||
edit = "emacsclient -t";
|
||||
e = "edit";
|
||||
};
|
||||
programs.doom-emacs = {
|
||||
enable = true;
|
||||
doomDir = ../../../dotfiles/doom;
|
||||
doomLocalDir = "${config.xdg.dataHome}/nix-doom";
|
||||
tangleArgs = "--all config.org";
|
||||
inherit (emacs) extraPackages;
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
16
modules/dev/emacs/nixos.nix
Normal file
16
modules/dev/emacs/nixos.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.my.emacs = {
|
||||
enable = lib.mkEnableOption "Doom Emacs configuration";
|
||||
users = lib.mkOption {
|
||||
type = inputs.self.lib.usersOptionType lib;
|
||||
default = config.my.toggleUsers.dev;
|
||||
description = "Users to install Emacs packages for";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user