[user/malte] Finish helix setup

This commit is contained in:
Malte Tammena 2022-09-12 16:35:17 +02:00
parent f8a269fb77
commit ddf1b26167
3 changed files with 42 additions and 8 deletions

View file

@ -123,8 +123,8 @@ in {
btop
# An initial `tailscale up` is necessary to get the network going
tailscale
# I will need to have access to kakoune
kakoune
# I will need to have access to helix
helix
# I much rather use some tools other than the default
fd
du-dust

View file

@ -1,9 +1,16 @@
{
pkgs,
lib,
config,
...
}: let
config = (pkgs.formats.toml {}).generate "config.toml" {
tomlFormat = pkgs.formats.toml {};
configFilePath = "~/.config/helix/config.toml";
installConfig = file: ''
ln -sf ${file} ${configFilePath}
'';
lightConfig = {
theme = "gruvbox_light";
editor = {
line-number = "relative";
@ -15,6 +22,12 @@
};
};
};
lightConfigFile = tomlFormat.generate "config.toml" lightConfig;
darkConfig = lib.recursiveUpdate lightConfig {
theme = "gruvbox";
};
darkConfigFile = tomlFormat.generate "config.toml" darkConfig;
extraLanguages = (pkgs.formats.toml {}).generate "languages.toml" {
language = [
@ -55,6 +68,27 @@ in {
taplo-lsp
];
xdg.configFile."helix/config.toml".source = config;
home.sessionVariables = {
EDITOR = "${pkgs.helix}/bin/hx";
VISUAL = "${pkgs.kitty}/bin/kitty ${pkgs.helix}/bin/hx";
};
xdg.configFile."helix/languages.toml".source = extraLanguages;
services.darkman.scripts."helix.sh" = {
onLight = pkgs.writeScript "helix-light" ''
#!${pkgs.runtimeShell}
${installConfig lightConfigFile}
'';
onDark = pkgs.writeScript "helix-dark" ''
#!${pkgs.runtimeShell}
${installConfig darkConfigFile}
'';
initialize = pkgs.writeScript "helix-initialize" ''
mkdir -p $(dirname ${configFilePath})
if [[ ! -e ${configFilePath} ]]; then
${installConfig lightConfigFile}
fi
'';
};
}

View file

@ -300,10 +300,10 @@ in {
plugins = map (conf: conf.pkg) pluginConfigs;
};
home.sessionVariables = {
EDITOR = kakBin;
VISUAL = "${pkgs.kitty}/bin/kitty ${kakBin}";
};
# home.sessionVariables = {
# EDITOR = kakBin;
# VISUAL = "${pkgs.kitty}/bin/kitty ${kakBin}";
# };
xdg.configFile."kak-lsp/kak-lsp.toml".source = kakLspConfigGen.generate "kak-lsp.toml" kakLspConfig;