Add and configure gram-editor

Add nix-gram-extensions for building extensions as derivations.
Switch to own home-manager fork until wrapping of other editors is
possible upstream.
This commit is contained in:
JuliusFreudenberger 2026-07-19 15:58:57 +02:00
parent 4343a3d231
commit 9d2f9e9bba
4 changed files with 127 additions and 16 deletions

65
home/gram.nix Normal file
View file

@ -0,0 +1,65 @@
{
config,
lib,
pkgs,
pkgs-unstable,
gram-extensions,
...
}:
let
extensions = with gram-extensions; [
typst
git-firefly
];
extensions-dir = gram-extensions.linkGramExtensions extensions;
in {
programs.zed-editor = {
enable = true;
package = pkgs-unstable.gram;
extraPackages = [
pkgs.nil
pkgs.tinymist
pkgs.tofu-ls
pkgs.ltex-ls-plus
];
userSettings = {
theme = {
mode = "system";
dark = "One Dark";
light = "One Light";
};
hour_format = "hour24";
vim_mode = true;
load_direnv = "shell_hook";
lsp = {
tinymist = {
settings = {
exportPdf = "onSave";
outputPath = "$root/$name";
preview.background.enabled = true;
};
initialization_options = {
preview.background.enabled = true;
};
};
};
};
};
home.file."Library/Application Support/Gram/extensions/installed" = {
enable = pkgs.stdenv.hostPlatform.isDarwin;
source = extensions-dir;
onChange = ''
cd "Library/Application Support/Gram/extensions"
mv index.json index.json.backup
'';
};
xdg.dataFile."gram/extensions/installed" = {
enable = pkgs.stdenv.hostPlatform.isLinux;
source = extensions-dir;
onChange = ''
cd "${config.xdg.dataHome}/gram/extensions"
mv index.json index.json.backup
'';
};
}