2024-02-05 11:46:52 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2022-03-01 22:19:03 +01:00
|
|
|
}:
|
2024-02-05 11:46:52 +01:00
|
|
|
with lib;
|
|
|
|
let
|
2022-03-01 22:19:03 +01:00
|
|
|
cfg = config.eboskma.programs.emacs;
|
2022-04-22 00:14:35 +02:00
|
|
|
|
2024-02-05 11:46:52 +01:00
|
|
|
tangleEmacsConfig =
|
|
|
|
initFile:
|
|
|
|
pkgs.runCommand "tangled-emacs-${initFile}" { } ''
|
|
|
|
cp ${./config.org} ./config.org
|
|
|
|
${cfg.package}/bin/emacs --batch --quick --load org ./config.org --funcall org-babel-tangle
|
|
|
|
cp ${initFile} $out
|
|
|
|
'';
|
2023-04-05 13:21:29 +02:00
|
|
|
|
2024-02-15 08:36:05 +01:00
|
|
|
tree-sitter-qml = pkgs.tree-sitter.buildGrammar {
|
|
|
|
language = "tree-sitter-qmljs";
|
|
|
|
version = "unstable-2024-02-02";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "yuja";
|
|
|
|
repo = "tree-sitter-qmljs";
|
|
|
|
rev = "9fa49ff3315987f715ce5666ff979a7742fa8a98";
|
|
|
|
sha256 = "q20gLVLs0LpqRpgo/qNRDfExbWXhICWZjM1ux4+AT6M=";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-03-04 14:25:40 +01:00
|
|
|
emacsWithPackages = pkgs.emacsWithPackagesFromUsePackage {
|
|
|
|
config =
|
|
|
|
let
|
2023-04-05 13:21:29 +02:00
|
|
|
tangledOrgConfig = tangleEmacsConfig "init.el";
|
2023-03-04 14:25:40 +01:00
|
|
|
in
|
|
|
|
builtins.readFile tangledOrgConfig;
|
|
|
|
|
|
|
|
defaultInitFile = true;
|
|
|
|
package = cfg.package;
|
|
|
|
alwaysEnsure = true;
|
|
|
|
alwaysTangle = true;
|
2024-02-05 11:46:52 +01:00
|
|
|
extraEmacsPackages =
|
|
|
|
epkgs: with epkgs; [
|
|
|
|
vterm
|
|
|
|
(treesit-grammars.with-grammars (
|
|
|
|
p: with p; [
|
|
|
|
tree-sitter-bash
|
|
|
|
tree-sitter-c
|
|
|
|
tree-sitter-c-sharp
|
|
|
|
tree-sitter-css
|
|
|
|
tree-sitter-cmake
|
|
|
|
tree-sitter-comment
|
|
|
|
tree-sitter-commonlisp
|
|
|
|
tree-sitter-cpp
|
|
|
|
tree-sitter-css
|
|
|
|
tree-sitter-cuda
|
|
|
|
tree-sitter-devicetree
|
|
|
|
tree-sitter-dockerfile
|
|
|
|
tree-sitter-dot
|
|
|
|
tree-sitter-eex
|
|
|
|
tree-sitter-elisp
|
|
|
|
tree-sitter-elixir
|
|
|
|
tree-sitter-embedded-template
|
|
|
|
tree-sitter-erlang
|
|
|
|
tree-sitter-fish
|
|
|
|
tree-sitter-glsl
|
|
|
|
tree-sitter-go
|
|
|
|
tree-sitter-gomod
|
|
|
|
tree-sitter-gowork
|
|
|
|
tree-sitter-graphql
|
|
|
|
tree-sitter-haskell
|
|
|
|
tree-sitter-hcl
|
|
|
|
tree-sitter-heex
|
|
|
|
tree-sitter-html
|
|
|
|
tree-sitter-http
|
|
|
|
tree-sitter-javascript
|
|
|
|
tree-sitter-jsdoc
|
|
|
|
tree-sitter-json
|
|
|
|
tree-sitter-latex
|
|
|
|
tree-sitter-llvm
|
|
|
|
tree-sitter-lua
|
|
|
|
tree-sitter-make
|
|
|
|
tree-sitter-markdown
|
|
|
|
tree-sitter-markdown-inline
|
|
|
|
tree-sitter-nix
|
|
|
|
tree-sitter-nu
|
|
|
|
tree-sitter-pioasm
|
|
|
|
tree-sitter-python
|
2024-02-15 08:36:05 +01:00
|
|
|
tree-sitter-qml
|
2024-02-05 11:46:52 +01:00
|
|
|
tree-sitter-query
|
|
|
|
tree-sitter-regex
|
|
|
|
tree-sitter-rst
|
|
|
|
tree-sitter-ruby
|
|
|
|
tree-sitter-rust
|
|
|
|
tree-sitter-scheme
|
|
|
|
tree-sitter-scss
|
|
|
|
tree-sitter-sql
|
|
|
|
tree-sitter-surface
|
|
|
|
tree-sitter-svelte
|
|
|
|
tree-sitter-toml
|
|
|
|
tree-sitter-tsx
|
|
|
|
tree-sitter-typescript
|
|
|
|
tree-sitter-verilog
|
|
|
|
tree-sitter-yaml
|
|
|
|
tree-sitter-zig
|
|
|
|
]
|
|
|
|
))
|
|
|
|
emacsql
|
|
|
|
emacsql-sqlite
|
|
|
|
];
|
2023-03-04 14:25:40 +01:00
|
|
|
};
|
|
|
|
|
2022-03-28 14:26:33 +02:00
|
|
|
orgProtocolDesktop = pkgs.makeDesktopItem {
|
|
|
|
name = "org-protocol";
|
|
|
|
desktopName = "Emacs Org Protocol Handler";
|
|
|
|
icon = "emacs";
|
2024-02-05 11:46:52 +01:00
|
|
|
categories = [
|
|
|
|
"Development"
|
|
|
|
"TextEditor"
|
|
|
|
];
|
2022-04-27 00:21:19 +02:00
|
|
|
keywords = [ "org-protocol" ];
|
2022-03-28 14:26:33 +02:00
|
|
|
type = "Application";
|
2023-03-04 14:25:40 +01:00
|
|
|
exec = "${emacsWithPackages}/bin/emacsclient -- %u";
|
2022-03-28 14:26:33 +02:00
|
|
|
terminal = false;
|
2022-04-27 00:21:19 +02:00
|
|
|
mimeTypes = [ "x-scheme-handler/org-protocol" ];
|
2022-03-28 14:26:33 +02:00
|
|
|
startupWMClass = "Emacs";
|
|
|
|
};
|
2022-04-27 00:21:19 +02:00
|
|
|
in
|
|
|
|
{
|
2022-03-28 14:26:33 +02:00
|
|
|
options.eboskma.programs.emacs = {
|
|
|
|
enable = mkEnableOption "activate emacs";
|
2022-07-29 09:57:50 +02:00
|
|
|
|
2023-03-31 14:41:09 +02:00
|
|
|
package = mkPackageOption pkgs "emacs" { };
|
2022-08-18 16:37:26 +02:00
|
|
|
|
2022-03-28 14:26:33 +02:00
|
|
|
daemon = mkOption {
|
|
|
|
description = "Whether to enable emacs daemon";
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
};
|
|
|
|
};
|
2022-02-09 08:13:16 +01:00
|
|
|
|
2022-05-03 18:17:38 +02:00
|
|
|
config = mkIf cfg.enable {
|
2022-02-03 22:57:53 +01:00
|
|
|
programs.emacs = {
|
|
|
|
enable = true;
|
2023-03-04 14:25:40 +01:00
|
|
|
package = emacsWithPackages;
|
2022-02-03 22:57:53 +01:00
|
|
|
};
|
2022-03-28 14:26:33 +02:00
|
|
|
|
2022-05-03 18:17:38 +02:00
|
|
|
services.emacs = mkIf cfg.daemon {
|
2022-03-28 14:26:33 +02:00
|
|
|
enable = true;
|
2023-03-04 14:25:40 +01:00
|
|
|
package = emacsWithPackages;
|
2022-03-28 14:26:33 +02:00
|
|
|
client.enable = true;
|
|
|
|
socketActivation.enable = true;
|
|
|
|
};
|
2022-03-18 21:14:51 +01:00
|
|
|
|
2023-04-05 13:21:29 +02:00
|
|
|
home.file."emacs.d/early-init.el".source = tangleEmacsConfig "early-init.el";
|
|
|
|
|
2024-02-05 11:46:52 +01:00
|
|
|
home.packages =
|
|
|
|
with pkgs;
|
|
|
|
[
|
|
|
|
(texlive.combine {
|
|
|
|
inherit (texlive)
|
|
|
|
scheme-small
|
|
|
|
wrapfig
|
|
|
|
ulem
|
|
|
|
capt-of
|
|
|
|
;
|
|
|
|
})
|
|
|
|
orgProtocolDesktop
|
2024-06-17 11:17:25 +02:00
|
|
|
bash-language-server
|
2024-02-05 11:46:52 +01:00
|
|
|
aspell
|
|
|
|
lldb
|
2024-03-11 17:53:35 +01:00
|
|
|
(nil.overrideAttrs (_: {
|
|
|
|
doCheck = false;
|
|
|
|
}))
|
2024-02-23 11:35:56 +01:00
|
|
|
nixfmt-rfc-style
|
2024-02-05 11:46:52 +01:00
|
|
|
python3
|
|
|
|
]
|
|
|
|
++ (with aspellDicts; [
|
|
|
|
en
|
|
|
|
en-computers
|
|
|
|
en-science
|
|
|
|
fy
|
|
|
|
nl
|
|
|
|
]);
|
2022-02-03 22:57:53 +01:00
|
|
|
};
|
|
|
|
}
|