temporary nvim lsp/fmt support
This commit is contained in:
parent
65b39ce021
commit
21a081e2a5
11 changed files with 182 additions and 35 deletions
|
@ -26,7 +26,7 @@ in
|
||||||
++ optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
|
++ optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
|
||||||
|
|
||||||
programs.firefox = {
|
programs.firefox = {
|
||||||
package = pkgs.firefox-beta;
|
# package = pkgs.firefox-beta;
|
||||||
enable = true;
|
enable = true;
|
||||||
nativeMessagingHosts.packages =
|
nativeMessagingHosts.packages =
|
||||||
[ ]
|
[ ]
|
||||||
|
|
69
common/tooling/c.nix
Normal file
69
common/tooling/c.nix
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
lang_support_id = "c";
|
||||||
|
inherit (config.grimmShared) enable tooling graphical;
|
||||||
|
inherit (lib)
|
||||||
|
optionals
|
||||||
|
mkIf
|
||||||
|
getExe'
|
||||||
|
types
|
||||||
|
mkOption
|
||||||
|
elem
|
||||||
|
;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = mkIf (enable && tooling.enable && (elem lang_support_id tooling.supportedLangs)) {
|
||||||
|
environment.systemPackages =
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
util-linux
|
||||||
|
linuxPackages.perf
|
||||||
|
pkg-config
|
||||||
|
glib
|
||||||
|
glibc
|
||||||
|
clang
|
||||||
|
clang-tools
|
||||||
|
]
|
||||||
|
++ optionals graphical [
|
||||||
|
libva-utils
|
||||||
|
jetbrains.clion
|
||||||
|
];
|
||||||
|
|
||||||
|
grimmShared.tooling.lang_servers = [
|
||||||
|
{
|
||||||
|
lsp = {
|
||||||
|
package = pkgs.clang-tools;
|
||||||
|
lspconf_config = ''
|
||||||
|
{
|
||||||
|
cmd = { 'clangd', '--background-index'},
|
||||||
|
root_dir = require("lspconfig.util").root_pattern(
|
||||||
|
"CMakeLists.txt",
|
||||||
|
"flake.nix",
|
||||||
|
".git"
|
||||||
|
)
|
||||||
|
}'';
|
||||||
|
lspconf_mod_name = "clangd";
|
||||||
|
};
|
||||||
|
fmt = rec {
|
||||||
|
package = pkgs.clang-tools;
|
||||||
|
command = getExe' package "clang-format";
|
||||||
|
includes = [
|
||||||
|
"*.c"
|
||||||
|
"*.h"
|
||||||
|
"*.cpp"
|
||||||
|
"*.hpp"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
options.grimmShared.tooling.supportedLangs = mkOption {
|
||||||
|
type = types.listOf (types.enum [ lang_support_id ]);
|
||||||
|
};
|
||||||
|
}
|
|
@ -8,6 +8,8 @@ let
|
||||||
inherit (config.grimmShared) enable tooling graphical;
|
inherit (config.grimmShared) enable tooling graphical;
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
getExe
|
getExe
|
||||||
optionals
|
optionals
|
||||||
mkIf
|
mkIf
|
||||||
|
@ -23,6 +25,8 @@ in
|
||||||
./nvim.nix
|
./nvim.nix
|
||||||
./lsp.nix
|
./lsp.nix
|
||||||
./git.nix
|
./git.nix
|
||||||
|
./c.nix
|
||||||
|
./java.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
config = mkIf (enable && tooling.enable) {
|
config = mkIf (enable && tooling.enable) {
|
||||||
|
@ -40,14 +44,9 @@ in
|
||||||
wget
|
wget
|
||||||
bat
|
bat
|
||||||
hyfetch
|
hyfetch
|
||||||
util-linux
|
|
||||||
btop
|
btop
|
||||||
linuxPackages.perf
|
|
||||||
eza
|
eza
|
||||||
|
|
||||||
gcc
|
|
||||||
jdk17
|
|
||||||
pkg-config
|
|
||||||
unzip
|
unzip
|
||||||
p7zip
|
p7zip
|
||||||
|
|
||||||
|
@ -55,13 +54,10 @@ in
|
||||||
gomuks
|
gomuks
|
||||||
ranger
|
ranger
|
||||||
|
|
||||||
visualvm
|
|
||||||
imagemagick
|
imagemagick
|
||||||
nmap
|
nmap
|
||||||
|
|
||||||
parted
|
parted
|
||||||
glib
|
|
||||||
glibc
|
|
||||||
expect
|
expect
|
||||||
]
|
]
|
||||||
++ optionals graphical [
|
++ optionals graphical [
|
||||||
|
@ -69,8 +65,6 @@ in
|
||||||
qdirstat
|
qdirstat
|
||||||
libva-utils
|
libva-utils
|
||||||
gparted
|
gparted
|
||||||
jetbrains.clion
|
|
||||||
jetbrains.idea-community
|
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.shellAliases = {
|
environment.shellAliases = {
|
||||||
|
@ -108,5 +102,11 @@ in
|
||||||
|
|
||||||
options.grimmShared.tooling = {
|
options.grimmShared.tooling = {
|
||||||
enable = mkEnableOption "grimm-tooling";
|
enable = mkEnableOption "grimm-tooling";
|
||||||
|
|
||||||
|
supportedLangs = mkOption {
|
||||||
|
type = types.listOf (types.enum [ ]);
|
||||||
|
default = [ ];
|
||||||
|
description = "Languages for which to enable support";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
41
common/tooling/java.nix
Normal file
41
common/tooling/java.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
lang_support_id = "java";
|
||||||
|
inherit (config.grimmShared) enable tooling graphical;
|
||||||
|
inherit (lib)
|
||||||
|
optionals
|
||||||
|
mkIf
|
||||||
|
types
|
||||||
|
mkOption
|
||||||
|
elem
|
||||||
|
;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = mkIf (enable && tooling.enable && (elem lang_support_id tooling.supportedLangs)) {
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgs.jdk17
|
||||||
|
pkgs.visualvm
|
||||||
|
] ++ optionals graphical [ pkgs.jetbrains.idea-community ];
|
||||||
|
|
||||||
|
grimmShared.tooling.lang_servers = [
|
||||||
|
{
|
||||||
|
lsp = {
|
||||||
|
package = pkgs.java-language-server;
|
||||||
|
};
|
||||||
|
fmt = {
|
||||||
|
package = pkgs.google-java-format;
|
||||||
|
includes = [ "*.java" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
options.grimmShared.tooling.supportedLangs = mkOption {
|
||||||
|
type = types.listOf (types.enum [ lang_support_id ]);
|
||||||
|
};
|
||||||
|
}
|
|
@ -23,7 +23,7 @@ let
|
||||||
(
|
(
|
||||||
''
|
''
|
||||||
[formatter.${getName fmt.package}]
|
[formatter.${getName fmt.package}]
|
||||||
command = "${getExe fmt.package}"
|
command = "${fmt.command}"
|
||||||
includes = ${builtins.toJSON fmt.includes}
|
includes = ${builtins.toJSON fmt.includes}
|
||||||
''
|
''
|
||||||
+ (optionalString (fmt.options != [ ]) "options = ${builtins.toJSON fmt.options}\n")
|
+ (optionalString (fmt.options != [ ]) "options = ${builtins.toJSON fmt.options}\n")
|
||||||
|
@ -42,7 +42,6 @@ in
|
||||||
++ (map (v: v.lsp.package) (filter (v: !isNull v.lsp) tooling.lang_servers))
|
++ (map (v: v.lsp.package) (filter (v: !isNull v.lsp) tooling.lang_servers))
|
||||||
++ (map (v: v.fmt.package) (filter (v: !isNull v.fmt) tooling.lang_servers));
|
++ (map (v: v.fmt.package) (filter (v: !isNull v.fmt) tooling.lang_servers));
|
||||||
|
|
||||||
# environment.shellAliases."treefmt" = "${getExe pkgs.treefmt} --config-file ${treefmt_conf}";
|
|
||||||
environment.shellAliases."treefmt" = "${getExe pkgs.treefmt} --config-file $(${getExe find_conf})";
|
environment.shellAliases."treefmt" = "${getExe pkgs.treefmt} --config-file $(${getExe find_conf})";
|
||||||
|
|
||||||
grimmShared.tooling.nvim.extraLuaRC =
|
grimmShared.tooling.nvim.extraLuaRC =
|
||||||
|
@ -71,7 +70,7 @@ in
|
||||||
options = {
|
options = {
|
||||||
lspconf_mod_name = mkOption {
|
lspconf_mod_name = mkOption {
|
||||||
type = types.nullOr types.nonEmptyStr;
|
type = types.nullOr types.nonEmptyStr;
|
||||||
default = getName config.package;
|
default = builtins.replaceStrings [ "-" ] [ "_" ] (getName config.package);
|
||||||
description = "lspconfig module name";
|
description = "lspconfig module name";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,10 @@ in
|
||||||
|
|
||||||
programs.git.config.core.editor = getExe pkgs.neovim;
|
programs.git.config.core.editor = getExe pkgs.neovim;
|
||||||
|
|
||||||
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ vim-monokai-pro ];
|
grimmShared.tooling.nvim = {
|
||||||
|
plugins = with pkgs.vimPlugins; [ vim-monokai-pro ];
|
||||||
|
# extraLuaRC = [ "vim.lsp.inlay_hint.enable(true)" ];
|
||||||
|
};
|
||||||
|
|
||||||
programs.neovim = {
|
programs.neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
lang_support_id = "python";
|
||||||
inherit (config.grimmShared) enable tooling graphical;
|
inherit (config.grimmShared) enable tooling graphical;
|
||||||
pyLibs =
|
pyLibs =
|
||||||
python-pkgs: with python-pkgs; [
|
python-pkgs: with python-pkgs; [
|
||||||
|
@ -14,17 +15,26 @@ let
|
||||||
scipy
|
scipy
|
||||||
pygobject3
|
pygobject3
|
||||||
];
|
];
|
||||||
|
|
||||||
|
inherit (lib)
|
||||||
|
mkIf
|
||||||
|
types
|
||||||
|
mkOption
|
||||||
|
mapAttrsToList
|
||||||
|
concatLines
|
||||||
|
elem
|
||||||
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkIf (enable && tooling.enable) {
|
config = mkIf (enable && tooling.enable && (elem lang_support_id tooling.supportedLangs)) {
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
(pkgs.python3.withPackages pyLibs)
|
(pkgs.python3.withPackages pyLibs)
|
||||||
] ++ lib.optionals graphical (with pkgs; [ jetbrains.pycharm-community ]);
|
] ++ lib.optionals graphical (with pkgs; [ jetbrains.pycharm-community ]);
|
||||||
|
|
||||||
programs.xonsh = {
|
programs.xonsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = lib.concatLines (
|
config = concatLines (
|
||||||
lib.mapAttrsToList (
|
mapAttrsToList (
|
||||||
name: value: "aliases[\"${name}\"] = '''${value}'''"
|
name: value: "aliases[\"${name}\"] = '''${value}'''"
|
||||||
) config.environment.shellAliases
|
) config.environment.shellAliases
|
||||||
);
|
);
|
||||||
|
@ -42,4 +52,8 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
options.grimmShared.tooling.supportedLangs = mkOption {
|
||||||
|
type = types.listOf (types.enum [ lang_support_id ]);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,30 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
lang_support_id = "rust";
|
||||||
|
inherit (lib)
|
||||||
|
optionals
|
||||||
|
mkIf
|
||||||
|
types
|
||||||
|
mkOption
|
||||||
|
elem
|
||||||
|
;
|
||||||
inherit (config.grimmShared) enable tooling graphical;
|
inherit (config.grimmShared) enable tooling graphical;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkIf (enable && tooling.enable) {
|
config = mkIf (enable && tooling.enable && (elem lang_support_id tooling.supportedLangs)) {
|
||||||
environment.systemPackages =
|
environment.systemPackages =
|
||||||
with pkgs;
|
with pkgs;
|
||||||
[ pkg-config ] ++ lib.optionals graphical [ jetbrains.clion ];
|
[
|
||||||
|
pkg-config
|
||||||
|
cargo
|
||||||
|
]
|
||||||
|
++ optionals graphical [ jetbrains.clion ];
|
||||||
|
|
||||||
grimmShared.tooling.lang_servers = [
|
grimmShared.tooling.lang_servers = [
|
||||||
{
|
{
|
||||||
lsp = {
|
lsp = {
|
||||||
package = pkgs.rust-analyzer;
|
package = pkgs.rust-analyzer;
|
||||||
lspconf_mod_name = "rust_analyzer";
|
|
||||||
};
|
};
|
||||||
fmt = {
|
fmt = {
|
||||||
package = pkgs.rustfmt;
|
package = pkgs.rustfmt;
|
||||||
|
@ -26,4 +37,8 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
options.grimmShared.tooling.supportedLangs = mkOption {
|
||||||
|
type = types.listOf (types.enum [ lang_support_id ]);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
locale = true;
|
locale = true;
|
||||||
network = true;
|
network = true;
|
||||||
tooling = {
|
tooling = {
|
||||||
|
supportedLangs = [
|
||||||
|
"rust"
|
||||||
|
"c"
|
||||||
|
"java"
|
||||||
|
"python"
|
||||||
|
];
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,11 +28,11 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs_patches = [
|
nixpkgs_patches = [
|
||||||
{
|
#{
|
||||||
# xonsh update
|
# # xonsh update
|
||||||
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/305316.patch";
|
# url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/305316.patch";
|
||||||
hash = "sha256-W3jh6qRA/7V1fImLm3vRmaT6h6gL5rlNBUuIidZHaZc=";
|
# hash = "sha256-W3jh6qRA/7V1fImLm3vRmaT6h6gL5rlNBUuIidZHaZc=";
|
||||||
}
|
#}
|
||||||
];
|
];
|
||||||
|
|
||||||
# enable ccache for lix if ccache is enabled
|
# enable ccache for lix if ccache is enabled
|
||||||
|
|
|
@ -29,22 +29,22 @@
|
||||||
"homepage": "https://nyx.chaotic.cx",
|
"homepage": "https://nyx.chaotic.cx",
|
||||||
"owner": "chaotic-cx",
|
"owner": "chaotic-cx",
|
||||||
"repo": "nyx",
|
"repo": "nyx",
|
||||||
"rev": "bae54b9e537d17c298b30436990d4962caab73d0",
|
"rev": "5b1f4d9d757db78bc0fdf3e3bd0b161d46d6bc5d",
|
||||||
"sha256": "13p1ygwf7q95na4lc3b4cp8rinpc4jvdhyz4c50ig77iz55mvbij",
|
"sha256": "0qsya33g1my8xcvd1a6l1nsmcgnam0wknfrpmvfl39c1jmj7rgzv",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://github.com/chaotic-cx/nyx/archive/bae54b9e537d17c298b30436990d4962caab73d0.tar.gz",
|
"url": "https://github.com/chaotic-cx/nyx/archive/5b1f4d9d757db78bc0fdf3e3bd0b161d46d6bc5d.tar.gz",
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
},
|
},
|
||||||
"lix-module": {
|
"lix-module": {
|
||||||
"branch": "main",
|
"branch": "main",
|
||||||
"repo": "https://git.lix.systems/lix-project/nixos-module.git",
|
"repo": "https://git.lix.systems/lix-project/nixos-module.git",
|
||||||
"rev": "c8ab1e79ba0140bc75731c75177242089506260b",
|
"rev": "53d713eb486f21d653af3ef3528e9a19ecfc45e5",
|
||||||
"type": "git"
|
"type": "git"
|
||||||
},
|
},
|
||||||
"lix-pkg": {
|
"lix-pkg": {
|
||||||
"branch": "main",
|
"branch": "main",
|
||||||
"repo": "https://git.lix.systems/lix-project/lix.git",
|
"repo": "https://git.lix.systems/lix-project/lix.git",
|
||||||
"rev": "ceccac835c55e3b5c805851bad871360641ff1d9",
|
"rev": "005ee33a9a145f714f4837b1c0b5c430ac3bc588",
|
||||||
"type": "git"
|
"type": "git"
|
||||||
},
|
},
|
||||||
"nixos-mailserver": {
|
"nixos-mailserver": {
|
||||||
|
@ -66,15 +66,15 @@
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"branch": "nixos-unstable",
|
"branch": "nixos-unstable-small",
|
||||||
"description": "Nix Packages collection",
|
"description": "Nix Packages collection",
|
||||||
"homepage": null,
|
"homepage": null,
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "f1010e0469db743d14519a1efd37e23f8513d714",
|
"rev": "22b25d36f84f5449e2799af1def209278ef75147",
|
||||||
"sha256": "0khh2y04wp4dy1hy0nxc4raacp8149ds7mpwmnymf55v7xzf10vn",
|
"sha256": "14a1ym1bml6n4lnxhxgsk6dvdn5c8ivhl1xl5v2l6awcw9q2vf0g",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/f1010e0469db743d14519a1efd37e23f8513d714.tar.gz",
|
"url": "https://github.com/NixOS/nixpkgs/archive/22b25d36f84f5449e2799af1def209278ef75147.tar.gz",
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue