77 lines
1.6 KiB
Nix
77 lines
1.6 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
inherit (config.grimmShared) enable tooling;
|
|
inherit (lib)
|
|
mkOption
|
|
types
|
|
getExe
|
|
mkIf
|
|
;
|
|
inherit (pkgs)
|
|
helix
|
|
symlinkJoin
|
|
writeTextDir
|
|
concatTextFile
|
|
makeWrapper
|
|
;
|
|
inherit (pkgs.writers) writeTOML;
|
|
|
|
conf-file-name = "config.toml";
|
|
lang-file-name = "languages.toml";
|
|
|
|
helix-conf = symlinkJoin {
|
|
name = "helix-conf";
|
|
paths = [
|
|
(concatTextFile {
|
|
name = "helix-conf-partial";
|
|
destination = "/${conf-file-name}";
|
|
files = [ (writeTOML conf-file-name config.programs.helix.config) ];
|
|
})
|
|
(writeTextDir lang-file-name ''
|
|
[[language]]
|
|
language-servers = ["nixd"]
|
|
name = "nix"
|
|
|
|
[language-server.nixd]
|
|
command = "${getExe pkgs.nixd}"
|
|
'')
|
|
];
|
|
};
|
|
|
|
helix-wrapped = pkgs.symlinkJoin {
|
|
name = helix.pname;
|
|
|
|
paths = [ helix ];
|
|
buildInputs = [ makeWrapper ];
|
|
postBuild = ''
|
|
wrapProgram $out/bin/${helix.meta.mainProgram} --add-flags "-c ${helix-conf}/${conf-file-name}"
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
config = mkIf (enable && tooling.enable) {
|
|
environment.systemPackages = [ helix-wrapped ];
|
|
environment.sessionVariables.EDITOR = getExe helix-wrapped;
|
|
|
|
programs.helix.config = {
|
|
editor.cursor-shape.insert = "bar";
|
|
theme = "base16_transparent";
|
|
# editor.commands.git = ":sh git";
|
|
# keys.normal.Delete = "delete_selection";
|
|
};
|
|
};
|
|
|
|
options.programs.helix = {
|
|
config = mkOption {
|
|
type = types.attrs;
|
|
default = { };
|
|
description = "Helix configuration";
|
|
};
|
|
};
|
|
}
|