diff options
author | Tom Barrett <tom@tombarrett.xyz> | 2024-01-13 19:22:17 +0100 |
---|---|---|
committer | Tom Barrett <tom@tombarrett.xyz> | 2024-01-13 19:22:17 +0100 |
commit | 6aff2f9b0c11273fc2280a73ecaf9b7f3bca1249 (patch) | |
tree | c8726152b27d734d4073f82a53cf1ea63b38462d /flake.nix |
starting out
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5e0345e --- /dev/null +++ b/flake.nix @@ -0,0 +1,88 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixvim.url = "github:nix-community/nixvim"; + }; + + outputs = { + self, + nixpkgs, + nixvim, + }: let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + npkgs = nixvim.legacyPackages.x86_64-linux; + in { + packages.x86_64-linux.default = npkgs.makeNixvimWithModule { + module = { + config = { + extraPackages = [ + pkgs.black + pkgs.alejandra + pkgs.shfmt + pkgs.cargo + pkgs.rustfmt + pkgs.go + ]; + options = {mouse = "";}; + colorschemes.kanagawa = { + enable = true; + transparent = true; + }; + plugins = { + lsp = { + enable = true; + servers = { + bashls.enable = true; + nixd.enable = true; + ruff-lsp.enable = true; + gopls.enable = true; + }; + }; + rust-tools.enable = true; + conform-nvim = { + enable = true; + formatAfterSave.lspFallback = false; + formattersByFt = { + python = ["black"]; + nix = ["alejandra"]; + rust = ["rustfmt"]; + go = ["gofmt"]; + _ = ["shfmt"]; + }; + formatters.shfmt = { + prepend_args = ["-i" "2"]; + }; + }; + luasnip.enable = true; + nvim-cmp = { + enable = true; + snippet.expand = "luasnip"; + autoEnableSources = true; + sources = [ + {name = "nvim_lsp";} + {name = "path";} + {name = "buffer";} + ]; + mapping = { + "<CR>" = "cmp.mapping.confirm({ select = true })"; + "<Tab>" = { + action = '' + cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item({ + behavior = cmp.SelectBehavior.Select + }) + else + fallback() + end + end, {"i","s","c",}) + ''; + }; + }; + }; + }; + }; + }; + }; + }; +} |