{
  lib,
  pkgs,
  config,
  outputs,
  ...
}: {
  options = {
    youthlic.programs.helix = {
      enable = lib.mkEnableOption "helix";
      extraPackages = lib.mkOption {
        type = lib.types.listOf lib.types.package;
        default = [];
        example = (
          with pkgs; [
            deno
          ]
        );
        description = ''
          extra packages for helix lsp and formatter
        '';
      };
    };
  };
  config = let
    cfg = config.youthlic.programs.helix;
  in {
    stylix.targets.helix.enable = false;
    programs.helix = lib.mkIf cfg.enable {
      enable = true;
      defaultEditor = true;
      extraPackages = cfg.extraPackages;
      settings = ./config.toml |> builtins.readFile |> builtins.fromTOML;
      languages = {
        language-server = {
          neocmakelsp = {
            command = "neocmakelsp";
            args = [
              "stdio"
            ];
          };
          fish-lsp = {
            command = "fish-lsp";
            args = [
              "start"
            ];
          };
        };
        language = [
          {
            name = "cmake";
            language-servers = [
              "neocmakelsp"
              "cmake-language-server"
            ];
          }
          {
            name = "kdl";
            formatter = {
              command = "kdlfmt";
              args = [
                "format"
                "-"
              ];
            };
          }
          {
            name = "just";
            formatter = {
              command = "just";
              args = [
                "--dump"
              ];
            };
          }
          {
            name = "nix";
            formatter = {
              command = "alejandra";
            };
          }
          {
            name = "xml";
            formatter = {
              command = "xmllint";
              args = [
                "--format"
                "-"
              ];
            };
          }
          {
            name = "typst";
            formatter = {
              command = "typstyle";
            };
          }
          {
            name = "c";
            formatter = {
              command = "clang-format";
            };
          }
          {
            name = "cpp";
            formatter = {
              command = "clang-format";
            };
          }
          {
            name = "python";
            formatter = {
              command = "ruff";
              args = [
                "format"
                "-s"
                "--line-length"
                "88"
                "-"
              ];
            };
            language-servers = [
              "pyright"
              "ruff"
            ];
          }
          {
            name = "go";
            formatter = {
              command = "goimports";
            };
          }
          {
            name = "awk";
            formatter = {
              command = "awk";
              timeout = 5;
              args = [
                "--file=/dev/stdin"
                "--pretty-print=/dev/stdout"
              ];
            };
          }
          {
            name = "fish";
            language-servers = [
              "fish-lsp"
            ];
          }
          {
            name = "yaml";
            formatter = {
              command = "deno";
              args = [
                "fmt"
                "-"
                "--ext"
                "yaml"
              ];
            };
          }
          {
            name = "html";
            formatter = {
              command = "deno";
              args = [
                "fmt"
                "-"
                "--ext"
                "html"
              ];
            };
            language-servers = [
              "vscode-html-language-server"
            ];
          }
          {
            name = "css";
            formatter = {
              command = "deno";
              args = [
                "fmt"
                "-"
                "--ext"
                "css"
              ];
            };
            language-servers = [
              "vscode-css-language-server"
            ];
          }
          {
            name = "toml";
            formatter = {
              command = "taplo";
              args = [
                "fmt"
                "-"
              ];
            };
          }
          {
            name = "markdown";
            formatter = {
              command = "deno";
              args = [
                "fmt"
                "-"
                "--ext"
                "md"
              ];
            };
          }
          {
            name = "json";
            language-servers = [
              "vscode-json-language-server"
            ];
            formatter = {
              command = "deno";
              args = [
                "fmt"
                "-"
                "--ext"
                "json"
              ];
            };
          }
          {
            name = "jsonc";
            language-servers = [
              "vscode-json-language-server"
            ];
            formatter = {
              command = "deno";
              args = [
                "fmt"
                "-"
                "--ext"
                "jsonc"
              ];
            };
          }
        ];
      };
    };
  };
}
