split home-manager into their own submodules

This commit is contained in:
Danilo Reyes
2026-03-16 15:49:43 -06:00
parent 14eed4f7f6
commit 28c8db6cb7
43 changed files with 1011 additions and 626 deletions

View 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;
}

View 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;
};
})
];
}

View 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";
};
};
}