diff --git a/templates/default/.envrc b/templates/default/.envrc index 6ca825e..9706a5e 100644 --- a/templates/default/.envrc +++ b/templates/default/.envrc @@ -3,7 +3,6 @@ # Automatically reload when this file changes watch_file ./nix/devshells/default.nix -watch_file ./nix/devshells/rust.nix watch_file ./nix/*.nix # Load `nix develop` diff --git a/templates/default/.vscode/settings.json b/templates/default/.vscode/settings.json index f298c94..0067b69 100644 --- a/templates/default/.vscode/settings.json +++ b/templates/default/.vscode/settings.json @@ -11,18 +11,15 @@ // settings for 'nil' LSP "nil": { "formatting": { - "command": ["treefmt", "--stdin", "neverexists.nix"] + "command": ["treefmt-nix", "--stdin", "neverexists.nix"] } } }, + "[rust]": { "editor.formatOnSave": true, "editor.defaultFormatter": "rust-lang.rust-analyzer" }, "rust-analyzer.interpret.tests": true, - "rust-analyzer.cfg.setTest": true, - - // FIXME(upstream): without these treefmt-vscode will look for a config - "treefmt.command": "treefmt", - "treefmt.config": "" + "rust-analyzer.cfg.setTest": true } diff --git a/templates/default/nix/devshells/default.nix b/templates/default/nix/devshells/default.nix index 1e2472c..29ac272 100644 --- a/templates/default/nix/devshells/default.nix +++ b/templates/default/nix/devshells/default.nix @@ -8,12 +8,21 @@ pkgs.mkShell { packages = [ flake.formatter.${system} pkgs.jq - pkgs.nil ]; # Add environment variables env = { }; # Load custom bash code - shellHook = ''''; + shellHook = + # TODO(blocked/upstream): remove this once https://github.com/isbecker/treefmt-vscode/issues/3 is resolved + # (flake.inputs.nixago.lib.${system}.make { + # data = flake.formatter.${system}.settings; + # output = "treefmt.toml"; + # format = "toml"; + # }).shellHook + # + + '' + echo $(git rev-parse --show-toplevel) + ''; }