@TrisMcC
@beehaw.orgYes, I use home-manager
to manage my emacs packages, among other things. Here's the snippet that includes my emacs configuration. It's in a file called common.nix
which I include in my base linux.nix
and darwin,nix
configurations.
There is a bit dynamism in the config that makes lsp
or eglot
or vertico
configurations active. There is a bit at the bottom of my init.el
that includes those files if they are present. It's not the cleanest solution, but it's mine.
{ pkgs, ... }:
let
# myEmacs = if pkgs.stdenv.isDarwin then pkgs.emacsGit else pkgs.emacsPgtk;
myEmacs = pkgs.emacsGit;
useVertico = false;
useLsp = true;
emacsWithPackages = (pkgs.emacsPackagesFor myEmacs).emacsWithPackages;
in {
home.packages = [
pkgs.tree-sitter
pkgs.nixfmt
pkgs.ripgrep
pkgs.bc
pkgs.file
pkgs.syncthing
pkgs.streamlink
pkgs.unzip
(emacsWithPackages (epkgs:
[
(pkgs.callPackage ./copilot.nix {
inherit (pkgs) fetchFromGitHub;
inherit (epkgs) trivialBuild;
inherit (epkgs.nongnuPackages) editorconfig;
inherit (epkgs.melpaStablePackages) dash s;
})
] ++ (with epkgs.elpaPackages; [ transient ])
++ (with epkgs.nongnuPackages; [ go-mode magit markdown-mode webpaste ])
++ (with epkgs.melpaStablePackages; [
apheleia
deadgrep
emojify
eslint-disable-rule
flymake-eslint
minions
treesit-auto
]) ++ (with epkgs.melpaPackages; [ nix-mode org-roam git-timemachine ])
++ (if useLsp then
[ (with epkgs.melpaPackages; [ lsp-mode all-the-icons flycheck ]) ]
else
[ ]) ++ (if useVertico then
[
(with epkgs.elpaPackages; [
consult
corfu
embark
embark-consult
marginalia
orderless
vertico
])
]
else
[ ])))
] ++ (if useLsp then [ pkgs.emacs-all-the-icons-fonts ] else [ ]);
home.stateVersion = "22.11";
programs.home-manager.enable = true;
programs.bash = {
enable = true;
enableCompletion = true;
historyControl = [ "erasedups" "ignoredups" "ignorespace" ];
};
programs.btop.enable = true;
programs.dircolors.enable = true;
home.file = {
".gitignore_global".source = ./gitignore_global;
".emacs.d/init.el".source = ./init.el;
} // (if useVertico then {
".emacs.d/vertico.el".source = ./vertico.el;
} else
{ }) // (if useLsp then {
".emacs.d/lsp.el".source = ./lsp.el;
} else {
".emacs.d/eglot.el".source = ./eglot.el;
});
programs.git = {
enable = true;
extraConfig = {
core = { excludesFile = "~/.gitignore_global"; };
pull = { rebase = true; };
init = { defaultBranch = "main"; };
};
};
programs.htop.enable = true;
programs.less.enable = true;
programs.man.enable = true;
}