Skip to content

Commit

Permalink
Set up Nix LSP and auto-formatting in VSCode
Browse files Browse the repository at this point in the history
  • Loading branch information
bjeanes committed Jul 19, 2024
1 parent 8e31752 commit c292c57
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"jeff-hykin.better-nix-syntax",
"pinage404.nix-extension-pack",
"mkhl.direnv"
]
}
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"nix.enableLanguageServer": true,
"nix.formatterPath": "nixpkgs-fmt",
"nix.serverSettings": {
"nil": {
"formatting": {
"command": [
"nixpkgs-fmt"
],
}
}
},
"direnv.restart.automatic": true,
}
52 changes: 52 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@

treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";

nil = {
url = "github:oxalica/nil";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "nixvim/devshell/flake-utils";
};
};

outputs = inputs@{ self, ... }:
Expand Down Expand Up @@ -383,6 +389,14 @@
treefmt.config = {
projectRootFile = "flake.lock";
programs.nixpkgs-fmt.enable = true;
programs.nixpkgs-fmt.package = pkgs.nixpkgs-fmt;
};

devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
inputs.nil.packages.${system}.nil
nixpkgs-fmt
];
};
};
}
Expand Down

0 comments on commit c292c57

Please sign in to comment.