1
0
Fork 0

Update deps, treefmt improvements

This commit is contained in:
Daniel Kempkens 2023-07-13 19:57:12 +02:00
parent c581b9cf26
commit a7cdb5db58
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
7 changed files with 45 additions and 34 deletions

View file

@ -213,6 +213,21 @@
"type": "github" "type": "github"
} }
}, },
"flake-root": {
"locked": {
"lastModified": 1680964220,
"narHash": "sha256-dIdTYcf+KW9a4pKHsEbddvLVSfR1yiAJynzg2x0nfWg=",
"owner": "srid",
"repo": "flake-root",
"rev": "f1c0b93d05bdbea6c011136ba1a135c80c5b326c",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "flake-root",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1667395993,
@ -364,11 +379,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1689188243, "lastModified": 1689260591,
"narHash": "sha256-v3EDlWWLBQ+LIRWZ03jd8bnvHLyNae6iaqd03rbYhwo=", "narHash": "sha256-d4lwp7mLOuXVOntmFm3nIR7Q1sCIw7wfpKB1dZVKtyw=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "2ad716c2786dabf8f458ae1e7d343775d3acc65c", "rev": "d468d4e813bb3ebe91e8d82ffed2f21852fa8909",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -468,6 +483,7 @@
"deploy-rs": "deploy-rs", "deploy-rs": "deploy-rs",
"disko": "disko", "disko": "disko",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"flake-root": "flake-root",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nifoc-overlay": "nifoc-overlay", "nifoc-overlay": "nifoc-overlay",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",

View file

@ -8,6 +8,8 @@
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
flake-root.url = "github:srid/flake-root";
treefmt-nix = { treefmt-nix = {
url = "github:numtide/treefmt-nix"; url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -111,6 +113,7 @@
}; };
imports = [ imports = [
inputs.flake-root.flakeModule
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule
]; ];
@ -122,12 +125,13 @@
perSystem = { config, pkgs, ... }: { perSystem = { config, pkgs, ... }: {
treefmt = { treefmt = {
projectRootFile = "flake.nix"; inherit (config.flake-root) projectRootFile;
programs = { programs = {
fnlfmt.enable = true; fnlfmt.enable = true;
nixpkgs-fmt.enable = true; nixpkgs-fmt.enable = true;
shfmt.enable = true; shfmt.enable = true;
yamlfmt.enable = true;
}; };
}; };
@ -135,6 +139,7 @@
name = "dotfiles"; name = "dotfiles";
inputsFrom = [ inputsFrom = [
config.flake-root.devShell
config.treefmt.build.devShell config.treefmt.build.devShell
]; ];
}; };

View file

@ -1,19 +1,19 @@
(let [formatter (require :formatter) (let [formatter (require :formatter)
formatter-utils (require :formatter.util) formatter-utils (require :formatter.util)
treefmt-exists (vim.fn.executable :treefmt) treefmt-exists (vim.fn.executable :treefmt)
treefmt-formatter #{:exe :treefmt treefmt-formatter #{:exe :treefmt :stdin false :tempfile_prefix :treefmt}]
:stdin false
:tempfile_prefix :treefmt
:tempfile_postfix (.. "."
(formatter-utils.get_current_buffer_file_extension))}]
(fn builtin-formatter [ft formatter] (fn builtin-formatter [ft formatter]
(let [file (.. :formatter.filetypes. ft)] (let [file (.. :formatter.filetypes. ft)]
(. (require file) formatter))) (. (require file) formatter)))
(fn prefer-treefmt [ft formatter] (fn other-formatter [ft-or-fn formatter]
(if (= (type ft-or-fn) :function) (ft-or-fn)
((builtin-formatter ft-or-fn formatter))))
(fn prefer-treefmt [ft-or-fn formatter]
(if (= treefmt-exists 1) (if (= treefmt-exists 1)
(treefmt-formatter) (treefmt-formatter)
((builtin-formatter ft formatter)))) (other-formatter ft-or-fn formatter)))
(formatter.setup {:logging true (formatter.setup {:logging true
:log_level vim.log.levels.WARN :log_level vim.log.levels.WARN
@ -28,5 +28,8 @@
:sh [(prefer-treefmt :sh :shfmt)] :sh [(prefer-treefmt :sh :shfmt)]
:toml [(prefer-treefmt :toml :taplo)] :toml [(prefer-treefmt :toml :taplo)]
:typescript [(prefer-treefmt :typescript :typescript [(prefer-treefmt :typescript
:prettier)]}})) :prettier)]
:yaml [(prefer-treefmt #{:exe :yamlfmt
:args [:-in]
:stdin true})]}}))

View file

@ -49,6 +49,7 @@ in
shfmt shfmt
statix statix
yamllint yamllint
yamlfmt
] ++ optionals isDarwin [ ] ++ optionals isDarwin [
xcbuild xcbuild
]; ];

View file

@ -89,8 +89,8 @@ in
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ggandor"; owner = "ggandor";
repo = "leap.nvim"; repo = "leap.nvim";
rev = "059cc61437ae8479768025ba837f3caee16a65e6"; rev = "bfb20783d951cf349ee8bab7e0f468351176dd75";
sha256 = "1kr3agfhz8mplycnnlqwav2s0rylbrn0iz762hr9hdmraj18rjr2"; sha256 = "0igwm79nsl72i5ygh5q9q0jpd8xhdrjv5n0py2j4q9ar1r1ly391";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
@ -279,8 +279,8 @@ in
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "mfussenegger"; owner = "mfussenegger";
repo = "nvim-lint"; repo = "nvim-lint";
rev = "eecf96bf2fbd12042933bb1e6193c358749e2b9b"; rev = "808e8fdbee02ed2c6efc17e70c7453fccf5d5a1d";
sha256 = "0mlhmrlxbhgzy1dfff2v9rbl8abxfsdxwjbdw4fwmc246crxdld1"; sha256 = "1q0ryrsmiil2l2dfhlxnkgahxw5jnfbiv1b48ly2iscqldrsm9sb";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
@ -418,12 +418,12 @@ in
}; };
formatter-nvim = buildVimPluginFrom2Nix { formatter-nvim = buildVimPluginFrom2Nix {
pname = "formatter.nvim"; pname = "formatter.nvim";
version = "2023-04-30"; version = "2023-07-13";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "mhartington"; owner = "mhartington";
repo = "formatter.nvim"; repo = "formatter.nvim";
rev = "fa4f2729cc2909db599169f22d8e55632d4c8d59"; rev = "9bf2e7e294b00bac87c6123c889828ee08dc9b46";
sha256 = "0hv79gdg7cgqr3a8vw1ysc48f6i3b8xabbglxspm5mbpf22c8xbk"; sha256 = "0hmlh6qcra7sfq0i989cxs5jmgk6774bljzvq9m17ybwj3imb14f";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };

View file

@ -1,24 +1,19 @@
---
# Utils # Utils
- src: nvim-lua/popup.nvim - src: nvim-lua/popup.nvim
- src: nvim-lua/plenary.nvim - src: nvim-lua/plenary.nvim
- src: kyazdani42/nvim-web-devicons - src: kyazdani42/nvim-web-devicons
# Keybindings # Keybindings
- src: ojroques/nvim-osc52 - src: ojroques/nvim-osc52
- src: gbprod/yanky.nvim - src: gbprod/yanky.nvim
- src: gbprod/cutlass.nvim - src: gbprod/cutlass.nvim
- src: gbprod/substitute.nvim - src: gbprod/substitute.nvim
- src: ggandor/leap.nvim - src: ggandor/leap.nvim
# Themes # Themes
- src: Mofiqul/dracula.nvim - src: Mofiqul/dracula.nvim
# Syntax # Syntax
- src: nvim-treesitter/nvim-treesitter - src: nvim-treesitter/nvim-treesitter
- src: HiPhish/nvim-ts-rainbow2 - src: HiPhish/nvim-ts-rainbow2
- src: nvim-treesitter/playground - src: nvim-treesitter/playground
# Telescope # Telescope
- src: nvim-telescope/telescope.nvim - src: nvim-telescope/telescope.nvim
- src: nvim-telescope/telescope-fzf-native.nvim - src: nvim-telescope/telescope-fzf-native.nvim
@ -29,24 +24,19 @@
- src: nvim-telescope/telescope-ui-select.nvim - src: nvim-telescope/telescope-ui-select.nvim
- src: "https://git.sr.ht/~havi/telescope-toggleterm.nvim" - src: "https://git.sr.ht/~havi/telescope-toggleterm.nvim"
- src: debugloop/telescope-undo.nvim - src: debugloop/telescope-undo.nvim
# LSP # LSP
- src: neovim/nvim-lspconfig - src: neovim/nvim-lspconfig
- src: mfussenegger/nvim-jdtls - src: mfussenegger/nvim-jdtls
- src: onsails/lspkind.nvim - src: onsails/lspkind.nvim
- src: SmiteshP/nvim-navic - src: SmiteshP/nvim-navic
- src: RRethy/vim-illuminate - src: RRethy/vim-illuminate
# Linter # Linter
- src: mfussenegger/nvim-lint - src: mfussenegger/nvim-lint
# Comments # Comments
- src: numtostr/comment.nvim - src: numtostr/comment.nvim
# Snippets # Snippets
- src: L3MON4D3/LuaSnip - src: L3MON4D3/LuaSnip
- src: rafamadriz/friendly-snippets - src: rafamadriz/friendly-snippets
# cmp # cmp
- src: hrsh7th/nvim-cmp - src: hrsh7th/nvim-cmp
- src: hrsh7th/cmp-nvim-lsp - src: hrsh7th/cmp-nvim-lsp
@ -57,19 +47,15 @@
- src: ray-x/cmp-treesitter - src: ray-x/cmp-treesitter
- src: hrsh7th/cmp-cmdline - src: hrsh7th/cmp-cmdline
- src: hrsh7th/cmp-nvim-lsp-document-symbol - src: hrsh7th/cmp-nvim-lsp-document-symbol
# Formatting # Formatting
- src: mhartington/formatter.nvim - src: mhartington/formatter.nvim
# Pairs # Pairs
- src: windwp/nvim-autopairs - src: windwp/nvim-autopairs
- src: windwp/nvim-ts-autotag - src: windwp/nvim-ts-autotag
- src: andymass/vim-matchup - src: andymass/vim-matchup
# Textobjects # Textobjects
- src: nvim-treesitter/nvim-treesitter-textobjects - src: nvim-treesitter/nvim-treesitter-textobjects
- src: kylechui/nvim-surround - src: kylechui/nvim-surround
# UI # UI
- src: rebelot/heirline.nvim - src: rebelot/heirline.nvim
- src: lukas-reineke/indent-blankline.nvim - src: lukas-reineke/indent-blankline.nvim

View file

@ -35,7 +35,7 @@ for plugin in "${plugin_array[@]}"; do
echo "Updating ${owner}/${repo} ..." echo "Updating ${owner}/${repo} ..."
if [[ "$raw_src" = http* ]]; then if [[ $raw_src == http* ]]; then
clone_src="$raw_src" clone_src="$raw_src"
else else
clone_src="https://github.com/${owner}/${repo}.git" clone_src="https://github.com/${owner}/${repo}.git"