Commit 8f89e32
Changed files (3)
modules
dev
editor
helix
modules/dev/editor/helix/lang/nix.nix
@@ -2,7 +2,7 @@
den.aspects.dev.editor.helix.includes = [den.aspects.dev.editor.helix.lang.nix];
den.aspects.dev.editor.helix.lang.nix = {
hjem = {
- xdg.config.files."helix/languages.toml".value = {
+ programs.helix.languages = {
language = [
{
name = "nix";
modules/dev/editor/helix/_module.nix
@@ -0,0 +1,42 @@
+{
+ pkgs,
+ lib,
+ config,
+ ...
+}: let
+ cfg = config.programs.helix;
+
+ tomlFormat = pkgs.formats.toml {};
+in {
+ options.programs.helix = {
+ enable = lib.mkEnableOption "Helix text editor";
+ package = lib.mkPackageOption pkgs "helix" {
+ nullable = true;
+ example = "pkgs.steelix";
+ };
+ settings = lib.mkOption {
+ inherit (tomlFormat) type;
+ default = {};
+ };
+ languages = lib.mkOption {
+ type =
+ lib.types.coercedTo (lib.types.listOf tomlFormat.type)
+ (language: {inherit language;})
+ (lib.types.addCheck tomlFormat.type builtins.isAttrs);
+ default = {};
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ packages = [cfg.package];
+
+ xdg.config.files."helix/config.toml" = {
+ generator = tomlFormat.generate "helix-config.toml";
+ value = cfg.settings;
+ };
+ xdg.config.files."helix/languages.toml" = {
+ generator = tomlFormat.generate "helix-languages.toml";
+ value = cfg.languages;
+ };
+ };
+}
modules/dev/editor/helix/default.nix
@@ -21,9 +21,9 @@
lib,
...
}: {
- packages = [
- pkgs.nur.repos.hpcesia.steelix
+ imports = [./_module.nix];
+ packages = [
pkgs.steel
pkgs.schemat
];
@@ -34,9 +34,10 @@
STEEL_HOME = "${config.xdg.data.directory}/steel";
};
- xdg.config.files."helix/config.toml" = {
- generator = (pkgs.formats.toml {}).generate "helix-config.toml";
- value = {
+ programs.helix = {
+ enable = true;
+ package = pkgs.nur.repos.hpcesia.steelix;
+ settings = {
editor = {
cursorline = true;
bufferline = "multiple";
@@ -78,11 +79,6 @@
};
};
- xdg.config.files."helix/languages.toml" = {
- generator = (pkgs.formats.toml {}).generate "helix-languages.toml";
- value = {};
- };
-
xdg.config.files."helix/helix.scm" = {
source = ./helix.scm;
permissions = "0644";
@@ -131,6 +127,6 @@
};
den.aspects.dev.editor.helix.themes.catppuccin = {
- hjem.xdg.config.files."helix/config.toml".value.theme = "catppuccin_mocha";
+ hjem.programs.helix.settings.theme = "catppuccin_mocha";
};
}