main
1{inputs, ...}: {
2 flake-file.inputs.helix-plugins-nix = {
3 url = "https://codeberg.org/maxschipper/helix-plugins-nix/archive/main.tar.gz";
4 inputs.nixpkgs.follows = "nixpkgs";
5 };
6
7 den.aspects.dev.editor.helix = {
8 cacheHome = {config, ...}: {
9 directories = [
10 "${config.xdg.data.directory}/helix" # Workspace trust data
11 ];
12 };
13
14 nixos = {
15 nixpkgs.overlays = [inputs.helix-plugins-nix.overlays.default];
16 };
17
18 hjem = {
19 config,
20 pkgs,
21 lib,
22 ...
23 }: {
24 packages = [
25 pkgs.nur.repos.hpcesia.steelix
26
27 pkgs.steel
28 pkgs.schemat
29 ];
30
31 environment.sessionVariables = {
32 EDITOR = "hx";
33 VISUAL = "hx";
34 STEEL_HOME = "${config.xdg.data.directory}/steel";
35 };
36
37 xdg.config.files."helix/config.toml" = {
38 generator = (pkgs.formats.toml {}).generate "helix-config.toml";
39 value = {
40 editor = {
41 cursorline = true;
42 bufferline = "multiple";
43 statusline = {
44 left = ["mode" "spinner" "diagnostics" "workspace-diagnostics"];
45 center = ["file-name" "read-only-indicator" "file-modification-indicator"];
46 right = ["file-type" "file-encoding" "separator" "position" "total-line-numbers"];
47 };
48 line-number = "relative";
49 indent-guides = {
50 render = true;
51 character = "┊";
52 skip-levels = 1;
53 };
54 rulers = [80];
55 cursor-shape = {
56 normal = "block";
57 insert = "bar";
58 select = "block";
59 };
60 color-modes = true;
61 trim-trailing-whitespace = true;
62 inline-diagnostics.cursor-line = "warning";
63 end-of-line-diagnostics = "error";
64 lsp = {
65 display-inlay-hints = true;
66 inlay-hints-length-limit = 16;
67 };
68 file-picker = {
69 hidden = false;
70 };
71 };
72 keys = {
73 normal = {
74 "H" = "goto_previous_buffer";
75 "L" = "goto_next_buffer";
76 };
77 };
78 };
79 };
80
81 xdg.config.files."helix/languages.toml" = {
82 generator = (pkgs.formats.toml {}).generate "helix-languages.toml";
83 value = {};
84 };
85
86 xdg.config.files."helix/helix.scm" = {
87 source = ./helix.scm;
88 type = "copy";
89 };
90 xdg.config.files."helix/init.scm" = {
91 source = ./init.scm;
92 type = "copy";
93 };
94
95 xdg.data.files = let
96 helixPluginsNixUtils =
97 (import "${inputs.helix-plugins-nix}/modules/utils.nix")
98 {inherit pkgs lib;};
99
100 allPlugins = helixPluginsNixUtils.flattenPlugins [
101 pkgs.helixPlugins.forest
102 pkgs.helixPlugins.wakatime
103 pkgs.helixPlugins.who
104 ];
105
106 nativePlugins = helixPluginsNixUtils.getNativePlugins allPlugins;
107 nativeLibDrv = helixPluginsNixUtils.mergeNativeLibs nativePlugins;
108
109 pluginLinks = builtins.listToAttrs (
110 map (drv: {
111 name = "steel/cogs/${drv.cogName}";
112 value = {
113 source = drv;
114 clobber = true;
115 };
116 })
117 allPlugins
118 );
119
120 nativeLibLink = lib.optionalAttrs (nativeLibDrv != null) {
121 "steel/native" = {
122 source = nativeLibDrv;
123 clobber = true;
124 };
125 };
126 in
127 pluginLinks // nativeLibLink;
128 };
129 };
130
131 den.aspects.dev.editor.helix.themes.catppuccin = {
132 hjem.xdg.config.files."helix/config.toml".value.theme = "catppuccin_mocha";
133 };
134}