Compare commits
3 Commits
b72e2a05bd
...
3d88a303bd
Author | SHA1 | Date | |
---|---|---|---|
3d88a303bd | |||
a791b41455 | |||
7b2265b906 |
@ -13,7 +13,6 @@ let
|
||||
getExe
|
||||
optionals
|
||||
mkIf
|
||||
concatLines
|
||||
;
|
||||
in
|
||||
{
|
||||
@ -22,6 +21,9 @@ in
|
||||
./nix.nix
|
||||
./security.nix
|
||||
./python.nix
|
||||
./rust.nix
|
||||
./nvim.nix
|
||||
./lsp.nix
|
||||
];
|
||||
|
||||
config = mkIf (enable && tooling.enable) {
|
||||
@ -34,15 +36,13 @@ in
|
||||
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
|
||||
|
||||
urlencode
|
||||
rfindup
|
||||
pstree
|
||||
dos2unix
|
||||
treefmt
|
||||
file
|
||||
wget
|
||||
hyfetch
|
||||
util-linux
|
||||
btop
|
||||
neovim-remote
|
||||
linuxPackages.perf
|
||||
eza
|
||||
|
||||
@ -82,7 +82,6 @@ in
|
||||
config = {
|
||||
init.defaultBranch = "main";
|
||||
credential.username = tooling.git_user;
|
||||
core.editor = getExe pkgs.neovim;
|
||||
user.name = tooling.git_user;
|
||||
user.email = tooling.git_email;
|
||||
push.autoSetupRemote = true;
|
||||
@ -113,46 +112,9 @@ in
|
||||
|
||||
services.dbus.implementation = "broker";
|
||||
|
||||
grimmShared.tooling.nvim = {
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
fugitive
|
||||
nvim-lspconfig
|
||||
];
|
||||
};
|
||||
|
||||
boot.tmp.cleanOnBoot = true;
|
||||
zramSwap.enable = true;
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
defaultEditor = true;
|
||||
configure = {
|
||||
customRC =
|
||||
let
|
||||
luarc = pkgs.writeText "init.lua" (concatLines tooling.nvim.extraLuaRC);
|
||||
in
|
||||
''
|
||||
set number
|
||||
set hidden
|
||||
set fileencodings=utf-8
|
||||
set nocompatible
|
||||
set clipboard+=unnamedplus
|
||||
set ff=unix
|
||||
|
||||
luafile ${luarc}
|
||||
|
||||
if filereadable($HOME . "/.vimrc")
|
||||
source ~/.vimrc
|
||||
endif
|
||||
'';
|
||||
packages.myVimPackage = {
|
||||
start = tooling.nvim.plugins;
|
||||
opt = [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.ssh = {
|
||||
startAgent = true;
|
||||
enableAskPassword = graphical;
|
||||
@ -163,21 +125,6 @@ in
|
||||
|
||||
options.grimmShared.tooling = {
|
||||
enable = mkEnableOption "grimm-tooling";
|
||||
|
||||
nvim = {
|
||||
plugins = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
description = "Extra vim plugins to include";
|
||||
};
|
||||
|
||||
extraLuaRC = mkOption {
|
||||
type = types.listOf types.nonEmptyStr;
|
||||
default = [ ];
|
||||
description = "Extra init LUA scripts";
|
||||
};
|
||||
};
|
||||
|
||||
git_user = mkOption {
|
||||
type = types.str;
|
||||
default = "Grimmauld";
|
||||
|
139
common/tooling/lsp.nix
Normal file
139
common/tooling/lsp.nix
Normal file
@ -0,0 +1,139 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.grimmShared) enable tooling;
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
mkIf
|
||||
getName
|
||||
mkEnableOption
|
||||
getExe
|
||||
filter
|
||||
optionalString
|
||||
concatLines
|
||||
;
|
||||
|
||||
conf_def =
|
||||
fmt:
|
||||
(
|
||||
''
|
||||
[formatter.${getName fmt.package}]
|
||||
command = "${getExe fmt.package}"
|
||||
includes = ${builtins.toJSON fmt.includes}
|
||||
''
|
||||
+ (optionalString (fmt.options != [ ]) "options = ${builtins.toJSON fmt.options}\n")
|
||||
);
|
||||
|
||||
treefmt_conf = pkgs.writeText "treefmt.toml" (
|
||||
concatLines (map (v: (conf_def v.fmt)) (filter (v: !isNull v.fmt) tooling.lang_servers))
|
||||
);
|
||||
|
||||
find_conf = pkgs.writeShellScriptBin "find-treefmt-conf" "(${getExe pkgs.rfindup} treefmt.toml -e 2>/dev/null || echo ${treefmt_conf}) | tr -d '\n'";
|
||||
in
|
||||
{
|
||||
config = mkIf (enable && tooling.enable) {
|
||||
environment.systemPackages =
|
||||
[
|
||||
pkgs.treefmt
|
||||
pkgs.findup
|
||||
pkgs.gnused
|
||||
]
|
||||
++ (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));
|
||||
|
||||
# environment.shellAliases."treefmt" = "${getExe pkgs.treefmt} --config-file ${treefmt_conf}";
|
||||
environment.shellAliases."treefmt" = "${getExe pkgs.treefmt} --config-file $(${getExe find_conf})";
|
||||
|
||||
grimmShared.tooling.nvim.extraLuaRC =
|
||||
[ "vim.g.coq_settings = { auto_start = 'shut-up' }" ]
|
||||
++ (map (
|
||||
v:
|
||||
"require'lspconfig'.${v.lsp.lspconf_mod_name}.setup(require('coq').lsp_ensure_capabilities(${v.lsp.lspconf_config}))"
|
||||
) (filter (v: !isNull v.lsp && v.lsp.vimIntegration) tooling.lang_servers));
|
||||
|
||||
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [
|
||||
nvim-lspconfig
|
||||
coq_nvim
|
||||
coq-artifacts
|
||||
];
|
||||
};
|
||||
|
||||
options.grimmShared.tooling.lang_servers = mkOption {
|
||||
type = types.listOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
lsp = mkOption {
|
||||
type = types.nullOr (
|
||||
types.submodule (
|
||||
{ config, ... }:
|
||||
{
|
||||
options = {
|
||||
lspconf_mod_name = mkOption {
|
||||
type = types.nullOr types.nonEmptyStr;
|
||||
default = getName config.package;
|
||||
description = "lspconfig module name";
|
||||
};
|
||||
|
||||
lspconf_config = mkOption {
|
||||
type = types.nonEmptyStr;
|
||||
default = "{}";
|
||||
description = "options to pass to lspconfig";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = null;
|
||||
description = "LSP package";
|
||||
};
|
||||
|
||||
vimIntegration = mkEnableOption "Enable coq/nvim-lspconfig integration" // {
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
fmt = mkOption {
|
||||
type = types.nullOr (
|
||||
types.submodule (
|
||||
{ config, ... }:
|
||||
{
|
||||
options = {
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = "FMT package";
|
||||
};
|
||||
|
||||
options = mkOption {
|
||||
type = types.listOf types.nonEmptyStr;
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
includes = mkOption {
|
||||
type = types.listOf types.nonEmptyStr;
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
command = mkOption {
|
||||
type = types.nonEmptyStr;
|
||||
default = getExe config.package;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
default = { };
|
||||
description = "Language servers available on the system";
|
||||
};
|
||||
}
|
@ -6,7 +6,6 @@
|
||||
(writeShellScriptBin "rebuild" "bash -c \"nixos-rebuild switch |& nom\"")
|
||||
|
||||
nixpkgs-review
|
||||
nixpkgs-fmt
|
||||
nixfmt-rfc-style
|
||||
nixd
|
||||
nixpkgs-hammering
|
||||
@ -18,9 +17,19 @@
|
||||
|
||||
environment.sessionVariables = lib.mkIf pkgs.config.allowUnfree { NIXPKGS_ALLOW_UNFREE = "1"; };
|
||||
|
||||
grimmShared.tooling.nvim.extraLuaRC = lib.singleton ''
|
||||
require'lspconfig'.nixd.setup{}
|
||||
'';
|
||||
grimmShared.tooling.nvim = {
|
||||
plugins = with pkgs.vimPlugins; [ vim-nix ];
|
||||
};
|
||||
|
||||
grimmShared.tooling.lang_servers = [
|
||||
{
|
||||
lsp.package = pkgs.nixd;
|
||||
fmt = {
|
||||
package = pkgs.nixpkgs-fmt;
|
||||
includes = [ "*.nix" ];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
nix.settings = {
|
||||
experimental-features = [
|
||||
|
73
common/tooling/nvim.nix
Normal file
73
common/tooling/nvim.nix
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.grimmShared) enable tooling;
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
getExe
|
||||
mkIf
|
||||
concatLines
|
||||
;
|
||||
in
|
||||
{
|
||||
config = mkIf (enable && tooling.enable) {
|
||||
environment.systemPackages = with pkgs; [
|
||||
dos2unix
|
||||
neovim-remote
|
||||
];
|
||||
|
||||
programs.git.config.core.editor = getExe pkgs.neovim;
|
||||
|
||||
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ fugitive ];
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
defaultEditor = true;
|
||||
withPython3 = true;
|
||||
configure = {
|
||||
customRC =
|
||||
let
|
||||
luarc = pkgs.writeText "init.lua" (concatLines tooling.nvim.extraLuaRC);
|
||||
in
|
||||
''
|
||||
set number
|
||||
set hidden
|
||||
set fileencodings=utf-8
|
||||
set nocompatible
|
||||
set clipboard+=unnamedplus
|
||||
set ff=unix
|
||||
|
||||
luafile ${luarc}
|
||||
|
||||
if filereadable($HOME . "/.vimrc")
|
||||
source ~/.vimrc
|
||||
endif
|
||||
'';
|
||||
packages.myVimPackage = {
|
||||
start = tooling.nvim.plugins;
|
||||
opt = [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
options.grimmShared.tooling.nvim = {
|
||||
plugins = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
description = "Extra vim plugins to include";
|
||||
};
|
||||
|
||||
extraLuaRC = mkOption {
|
||||
type = types.listOf types.nonEmptyStr;
|
||||
default = [ ];
|
||||
description = "Extra init LUA scripts";
|
||||
};
|
||||
};
|
||||
}
|
@ -25,10 +25,21 @@ in
|
||||
enable = true;
|
||||
config = lib.concatLines (
|
||||
lib.mapAttrsToList (
|
||||
name: value: ''aliases["${name}"] = "${value}"''
|
||||
name: value: "aliases[\"${name}\"] = '''${value}'''"
|
||||
) config.environment.shellAliases
|
||||
);
|
||||
package = pkgs.xonsh.wrapper.override { extraPackages = pyLibs; };
|
||||
};
|
||||
|
||||
grimmShared.tooling.lang_servers = [
|
||||
{
|
||||
lsp.package = pkgs.pyright;
|
||||
fmt = {
|
||||
package = pkgs.yapf;
|
||||
includes = [ "*.py" ];
|
||||
options = [ "-i" ];
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
29
common/tooling/rust.nix
Normal file
29
common/tooling/rust.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.grimmShared) enable tooling graphical;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf (enable && tooling.enable) {
|
||||
environment.systemPackages =
|
||||
with pkgs;
|
||||
[ pkg-config ] ++ lib.optionals graphical [ jetbrains.clion ];
|
||||
|
||||
grimmShared.tooling.lang_servers = [
|
||||
{
|
||||
lsp = {
|
||||
package = pkgs.rust-analyzer;
|
||||
lspconf_mod_name = "rust_analyzer";
|
||||
};
|
||||
fmt = {
|
||||
package = pkgs.rustfmt;
|
||||
includes = [ "*.rs" ];
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
@ -52,7 +52,10 @@ in
|
||||
XDG_CONFIG_HOME = "$HOME/.config";
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ xwaylandvideobridge ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
xwaylandvideobridge
|
||||
confwhich
|
||||
];
|
||||
};
|
||||
|
||||
options.grimmShared.portals = mkEnableOption "Enables portals for wlr, gtk and kde as well as fixes fonts";
|
||||
|
28
custom/confwhich/package.nix
Normal file
28
custom/confwhich/package.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
fetchFromGitea,
|
||||
}:
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "confwhich";
|
||||
version = "unstable-2024-05-14";
|
||||
|
||||
src = fetchFromGitea {
|
||||
domain = "git.grimmauld.de";
|
||||
owner = "Grimmauld";
|
||||
repo = "confwhich";
|
||||
rev = "e561b82d1e2b0d0998ccbef316014297f3468fb6";
|
||||
hash = "sha256-dMkUJMQjlKzmSsgtH0xOZ5Bk654+h84M1cTx8hVM5SQ=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-cn9vtRO+negpIVs0rnp2y5q7L4w554dfBK9MtbWd8FA=";
|
||||
|
||||
meta = {
|
||||
description = "tool to find the path of xdg config files";
|
||||
homepage = "https://git.grimmauld.de/Grimmauld/confwhich";
|
||||
license = lib.licenses.bsd3;
|
||||
mainProgram = "confwhich";
|
||||
maintainers = with lib.maintainers; [ grimmauld ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
28
custom/rfindup/package.nix
Normal file
28
custom/rfindup/package.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
fetchFromGitea,
|
||||
}:
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "rfindup";
|
||||
version = "unstable-2024-05-16";
|
||||
|
||||
src = fetchFromGitea {
|
||||
domain = "git.grimmauld.de";
|
||||
owner = "Grimmauld";
|
||||
repo = "rfindup";
|
||||
rev = "fe2c39e74c667593896ce03033cccdffda6b288d";
|
||||
hash = "sha256-N23sKOfir07WIFbjdHNku7nLTtRd7A5tfs7kvdeCyeU=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-MD7ViPWkL/aYECWj1f+NdVrPVwwFTd8GyyKSUUgXXHE=";
|
||||
|
||||
meta = {
|
||||
description = "tool to find files by name in parent directories";
|
||||
homepage = "https://git.grimmauld.de/Grimmauld/rfindup";
|
||||
license = lib.licenses.bsd3;
|
||||
mainProgram = "rfindup";
|
||||
maintainers = with lib.maintainers; [ grimmauld ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
@ -31,7 +31,7 @@ let
|
||||
{
|
||||
# xonsh update
|
||||
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/305316.patch";
|
||||
hash = "sha256-/OSbAur16Q1XZ/Nhf8VAzaQ3gqbaxWkQlf5G4UWKnh8=";
|
||||
hash = "sha256-W3jh6qRA/7V1fImLm3vRmaT6h6gL5rlNBUuIidZHaZc=";
|
||||
}
|
||||
];
|
||||
|
||||
|
4
overlays/confwhich.nix
Normal file
4
overlays/confwhich.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{ prev, ... }:
|
||||
{
|
||||
confwhich = prev.callPackage ../custom/confwhich/package.nix { };
|
||||
}
|
@ -28,5 +28,7 @@
|
||||
./mcontrolcenter.nix
|
||||
./ccache-wrapper.nix
|
||||
./searchclip.nix
|
||||
./confwhich.nix
|
||||
./rfindup.nix
|
||||
];
|
||||
}
|
||||
|
4
overlays/rfindup.nix
Normal file
4
overlays/rfindup.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{ prev, ... }:
|
||||
{
|
||||
rfindup = prev.callPackage ../custom/rfindup/package.nix { };
|
||||
}
|
Loading…
Reference in New Issue
Block a user