1
0
Fork 0

Add configuration options for languages

This commit is contained in:
Ethan Reece 2025-07-14 09:30:37 -05:00
parent 461763d132
commit e159b135ff
Signed by: me
GPG key ID: DD8CE04D5D8FF832
10 changed files with 296 additions and 270 deletions

View file

@ -1,35 +1,33 @@
{ flake-parts-lib, lib, ... }: { flake-parts-lib, lib, ... }:
let
inherit (lib) mkOption types;
in
{ {
imports = [ ../base ]; imports = [ ../base ];
options.perSystem = flake-parts-lib.mkPerSystemOption ( options.perSystem = flake-parts-lib.mkPerSystemOption (
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
options.helix = { options.editors.helix = {
enable = lib.mkEnableOption "Helix";
# https://github.com/helix-editor/helix/blob/master/languages.toml # https://github.com/helix-editor/helix/blob/master/languages.toml
# https://helix-editor.vercel.app/reference/formatters # https://helix-editor.vercel.app/reference/formatters
# https://docs.helix-editor.com/lang-support.html # https://docs.helix-editor.com/lang-support.html
languages = mkOption { languages = lib.mkOption {
description = '' description = ''
Configuration for Helix `languages.toml`. Configuration for Helix `languages.toml`.
''; '';
# type = types.attrs; # type = types.attrs;
type = types.submodule { type = lib.types.submodule {
options = { options = {
language = mkOption { language = lib.mkOption {
description = '' description = ''
`language` in `languages.toml`. `language` in `languages.toml`.
''; '';
type = types.listOf types.attrs; type = lib.types.listOf lib.types.attrs;
default = [ ]; default = [ ];
}; };
language-server = mkOption { language-server = lib.mkOption {
description = '' description = ''
`language-server` in `languages.toml`. `language-server` in `languages.toml`.
''; '';
type = types.attrs; type = lib.types.attrs;
default = { }; default = { };
}; };
}; };
@ -37,13 +35,13 @@ in
default = { }; default = { };
}; };
}; };
config.devshells.default = config.devshells.default = lib.mkIf config.editors.helix.enable (
let let
tomlFormatter = pkgs.formats.toml { }; tomlFormatter = pkgs.formats.toml { };
helix = { helix = {
languages = { languages = {
name = "languages.toml"; name = "languages.toml";
text = config.helix.languages; text = config.editors.helix.languages;
path = tomlFormatter.generate "languages.toml" helix.languages.text; path = tomlFormatter.generate "languages.toml" helix.languages.text;
}; };
directory = { directory = {
@ -72,7 +70,8 @@ in
${pkgs.uutils-coreutils-noprefix}/bin/rm -rf ./${helix.directory.name} ${pkgs.uutils-coreutils-noprefix}/bin/rm -rf ./${helix.directory.name}
${pkgs.uutils-coreutils-noprefix}/bin/ln -fsn ${helix.directory.path} ./${helix.directory.name} ${pkgs.uutils-coreutils-noprefix}/bin/ln -fsn ${helix.directory.path} ./${helix.directory.name}
''; '';
}; }
);
} }
); );
} }

View file

@ -1,11 +1,8 @@
{ ... }: { ... }:
let let
entries = builtins.attrNames (builtins.readDir ./.); entries = builtins.attrNames (builtins.readDir ./.);
configs = builtins.filter (dir: builtins.pathExists (./. + "/${dir}/default.nix")) entries; modules = builtins.filter (dir: builtins.pathExists (./. + "/${dir}/default.nix")) entries;
in in
{ {
imports = [ imports = builtins.map (name: (./. + "/${name}")) modules;
../base
../helix
] ++ builtins.map (name: (./. + "/${name}")) configs;
} }

View file

@ -1,4 +1,4 @@
{ ... }: { flake-parts-lib, lib, ... }:
let let
dictionary = [ dictionary = [
"Asahi" "Asahi"
@ -14,8 +14,13 @@ let
]; ];
in in
{ {
perSystem = options.perSystem = flake-parts-lib.mkPerSystemOption (
{ pkgs, ... }: { pkgs, ... }:
{
options.languages.en-us = {
enable = lib.mkEnableOption "en_US";
};
config =
let let
tomlFormatter = pkgs.formats.toml { }; tomlFormatter = pkgs.formats.toml { };
vale = { vale = {
@ -88,7 +93,7 @@ in
}; };
in in
{ {
helix.languages.language-server = { editors.helix.languages.language-server = {
# https://ltex-plus.github.io/ltex-plus/supported-languages.html # https://ltex-plus.github.io/ltex-plus/supported-languages.html
ltex-ls-plus = { ltex-ls-plus = {
command = "${pkgs.ltex-ls-plus}/bin/ltex-ls-plus"; command = "${pkgs.ltex-ls-plus}/bin/ltex-ls-plus";
@ -149,3 +154,5 @@ in
}; };
}; };
} }
);
}

View file

@ -1,10 +1,12 @@
{ ... }: { flake-parts-lib, lib, ... }:
{ {
imports = [ ../en-us ]; imports = [ ../en-us ];
perSystem = options.perSystem = flake-parts-lib.mkPerSystemOption (
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
helix.languages = { options.languages.markdown.enable = lib.mkEnableOption "Markdown";
config = {
editors.helix.languages = {
language = [ language = [
{ {
name = "markdown"; name = "markdown";
@ -41,3 +43,5 @@
pre-commit.settings.hooks.markdownlint.enable = true; pre-commit.settings.hooks.markdownlint.enable = true;
}; };
} }
);
}

View file

@ -1,10 +1,12 @@
{ ... }: { flake-parts-lib, lib, ... }:
{ {
imports = [ ../en-us ]; imports = [ ../en-us ];
perSystem = options.perSystem = flake-parts-lib.mkPerSystemOption (
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
helix.languages = { options.languages.nix.enable = lib.mkEnableOption "Nix";
config = lib.mkIf config.languages.nix.enable {
editors.helix.languages = {
language = [ language = [
{ {
name = "nix"; name = "nix";
@ -32,3 +34,5 @@
}; };
}; };
} }
);
}

View file

@ -1,10 +1,12 @@
{ ... }: { flake-parts-lib, lib, ... }:
{ {
imports = [ ../en-us ]; imports = [ ../en-us ];
perSystem = options.perSystem = flake-parts-lib.mkPerSystemOption (
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
helix.languages = { options.languages.toml.enable = lib.mkEnableOption "TOML";
config = {
editors.helix.languages = {
language = [ language = [
{ {
name = "toml"; name = "toml";
@ -30,3 +32,5 @@
pre-commit.settings.hooks.check-toml.enable = true; pre-commit.settings.hooks.check-toml.enable = true;
}; };
} }
);
}

View file

@ -1,10 +1,12 @@
{ ... }: { flake-parts-lib, lib, ... }:
{ {
imports = [ ../en-us ]; imports = [ ../en-us ];
perSystem = options.perSystem = flake-parts-lib.mkPerSystemOption (
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
helix.languages = { options.languages.yaml.enable = lib.mkEnableOption "YAML";
config = {
editors.helix.languages = {
language = [ language = [
{ {
name = "yaml"; name = "yaml";
@ -42,3 +44,5 @@
}; };
}; };
} }
);
}

View file

@ -47,6 +47,14 @@
perSystem = perSystem =
{ pkgs, system, ... }: { pkgs, system, ... }:
{ {
editors.helix.enable = true;
languages = {
en-us.enable = true;
markdown.enable = true;
nix.enable = true;
toml.enable = true;
yaml.enable = true;
};
# https://flake.parts/options/devshell.html # https://flake.parts/options/devshell.html
devshells.default = { devshells.default = {
packages = [ pkgs.forgejo-cli ]; packages = [ pkgs.forgejo-cli ];

View file

@ -567,7 +567,7 @@ in
"en-US" "en-US"
"en" "en"
]; ];
vencord = ./vencord.nix; # TODO: Fix this vencord = ./vencord.nix; # TODO: Make this a home-manager module
}; };
}; };
floorp = { floorp = {

View file

@ -12,7 +12,6 @@
disableMinSize = false; disableMinSize = false;
eagerPatches = false; eagerPatches = false;
enableReactDevtools = false; enableReactDevtools = false;
enabledThemes = [ ];
frameless = false; frameless = false;
macosTranslucency = false; macosTranslucency = false;
notifications = { notifications = {