feat: neovim lsp
This commit is contained in:
parent
45563277d5
commit
c8ef495a63
22 changed files with 177 additions and 86 deletions
37
flake.lock
generated
37
flake.lock
generated
|
|
@ -685,6 +685,22 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1736523798,
|
||||
"narHash": "sha256-Xb8mke6UCYjge9kPR9o4P1nVrhk7QBbKv3xQ9cj7h2s=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "130595eba61081acde9001f43de3248d8888ac4a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1729265718,
|
||||
"narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=",
|
||||
|
|
@ -863,6 +879,24 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pipewire-screenaudio": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1720719825,
|
||||
"narHash": "sha256-+StN4RWwuVHmGFHeDr815t8lTWmRNC16uGTx8jEffPw=",
|
||||
"owner": "IceDBorn",
|
||||
"repo": "pipewire-screenaudio",
|
||||
"rev": "bd404d0ee4b32fb797f2dcdeee3b6e773c06455c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "IceDBorn",
|
||||
"repo": "pipewire-screenaudio",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-aerial-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
@ -2840,6 +2874,7 @@
|
|||
"nix-index-database": "nix-index-database",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nvf": "nvf",
|
||||
"pipewire-screenaudio": "pipewire-screenaudio",
|
||||
"yazi": "yazi"
|
||||
}
|
||||
},
|
||||
|
|
@ -3035,7 +3070,7 @@
|
|||
"yazi": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_3",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"rust-overlay": "rust-overlay_2"
|
||||
},
|
||||
"locked": {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,11 @@
|
|||
description = "DACHXY NixOS with hyprland";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs = {
|
||||
url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
pipewire-screenaudio.url = "github:IceDBorn/pipewire-screenaudio";
|
||||
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
|
@ -67,7 +71,7 @@
|
|||
nixosConfigurations = {
|
||||
dn-pre7780 = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
nvf.nixosModules.default
|
||||
nvf.nixosModules.default
|
||||
nix-index-database.nixosModules.nix-index
|
||||
./system/dev/dn-pre7780
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
local util = require("lspconfig.util")
|
||||
local async = require("lspconfig.async")
|
||||
local mod_cache = nil
|
||||
|
||||
require("lspconfig").lua_ls.setup({
|
||||
on_init = function(client)
|
||||
|
|
@ -90,6 +92,42 @@ return {
|
|||
cmd = { "typescript-language-server", "--stdio" },
|
||||
filetypes = { "vue", "ts", "tsx" },
|
||||
},
|
||||
clangd = {
|
||||
cmd = { "clangd" },
|
||||
root_markers = { ".git", ".clangd", "compile_commands.json" },
|
||||
filetypes = { "cpp", "c" },
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
semanticTokens = {
|
||||
multilineTokenSupport = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
gopls = {
|
||||
cmd = { "gopls" },
|
||||
filetypes = { "go", "gomod", "gowork", "gotmpl" },
|
||||
root_dir = function(fname)
|
||||
-- see: https://github.com/neovim/nvim-lspconfig/issues/804
|
||||
if not mod_cache then
|
||||
local result = async.run_command({ "go", "env", "GOMODCACHE" })
|
||||
|
||||
if result and result[1] then
|
||||
mod_cache = vim.trim(result[1])
|
||||
else
|
||||
mod_cache = vim.fn.system("go env GOMODCACHE")
|
||||
end
|
||||
end
|
||||
if mod_cache and fname:sub(1, #mod_cache) == mod_cache then
|
||||
local clients = util.get_lsp_clients({ name = "gopls" })
|
||||
if #clients > 0 then
|
||||
return clients[#clients].config.root_dir
|
||||
end
|
||||
end
|
||||
return util.root_pattern("go.work", "go.mod", ".git")(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {},
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
nix-version,
|
||||
username,
|
||||
...
|
||||
}: {
|
||||
imports = [./user];
|
||||
}:
|
||||
{
|
||||
imports = [ ./user ];
|
||||
home = {
|
||||
inherit username;
|
||||
homeDirectory = "/home/${username}";
|
||||
|
|
|
|||
36
home/user/bin.nix
Normal file
36
home/user/bin.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
findDirs = [
|
||||
"~/practice"
|
||||
"~/projects"
|
||||
];
|
||||
tmuxSessionizer = pkgs.writeShellScriptBin "tmux-sessionizer" ''
|
||||
if [[ $# -eq 1 ]]; then
|
||||
selected=$1
|
||||
else
|
||||
selected=$(find ${lib.concatStringsSep " " findDirs} mindepth 1 -maxdepth 1 -type d | fzf)
|
||||
fi
|
||||
|
||||
if [[ -z $selected ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
selected_name=$(basename "$selected" | tr . _)
|
||||
tmux_running=$(pgrep tmux)
|
||||
|
||||
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
|
||||
tmux new-session -s $selected_name -c $selected
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! tmux has-session -t=$selected_name 2> /dev/null; then
|
||||
tmux new-session -ds $selected_name -c $selected
|
||||
fi
|
||||
|
||||
tmux switch-client -t $selected_name
|
||||
'';
|
||||
in
|
||||
{
|
||||
home.packages = [ tmuxSessionizer ];
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
let
|
||||
configDir = ../config;
|
||||
in {
|
||||
in
|
||||
{
|
||||
home.file = {
|
||||
".config/wallpapers".source = "${configDir}/wallpapers";
|
||||
".config/kitty".source = "${configDir}/kitty";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{inputs, ...}: {
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./git.nix
|
||||
./gtk.nix
|
||||
|
|
@ -10,8 +11,8 @@
|
|||
./virtualization.nix
|
||||
./hyprland.nix
|
||||
./swaync.nix
|
||||
./desktop.nix
|
||||
./neovim.nix
|
||||
./bin.nix
|
||||
inputs.hyprland.homeManagerModules.default
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
{
|
||||
nvidia-offload-enabled,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
offloadScript = import ../../system/modules/offload.nix { inherit pkgs; };
|
||||
launcher = "${offloadScript}/bin/offload firefox";
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
xdg.desktopEntries = lib.mkIf nvidia-offload-enabled {
|
||||
firefox = {
|
||||
actions = {
|
||||
"new-private-window" = {
|
||||
exec = "${launcher} --private-window %U";
|
||||
name = "New Private Window";
|
||||
};
|
||||
"new-window" = {
|
||||
exec = "${launcher} --new-window %U";
|
||||
name = "New Window";
|
||||
};
|
||||
"profile-manager-window" = {
|
||||
exec = "${launcher} --ProfileManager";
|
||||
name = "Profile Manager";
|
||||
};
|
||||
};
|
||||
exec = "${launcher} --name firefox %U";
|
||||
categories = [
|
||||
"Network"
|
||||
"WebBrowser"
|
||||
];
|
||||
genericName = "Web Browser";
|
||||
name = "Firefox";
|
||||
startupNotify = true;
|
||||
terminal = false;
|
||||
type = "Application";
|
||||
icon = "firefox";
|
||||
mimeType = [
|
||||
"text/html"
|
||||
"text/xml"
|
||||
"application/xhtml+xml"
|
||||
"application/vnd.mozilla.xul+xml"
|
||||
"x-scheme-handler/http"
|
||||
"x-scheme-handler/https"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -11,7 +11,6 @@
|
|||
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
||||
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
|
||||
GTK_CSD = "0";
|
||||
WLR_DRM_DEVICES = "/dev/dri/card1";
|
||||
WLR_NO_HARDWARE_CURSORS = "1";
|
||||
CLUTTER_BACKEND = "wayland";
|
||||
EGL_PLATFORM = "wayland";
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ let
|
|||
terminal = "${prefix}ghostty";
|
||||
filemanager = "nemo";
|
||||
scripts = "~/.config/scripts";
|
||||
flatEmoji = "it.mijorus.smile";
|
||||
|
||||
# freezeShot = "--freeze";
|
||||
freezeShot = "";
|
||||
|
||||
resizeStep = builtins.toString 20;
|
||||
brightnessStep = builtins.toString 10;
|
||||
|
|
@ -25,17 +29,17 @@ in
|
|||
''${mainMod}, P, pseudo, # dwindle''
|
||||
''${mainMod}, S, togglesplit, # dwindle''
|
||||
''CTRL ${mainMod} SHIFT, L, exec, hyprlock''
|
||||
''${mainMod} SHIFT, s, exec, hyprshot -m region --clipboard-only --freeze''
|
||||
''CTRL SHIFT, s, exec, hyprshot -m window --clipboard-only --freeze''
|
||||
''CTRL SHIFT ${mainMod}, s, exec, hyprshot -m output --clipboard-only --freeze''
|
||||
''${mainMod}, PERIOD, exec, flatpak run it.mijorus.smile ''
|
||||
''${mainMod} SHIFT, s, exec, hyprshot -m region --clipboard-only ${freezeShot}''
|
||||
''CTRL SHIFT, s, exec, hyprshot -m window --clipboard-only ${freezeShot}''
|
||||
''CTRL SHIFT ${mainMod}, s, exec, hyprshot -m output --clipboard-only ${freezeShot}''
|
||||
''${mainMod}, PERIOD, exec, flatpak run ${flatEmoji}''
|
||||
''${mainMod}, X, exec, sleep 0.1 && swaync-client -t -sw''
|
||||
''${mainMod} SHIFT, C, centerwindow''
|
||||
'',F11, fullscreen''
|
||||
''${mainMod}, C, exec, code''
|
||||
|
||||
# Color Picker
|
||||
''${mainMod} SHIFT, P, exec, hyprpicker -f hex -a -z -r''
|
||||
''${mainMod} SHIFT, P, exec, hyprpicker -f hex -a -z''
|
||||
|
||||
# Cycle windows
|
||||
''ALT, TAB, cyclenext''
|
||||
|
|
@ -73,6 +77,7 @@ in
|
|||
# ==== Plugins ==== #
|
||||
# Overview
|
||||
''${mainMod}, o, hyprexpo:expo, toggle''
|
||||
''${mainMod}, TAB, hyprexpo:expo, toggle''
|
||||
]
|
||||
++ (
|
||||
# workspaces
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ in
|
|||
|
||||
firefox = {
|
||||
enable = true;
|
||||
|
||||
package = (pkgs.wrapFirefox (pkgs.firefox-unwrapped.override { pipewireSupport = true; }) { });
|
||||
languagePacks = [
|
||||
"en-US"
|
||||
"zh-TW"
|
||||
|
|
@ -50,6 +50,8 @@ in
|
|||
"font.name.monospace.ja" = "Noto Sans Mono CJK JP";
|
||||
"font.name.monospace.x-western" = "CaskaydiaCove Nerd Font Mono";
|
||||
"font.name.monospace.zh-TW" = "Noto Sans Mono CJK TC";
|
||||
# Disable Ctrl+Q
|
||||
"browser.quitShortcut.disabled" = true;
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
username,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
hyprcursor-size = "32";
|
||||
xcursor-size = "24";
|
||||
nvidia-mode = "offload";
|
||||
|
|
@ -15,7 +16,8 @@
|
|||
intel-bus-id = "PCI:0:2:0";
|
||||
nvidia-bus-id = "PCI:1:0:0";
|
||||
nvidia-offload-enabled = config.hardware.nvidia.prime.offload.enable;
|
||||
in {
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.default
|
||||
./hardware-configuration.nix
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{...}: {
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./plymouth.nix # Boot splash
|
||||
./fonts.nix
|
||||
|
|
|
|||
|
|
@ -10,10 +10,6 @@ let
|
|||
pkgs-unstable = inputs.hyprland.inputs.nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
nixpkgs.config.packageOverrides = pkgs: {
|
||||
intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; };
|
||||
};
|
||||
|
||||
hardware = {
|
||||
bluetooth = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
withUWSM = true;
|
||||
|
|
@ -12,11 +13,9 @@
|
|||
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
wlr.enable = true;
|
||||
xdgOpenUsePortal = true;
|
||||
extraPortals = [
|
||||
pkgs.xdg-desktop-portal-gtk
|
||||
pkgs.xdg-desktop-portal-wlr
|
||||
];
|
||||
};
|
||||
|
||||
|
|
@ -52,7 +51,7 @@
|
|||
"flakes"
|
||||
];
|
||||
auto-optimise-store = true;
|
||||
substituters = ["https://hyprland.cachix.org"];
|
||||
substituters = [ "https://hyprland.cachix.org" ];
|
||||
|
||||
trusted-public-keys = [
|
||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||
|
|
|
|||
|
|
@ -14,5 +14,6 @@
|
|||
nginx-language-server
|
||||
nodePackages_latest.vscode-json-languageserver
|
||||
bash-language-server
|
||||
gopls
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
nvidia-mode ? "sync",
|
||||
nvidia-mode ? "offload",
|
||||
nvidia-bus-id,
|
||||
intel-bus-id,
|
||||
...
|
||||
|
|
@ -10,7 +10,6 @@ let
|
|||
"sync"
|
||||
"rsync"
|
||||
];
|
||||
|
||||
in
|
||||
{
|
||||
config,
|
||||
|
|
@ -54,7 +53,7 @@ lib.checkListOfEnum "Nvidia Prime Mode" validModes [ nvidia-mode ] {
|
|||
|
||||
nvidia.nvidiaSettings = true;
|
||||
nvidia.dynamicBoost.enable = true;
|
||||
nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||
nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
|
||||
nvidia.prime =
|
||||
(
|
||||
|
|
@ -95,7 +94,7 @@ lib.checkListOfEnum "Nvidia Prime Mode" validModes [ nvidia-mode ] {
|
|||
environment.variables = {
|
||||
# GPU
|
||||
LIBVA_DRIVER_NAME = "nvidia";
|
||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||
# __GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||
NVD_BACKEND = "direct";
|
||||
MOZ_DISABLE_RDD_SANDBOX = 1;
|
||||
OGL_DEDICATED_HW_STATE_PER_CONTEXT = "ENABLE_ROBUST";
|
||||
|
|
|
|||
|
|
@ -16,13 +16,11 @@
|
|||
gtk3
|
||||
adwaita-icon-theme
|
||||
|
||||
# Browser
|
||||
firefox
|
||||
|
||||
# File Manager
|
||||
nemo
|
||||
|
||||
# Utils
|
||||
upower
|
||||
jq
|
||||
bat
|
||||
btop
|
||||
|
|
|
|||
|
|
@ -25,5 +25,4 @@
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,5 +15,8 @@
|
|||
|
||||
services.playerctld.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [ pavucontrol playerctl ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
pavucontrol
|
||||
playerctl
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ in
|
|||
environment.variables = {
|
||||
TMUXINATOR_CONFIG = "/etc/tmuxinator";
|
||||
};
|
||||
|
||||
environment.etc = {
|
||||
"tmuxinator/tmux.yaml" = {
|
||||
source = ../../home/config/tmux.yaml;
|
||||
|
|
@ -92,6 +91,9 @@ in
|
|||
|
||||
unbind -T copy-mode-vi MouseDragEnd1Pane
|
||||
|
||||
unbind f
|
||||
bind-key -r f run-shell "tmux neww tmux-sessionizer"
|
||||
|
||||
set -g @resurrect-capture-pane-contents 'on'
|
||||
set -g @continuum-restore 'on'
|
||||
set -g @catppuccin-flavour 'macchiato'
|
||||
|
|
|
|||
19
utils/gpu-offload.nix
Normal file
19
utils/gpu-offload.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
let
|
||||
patchDesktop =
|
||||
pkg: appName: from: to:
|
||||
lib.hiPrio (
|
||||
pkgs.runCommand "$patched-desktop-entry-for-${appName}" { } ''
|
||||
${coreutils}/bin/mkdir -p $out/share/applications
|
||||
${gnused}/bin/sed 's#${from}#${to}#g' < ${pkg}/share/applications/${appName}.desktop > $out/share/applications/${appName}.desktop
|
||||
''
|
||||
);
|
||||
GPUOffloadApp = pkg: desktopName: patchDesktop pkg desktopName "^Exec=" "Exec=nvidia-offload ";
|
||||
in
|
||||
GPUOffloadApp
|
||||
Loading…
Add table
Add a link
Reference in a new issue