Run emacs as a system daemon

Move emacs package definition (with emacsPackages) to system/emacs.nix
Keep user config in home-manager as emacs service is installed as user
service

Remove extra expressions (formatters, lsp_servers) and bring back into
default.nix

Move config/ directory contents up one level
This commit is contained in:
Evie Litherland-Smith 2023-10-24 09:56:35 +01:00
parent 8c33f140db
commit c549ee4f97
14 changed files with 117 additions and 213 deletions

View file

@ -1,13 +1,11 @@
{ config, pkgs, crafted-emacs, ... }: { config, pkgs, crafted-emacs, ... }:
{ {
imports = [ ./formatters.nix ./lsp_servers.nix ];
stylix.targets.emacs.enable = false; stylix.targets.emacs.enable = false;
xdg.configFile = { xdg.configFile = {
emacs = { "emacs/init.el".source = ./init.el;
source = ./config; "emacs/elfeed.org".source = ./elfeed.org;
recursive = true; "emacs/modules".source = ./modules;
};
"emacs/crafted-emacs".source = crafted-emacs; "emacs/crafted-emacs".source = crafted-emacs;
}; };
services.git-sync = { services.git-sync = {
@ -17,98 +15,48 @@
uri = "git+https://git.xenia.me.uk/xenia/Org.git"; uri = "git+https://git.xenia.me.uk/xenia/Org.git";
}; };
}; };
programs.emacs = {
enable = true;
package = with pkgs;
((emacsPackagesFor emacs29-pgtk).emacsWithPackages (epkgs:
with epkgs; [
# Theme
doom-themes
# completion-packages
cape
consult
corfu
corfu-terminal
embark
embark-consult
marginalia
orderless
vertico
# ide-packages
editorconfig
aggressive-indent
ibuffer-project
# custom
treesit-grammars.with-all-grammars
treesit-auto
apheleia
direnv
nix-mode
rust-mode
# org-packages
denote
org-appear
# ui-packages
all-the-icons
elisp-demos
helpful
# workspaces-packages
tabspaces
# writing-packages
markdown-mode
pandoc-mode
auctex
auctex-latexmk
# email-packages
notmuch
notmuch-indicator
# feed-packages
elfeed
elfeed-org
elfeed-webkit
elfeed-tube
elfeed-tube-mpv
# Additional packages
which-key
magit
vterm
]));
};
home = { home = {
packages = with pkgs; [ packages = with pkgs; [
# Emacs dependencies
coreutils
gnutls
ripgrep
cmake
fd
imagemagick
zstd
graphviz
zip
unzip
# Language-specific requirements # Language-specific requirements
(aspellWithDicts (ds: with ds; [ en en-computers en-science ]))
languagetool
wordnet
findutils
sqlite sqlite
pandoc pandoc
gfortran gfortran
rustup rustup
texlive.combined.scheme-medium texlive.combined.scheme-medium
python3 python3
# Linters
nodePackages.stylelint nodePackages.stylelint
# Formatters
nixfmt
beautysh
black
isort
nodePackages.fixjson
fprettify
shellharden
shfmt
stylua
python3Packages.mdformat
html-tidy
nodePackages.js-beautify
# LSP Servers
nixd
fortls
shellcheck
marksman
luajitPackages.lua-lsp
texlab
nodePackages.pyright
nodePackages.yaml-language-server
nodePackages.bash-language-server
nodePackages.javascript-typescript-langserver
nodePackages.vscode-html-languageserver-bin
nodePackages.vscode-css-languageserver-bin
nodePackages.vscode-json-languageserver-bin
nodePackages.dockerfile-language-server-nodejs
]; ];
}; };
} }

View file

@ -1,18 +0,0 @@
{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; [
nixfmt
beautysh
black
isort
nodePackages.fixjson
fprettify
shellharden
shfmt
stylua
python3Packages.mdformat
html-tidy
nodePackages.js-beautify
];
}

View file

@ -1,20 +0,0 @@
{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; [
nixd
fortls
shellcheck
marksman
luajitPackages.lua-lsp
texlab
nodePackages.pyright
nodePackages.yaml-language-server
nodePackages.bash-language-server
nodePackages.javascript-typescript-langserver
nodePackages.vscode-html-languageserver-bin
nodePackages.vscode-css-languageserver-bin
nodePackages.vscode-json-languageserver-bin
nodePackages.dockerfile-language-server-nodejs
];
}

View file

@ -1,86 +0,0 @@
{ config, lib, pkgs, ... }:
# Usage:
# pkgs.tree-sitter.withPlugins (p: [ p.tree-sitter-c p.tree-sitter-java ... ])
#
# or for all grammars:
# pkgs.tree-sitter.withPlugins (_: allGrammars)
# which is equivalent to
# pkgs.tree-sitter.withPlugins (p: builtins.attrValues p)
{
home.packages = [
(pkgs.tree-sitter.withPlugins (p:
with p; [
tree-sitter-bash
tree-sitter-bibtex
tree-sitter-css
tree-sitter-dockerfile
tree-sitter-elisp
tree-sitter-fortran
tree-sitter-html
tree-sitter-javascript
tree-sitter-json
tree-sitter-latex
tree-sitter-llvm
tree-sitter-lua
tree-sitter-make
tree-sitter-markdown
tree-sitter-nix
tree-sitter-python
tree-sitter-regex
tree-sitter-rst
tree-sitter-rust
tree-sitter-scss
tree-sitter-toml
tree-sitter-typescript
tree-sitter-yaml
]))
];
xdg.configFile."tree-sitter/config.json".text = builtins.toJSON {
parser-directories = [ ];
theme = {
"type.builtin" = {
color = 23;
bold = true;
};
variable.parameter = { underline = true; };
comment = {
color = 245;
italic = true;
};
constructor = 136;
"string.special" = 30;
variable.builtin = { bold = true; };
"constant.builtin" = {
bold = true;
color = 94;
};
"function.builtin" = {
color = 26;
bold = true;
};
function = 26;
attribute = {
color = 124;
italic = true;
};
constant = 94;
punctuation.delimiter = 239;
type = 23;
operator = {
bold = true;
color = 239;
};
punctuation.bracket = 239;
keyword = 56;
string = 28;
property = 124;
number = {
bold = true;
color = 94;
};
embedded = null;
module = 136;
tag = 18;
};
};
}

View file

@ -107,7 +107,7 @@ in ''
# Common program shortcuts # Common program shortcuts
bind = SUPER, Space, exec, pkill anyrun || anyrun bind = SUPER, Space, exec, pkill anyrun || anyrun
bind = SUPER, E, exec, emacs bind = SUPER, E, exec, emacsclient -c -a "alacritty -e nano"
bind = SUPER, Return, exec, alacritty bind = SUPER, Return, exec, alacritty
bind = SUPER SHIFT, Return, exec, [float] alacritty bind = SUPER SHIFT, Return, exec, [float] alacritty

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ ./default.nix ./firefox.nix ]; imports = [ ./default.nix ./emacs.nix ./firefox.nix ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
dex dex
mesa mesa

80
system/emacs.nix Normal file
View file

@ -0,0 +1,80 @@
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
coreutils
fd
ripgrep
imagemagick
languagetool
wordnet
(aspellWithDicts (ds: with ds; [ en en-computers en-science ]))
];
services.emacs = {
enable = true;
install = true;
package = with pkgs;
((emacsPackagesFor emacs29-pgtk).emacsWithPackages (epkgs:
with epkgs; [
# Theme
doom-themes
# completion-packages
cape
consult
corfu
corfu-terminal
embark
embark-consult
marginalia
orderless
vertico
# ide-packages
editorconfig
aggressive-indent
ibuffer-project
# custom
treesit-grammars.with-all-grammars
treesit-auto
apheleia
direnv
nix-mode
rust-mode
# org-packages
denote
org-appear
# ui-packages
all-the-icons
elisp-demos
helpful
# workspaces-packages
tabspaces
# writing-packages
markdown-mode
pandoc-mode
auctex
auctex-latexmk
# email-packages
notmuch
notmuch-indicator
# feed-packages
elfeed
elfeed-org
elfeed-webkit
elfeed-tube
elfeed-tube-mpv
# Additional packages
which-key
magit
vterm
]));
};
}