Serenity/modules/features/terminal/helix.nix
2026-10-01 03:29:09 +10:00

90 lines
1.9 KiB
Nix

{ self, inputs, ... }:
{
# defines a custom helix module
flake.nixosModules.helix =
{
lib,
pkgs,
user-parts,
...
}:
{
# needed for home manager functionality
imports = [ inputs.home-manager.nixosModules.home-manager ];
# editor variables
environment.variables = {
EDITOR = "hx";
VISUAL = "hx";
SYSTEMD_EDITOR = "hx";
};
environment.systemPackages = with pkgs; [ helix ];
# home manager options
home-manager.users.${user-parts.user.username} = {
# alternate user friendly text editor
programs.micro = {
enable = true;
};
# primary text editor
programs.helix = {
# enables helix
enable = true;
settings = {
# cursor settings
editor.cursor-shape = {
normal = "underline";
insert = "bar";
select = "block";
};
};
# lsp settings
languages = {
language = [
{
name = "nix";
auto-format = true;
formatter.command = lib.getExe pkgs.nixfmt;
}
{
name = "haskell";
auto-format = true;
formatter.command = lib.getExe pkgs.stylish-haskell;
}
{
name = "rust";
auto-format = true;
formatter.command = lib.getExe pkgs.rustfmt;
}
{
name = "python";
auto-format = true;
formatter.command = lib.getExe pkgs.black;
}
{
name = "markdown";
}
{
name = "fish";
}
];
};
};
};
};
}