try to make things a little nicer

Signed-off-by: Xe <me@christine.website>
This commit is contained in:
Cadey Ratio 2023-01-14 22:48:17 -05:00
parent 245aa77ee3
commit b5a8d195d2
3 changed files with 157 additions and 4 deletions

View File

@ -6,7 +6,7 @@ let cfg = config.within.emacs;
in {
options.within.emacs.enable =
mkEnableOption "emacs without spacemacs support";
imports = [ ./emacs-init.nix ];
imports = [ ./emacs-init.nix ./emacs-init-defaults.nix ];
config = mkIf cfg.enable {
home.file."bin/e" = {
@ -387,7 +387,6 @@ in {
org-roam-ui.enable = true;
org-roam-protocol.enable = true;
weechat.enable = true;
systemd.enable = true;
gemini-mode.enable = true;

View File

@ -0,0 +1,144 @@
# A collection of "uncontroversial" configurations for selected packages.
{ pkgs, lib, config, ... }:
{
programs.emacs.init.usePackage = {
cmake-mode.mode = [
''"\\.cmake\\'"'' # \
''"CMakeLists.txt\\'"''
];
csharp-mode.mode = [ ''"\\.cs\\'"'' ];
cue-mode = {
package = epkgs:
epkgs.trivialBuild {
pname = "cue-mode.el";
src = pkgs.fetchurl {
url =
"https://raw.githubusercontent.com/russell/cue-mode/9c803ee8fa4a6e99c7dc9ae373c6178569583b7a/cue-mode.el";
sha256 = "0swhpknkg1vwbchblzrwynixf5grg95jy1bkc8w92yfpb1jch7m7";
};
preferLocalBuild = true;
allowSubstitutes = true;
};
command = [ "cue-mode" ];
mode = [ ''"\\.cue\\'"'' ];
hook = [ "(cue-mode . subword-mode)" ];
};
dap-lldb = {
config = ''
(setq dap-lldb-debug-program "${pkgs.lldb}/bin/lldb-vscode")
'';
};
deadgrep = {
config = ''
(setq deadgrep-executable "${pkgs.ripgrep}/bin/rg")
'';
};
dhall-mode.mode = [ ''"\\.dhall\\'"'' ];
dockerfile-mode.mode = [ ''"Dockerfile\\'"'' ];
elm-mode.mode = [ ''"\\.elm\\'"'' ];
emacsql-sqlite3 = {
enable =
lib.mkDefault config.programs.emacs.init.usePackage.org-roam.enable;
defer = lib.mkDefault true;
config = ''
(setq emacsql-sqlite3-executable "${pkgs.sqlite}/bin/sqlite3")
'';
};
ggtags = {
config = ''
(setq ggtags-executable-directory "${pkgs.global}/bin")
'';
};
idris-mode = {
mode = [ ''"\\.idr\\'"'' ];
config = ''
(setq idris-interpreter-path "${pkgs.idris}/bin/idris")
'';
};
kotlin-mode = {
mode = [ ''"\\.kts?\\'"'' ];
hook = [ "(kotlin-mode . subword-mode)" ];
};
latex.mode = [ ''("\\.tex\\'" . latex-mode)'' ];
lsp-eslint = {
config = ''
(setq lsp-eslint-server-command '("node" "${pkgs.vscode-extensions.dbaeumer.vscode-eslint}/share/vscode/extensions/dbaeumer.vscode-eslint/server/out/eslintServer.js" "--stdio"))
'';
};
markdown-mode = {
mode = [ ''"\\.mdwn\\'"'' ''"\\.markdown\\'"'' ''"\\.md\\'"'' ];
};
nix-mode.mode = [ ''"\\.nix\\'"'' ];
notmuch = {
package = epkgs: lib.getOutput "emacs" pkgs.notmuch;
config = ''
(setq notmuch-command "${pkgs.notmuch}/bin/notmuch")
'';
};
octave.mode = [ ''("\\.m\\'" . octave-mode)'' ];
ob-plantuml = {
config = ''
(setq org-plantuml-jar-path "${pkgs.plantuml}/lib/plantuml.jar")
'';
};
org-roam = {
defines = [ "org-roam-graph-executable" ];
config = ''
(setq org-roam-graph-executable "${pkgs.graphviz}/bin/dot")
'';
};
pandoc-mode = {
config = ''
(setq pandoc-binary "${pkgs.pandoc}/bin/pandoc")
'';
};
php-mode.mode = [ ''"\\.php\\'"'' ];
plantuml-mode = {
mode = [ ''"\\.puml\\'"'' ];
config = ''
(setq plantuml-default-exec-mode 'executable
plantuml-executable-path "${pkgs.plantuml}/bin/plantuml")
'';
};
protobuf-mode.mode = [ ''"\\.proto\\'"'' ];
purescript-mode.mode = [ ''"\\.purs\\'"'' ];
ripgrep = {
config = ''
(setq ripgrep-executable "${pkgs.ripgrep}/bin/rg")
'';
};
rust-mode.mode = [ ''"\\.rs\\'"'' ];
terraform-mode.mode = [ ''"\\.tf\\'"'' ];
yaml-mode.mode = [ ''"\\.\\(e?ya?\\|ra\\)ml\\'"'' ];
};
}

View File

@ -57,6 +57,14 @@ let
'';
};
defines = mkOption {
type = types.listOf types.str;
default = [ ];
description = ''
The entries to use for <option>:defines</option>.
'';
};
demand = mkOption {
type = types.bool;
default = false;
@ -210,6 +218,7 @@ let
mkAfter = vs: optional (vs != [ ]) ":after (${toString vs})";
mkCommand = vs: optional (vs != [ ]) ":commands (${toString vs})";
mkDefines = vs: optional (vs != [ ]) ":defines (${toString vs})";
mkDiminish = vs: optional (vs != [ ]) ":diminish (${toString vs})";
mkMode = map (v: ":mode ${v}");
mkBind = mkBindHelper "bind" "";
@ -232,8 +241,9 @@ let
++ mkBindStar config.bindStar ++ mkBindKeyMap config.bindKeyMap
++ mkBindLocal config.bindLocal ++ mkChords config.chords
++ mkCommand config.command ++ mkDefer config.defer
++ mkDemand config.demand ++ mkDiminish config.diminish
++ mkHook config.hook ++ mkMode config.mode
++ mkDefines config.defines ++ mkDemand config.demand
++ mkDiminish config.diminish ++ mkHook config.hook
++ mkMode config.mode
++ optionals (config.init != "") [ ":init" config.init ]
++ optionals (config.config != "") [ ":config" config.config ]
++ optionals (config.general != "") [ ":general" config.general ]