style: fmt

This commit is contained in:
Marvin Drescher 2024-01-30 09:09:50 +01:00
parent 8b36fe97d0
commit fa4f77984e

View File

@ -1,8 +1,7 @@
{ { config
config, , pkgs
pkgs, , lib
lib, , ...
...
}: }:
with lib; let with lib; let
rust-analyzer = rust-analyzer =
@ -32,7 +31,8 @@ with lib; let
name = "nvim-rust"; name = "nvim-rust";
paths = [ rustc cargo rustfmt clippy cargo-watch ]; paths = [ rustc cargo rustfmt clippy cargo-watch ];
}; };
in { in
{
programs.neovim = { programs.neovim = {
# https://github.com/nix-community/home-manager/blob/master/modules/programs/neovim.nix # https://github.com/nix-community/home-manager/blob/master/modules/programs/neovim.nix
enable = true; enable = true;
@ -87,11 +87,13 @@ in {
telescope-undo-nvim telescope-undo-nvim
oil-nvim oil-nvim
]; ];
extraLuaConfig = let extraLuaConfig =
let
# tries to compute a package set required to make package resolution in lua # tries to compute a package set required to make package resolution in lua
# via deps["pkg"] work # via deps["pkg"] work
inherit (builtins) head tail hasAttr getAttr; inherit (builtins) head tail hasAttr getAttr;
pkg = parts: pkgs: let pkg = parts: pkgs:
let
rem = tail parts; rem = tail parts;
subset = subset =
if hasAttr (head parts) pkgs if hasAttr (head parts) pkgs
@ -102,7 +104,8 @@ in {
then subset then subset
else builtins.addErrorContext "${concatStringsSep "." parts}" (pkg rem subset); else builtins.addErrorContext "${concatStringsSep "." parts}" (pkg rem subset);
getPkg = name: let parts = builtins.split "\\." name; in pkg parts pkgs; getPkg = name: let parts = builtins.split "\\." name; in pkg parts pkgs;
packages = file: let packages = file:
let
out = builtins.readFile (pkgs.runCommandLocal "extract-deps" out = builtins.readFile (pkgs.runCommandLocal "extract-deps"
{ {
nativeBuildInputs = [ pkgs.gnused ]; nativeBuildInputs = [ pkgs.gnused ];
@ -145,7 +148,8 @@ in {
''; '';
}; };
programs.git.ignores = [ ".nvim_session" ]; programs.git.ignores = [ ".nvim_session" ];
xdg.configFile."nvim/coc-settings.json".text = let xdg.configFile."nvim/coc-settings.json".text =
let
preferProjectEnv = binName: alternate: preferProjectEnv = binName: alternate:
pkgs.writeShellScript "${binName}-switcher" '' pkgs.writeShellScript "${binName}-switcher" ''
if command -v ${binName}; then if command -v ${binName}; then
@ -154,10 +158,11 @@ in {
${alternate} ''${@} ${alternate} ''${@}
fi fi
''; '';
addSDK = { addSDK =
name, { name
lsp, , lsp
sdk, , sdk
,
}: }:
with pkgs; with pkgs;
runCommandLocal name runCommandLocal name