Skip to content

Commit

Permalink
Add nixd.
Browse files Browse the repository at this point in the history
Add nixd to flake.nix and legacyPackages.nix.

Format with alejandra.
  • Loading branch information
Elias-Ainsworth committed Nov 11, 2024
1 parent 8997e62 commit 3d1e38c
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 4 deletions.
96 changes: 96 additions & 0 deletions flake.lock

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

21 changes: 17 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
# inputs is used to get the original standard library, and to pass inputs to the plugin autodiscovery function
lib = import ./lib/stdlib-extended.nix inputs;
in
flake-parts.lib.mkFlake {
flake-parts.lib.mkFlake
{
inherit inputs;
specialArgs = {inherit lib;};
} {
specialArgs = {
inherit lib;
};
}
{
# Allow users to bring their own systems.
# «https://github.com/nix-systems/nix-systems»
systems = import inputs.systems;
Expand Down Expand Up @@ -66,7 +70,12 @@
default = self'.devShells.lsp;
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
lsp = pkgs.mkShell {
packages = with pkgs; [nil statix deadnix alejandra];
packages = with pkgs; [
nil
statix
deadnix
alejandra
];
};
};

Expand Down Expand Up @@ -111,6 +120,10 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
nixd = {
url = "github:nix-community/nixd";
inputs.nixpkgs.follows = "nixpkgs";
};

## Plugins
# LSP plugins
Expand Down
1 change: 1 addition & 0 deletions flake/legacyPackages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
(_: _: {
rnix-lsp = inputs'.rnix-lsp.defaultPackage;
nil = inputs'.nil.packages.default;
nixd = inputs'.nixd.packages.default;
})
];
};
Expand Down
16 changes: 16 additions & 0 deletions modules/plugins/languages/nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@
}
'';
};

nixd = {
package = pkgs.nixd;
internalFormatter = cfg.format.type == "nixpkgs-fmt";
lspConfig = ''
lspconfig.nixd.setup{
capabilities = capabilities,
${
if (cfg.format.enable && cfg.format.type == "nixpkgs-fmt")
then useFormat
else noFormat
},
cmd = ${packageToCmd cfg.lsp.package "nixd"},
}
'';
};
};

defaultFormat = "alejandra";
Expand Down

0 comments on commit 3d1e38c

Please sign in to comment.