Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,6 @@ neovim-update: ## Update Neovim plugins.
neovim-sync: ## Sync Neovim plugins.
@echo "🔄 Syncing neovim plugins..."
@nvim --headless +"lua vim.cmd('source ' .. vim.fn.stdpath('config') .. '/init.lua')" +qa
@if [ -f "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json" ]; then \
if [ "$$(uname)" = "Darwin" ]; then \
sed -i '' -e '$$ { /^$$/d; }' "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json"; \
else \
sed -i -e '$$ { /^$$/d; }' "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json"; \
fi && \
printf '\n' >> "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json"; \
fi
@echo "✅ Neovim plugins synced"

##@ Lua
Expand Down
23 changes: 19 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
...
}:
let
inherit (inputs.nixpkgs) lib;
devenvRoot =
let
envRoot = builtins.getEnv "DEVENV_ROOT";
Expand All @@ -151,6 +152,23 @@
};
overlays = (import ./overlays) { inherit inputs; };
};
treefmtToml = builtins.fromTOML (builtins.readFile ./treefmt.toml);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium

This approach introduces significant architectural complexity. You're reading treefmt.toml, parsing it, then overriding commands manually with lib.recursiveUpdate. This creates duplication since treefmt.toml already defines these commands. The previous programs.jsonfmt.enable = true pattern was simpler and more maintainable. What specific problem does this refactoring solve?
Agent: 🏛 Architecture

treefmtSettings = lib.recursiveUpdate treefmtToml {
formatter = {
nix = (treefmtToml.formatter.nix or { }) // {
command = lib.getExe pkgs.nixfmt-rfc-style;
};
biome = (treefmtToml.formatter.biome or { }) // {
command = lib.getExe pkgs.biome;
};
json = (treefmtToml.formatter.json or { }) // {
command = lib.getExe pkgs.jsonfmt;
};
shell = (treefmtToml.formatter.shell or { }) // {
command = lib.getExe pkgs.shfmt;
};
};
};
Comment on lines +156 to +171

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for constructing treefmtSettings can be simplified. Since you are using lib.recursiveUpdate, you don't need to manually merge each formatter's attributes with (treefmtToml.formatter.<name> or { }) // { ... }. The recursiveUpdate function will handle merging the command attribute into the existing formatter definitions from treefmt.toml correctly.

Simplifying this will make the code more concise and easier to read.

          treefmtSettings = lib.recursiveUpdate treefmtToml {
            formatter = {
              nix.command = lib.getExe pkgs.nixfmt-rfc-style;
              biome.command = lib.getExe pkgs.biome;
              json.command = lib.getExe pkgs.jsonfmt;
              shell.command = lib.getExe pkgs.shfmt;
            };
          };

in
{
# Force this attribute so devenv's deprecated helper packages don't surface during flake checks.
Expand All @@ -166,14 +184,11 @@
treefmt = {
projectRootFile = "flake.nix";
programs = {
biome.enable = true;
nixfmt.enable = true;
shfmt.enable = true;
stylua.enable = true;
taplo.enable = true;
jsonfmt.enable = true;
yamlfmt.enable = true;
};
settings = treefmtSettings;
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion home-manager/programs/neovim/nvim-pack-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@
"src": "https://github.com/christoomey/vim-tmux-navigator"
}
}
}
}
2 changes: 2 additions & 0 deletions home-manager/programs/zoxide/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
{
programs.zoxide = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
enableZshIntegration = true;
};
}
1 change: 1 addition & 0 deletions treefmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ excludes = ["*.json"]
[formatter.json]
command = "jsonfmt"
includes = ["*.json"]
excludes = ["home-manager/programs/neovim/nvim-pack-lock.json"]

[formatter.shell]
command = "shfmt"
Expand Down
Loading