diff --git a/flake.nix b/flake.nix index 5b3781c..2d101cf 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,9 @@ agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "nixpkgs"; + helix.url = "github:helix-editor/helix"; + helix.inputs.nixpkgs.follows = "nixpkgs"; + kernel-clr = { url = "github:clearlinux-pkgs/linux"; flake = false; }; }; outputs = { self, nixpkgs, home-manager, nixos-hardware, ... }@inputs: diff --git a/users/max/home.nix b/users/max/home.nix index b893c6e..0f36475 100644 --- a/users/max/home.nix +++ b/users/max/home.nix @@ -64,6 +64,7 @@ in # general program config imports = [ ./home/bat.nix + ./home/editor ./home/fzf.nix ./home/lsd.nix ./home/git.nix diff --git a/users/max/home/editor/default.nix b/users/max/home/editor/default.nix new file mode 100644 index 0000000..e270285 --- /dev/null +++ b/users/max/home/editor/default.nix @@ -0,0 +1,35 @@ +{ inputs, lib, pkgs, ... }: +let + hx = { + config = { + theme = "custom"; + editor = { + line-number = "relative"; + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + }; + }; + languages = import ./languages.nix pkgs; + theme = import ./theme.nix; + }; + + mkTOML = name: value: let + json = pkgs.writeText "helix-${name}.json" (builtins.toJSON value); + in pkgs.runCommandNoCC "helix-${name}.toml" {} "${pkgs.remarshal}/bin/remarshal --if json --of toml -i ${json} -o $out"; + +in { + home.packages = [ + inputs.helix.defaultPackage.${pkgs.system} + ]; + + xdg.configFile = { + "helix/config.toml".source = mkTOML "config" hx.config; + "helix/languages.toml".source = mkTOML "languages" hx.languages; + "helix/themes/custom.toml".source = mkTOML "theme" hx.theme; + }; + + home.shellAliases.vim = "hx"; +} diff --git a/users/max/home/editor/languages.nix b/users/max/home/editor/languages.nix new file mode 100644 index 0000000..89b3af4 --- /dev/null +++ b/users/max/home/editor/languages.nix @@ -0,0 +1,32 @@ +pkgs: { + language = with pkgs; [ + { + language-server = {command = "${rust-analyzer}/bin/rust-analyer";}; + name = "rust"; + } + { + language-server = {command = "${clang-tools}/bin/clangd";}; + name = "c"; + } + { + language-server = {command = "${clang-tools}/bin/clangd";}; + name = "cpp"; + } + { + language-server = {command = "${gopls}/bin/gopls";}; + name = "go"; + } + { + language-server = {command = "${python39Packages.python-lsp-server}/bin/pylsp";}; + name = "python"; + } + { + language-server = {command = "${rnix-lsp}/bin/rnix-lsp";}; + name = "nix"; + } + { + language-server = {command = "${haskell-language-server}/bin/haskell-language-server-wrapper";}; + name = "haskell"; + } + ]; +} \ No newline at end of file diff --git a/users/max/home/editor/theme.nix b/users/max/home/editor/theme.nix new file mode 100644 index 0000000..f1fce13 --- /dev/null +++ b/users/max/home/editor/theme.nix @@ -0,0 +1,128 @@ +{ + palette = { + base0 = "#131313"; + base1 = "#191919"; + base2 = "#222222"; + base3 = "#363537"; + base4 = "#525053"; + base5 = "#69676c"; + base6 = "#8b888f"; + base7 = "#bab6c0"; + base8 = "#f7f1ff"; + base8x0c = "#2b2b2b"; + blue = "#5ad4e6"; + green = "#7bd88f"; + orange = "#fd9353"; + purple = "#948ae3"; + red = "#fc618d"; + yellow = "#fce566"; + }; + + error = "red"; + hint = "base8"; + info = "base8"; + warning = "orange"; + + attribute = "blue"; + + comment = { + fg = "base5"; + modifiers = ["italic"]; + }; + + constant = "orange"; + "constant.builtin" = "red"; + "constant.character.escape" = {fg = "base8";}; + "constant.numeric" = "purple"; + + constructor = "blue"; + + diagnostic = {modifiers = ["underlined"];}; + + "diff.delta" = "orange"; + "diff.minus" = "red"; + "diff.plus" = "green"; + + function = "green"; + "function.builtin" = {fg = "cyan";}; + "function.macro" = {fg = "blue";}; + + + keyword = {fg = "red";}; + "keyword.directive" = "blue"; + + label = "base8"; + + "markup.bold" = { + fg = "orange"; + modifiers = ["bold"]; + }; + + "markup.heading" = "green"; + "markup.italic" = { + fg = "orange"; + modifiers = ["italic"]; + }; + + "markup.link.text" = "yellow"; + "markup.link.url" = { + fg = "orange"; + modifiers = ["underlined"]; + }; + + "markup.quote" = "green"; + + module = "#f59762"; + + namespace = "base8"; + + operator = "red"; + + punctuation = "base6"; + + special = "#f59762"; + + string = "yellow"; + + type = "green"; + "type.builtin" = {fg = "red";}; + + "ui.background" = {bg = "1a1a1a";}; + + "ui.cursor.match" = {bg = "base4";}; + "ui.cursor.primary" = { + fg = "base7"; + modifiers = ["reversed"]; + }; + + "ui.help" = {bg = "base3";}; + + "ui.linenr" = {fg = "base5";}; + "ui.linenr.selected" = {bg = "base3";}; + + "ui.menu.selected" = { + bg = "yellow"; + fg = "base2"; + }; + + "ui.popup" = {bg = "base3";}; + "ui.selection" = {bg = "base4";}; + "ui.statusline" = {bg = "base4";}; + "ui.statusline.inactive" = { + bg = "base8x0c"; + fg = "base8"; + }; + + "ui.text" = {fg = "base8";}; + "ui.text.focus" = { + fg = "yellow"; + modifiers = ["bold"]; + }; + + "ui.window" = {bg = "base3";}; + + variable = "base8"; + "variable.builtin" = "red"; + "variable.other.member" = "base8"; + "variable.parameter" = "#f59762"; +}