feat(neovim): make debugger adapters work for rust and c++
This commit is contained in:
parent
6f8c09023c
commit
97a16187aa
|
@ -58,6 +58,7 @@ in
|
||||||
# C/C++
|
# C/C++
|
||||||
clang-tools
|
clang-tools
|
||||||
gcc # Needed for treesitter
|
gcc # Needed for treesitter
|
||||||
|
vscode-extensions.ms-vscode.cpptools
|
||||||
|
|
||||||
# C#
|
# C#
|
||||||
csharp-ls
|
csharp-ls
|
||||||
|
@ -114,5 +115,7 @@ in
|
||||||
config = config;
|
config = config;
|
||||||
pkgs = pkgs;
|
pkgs = pkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xdg.configFile."nvim/lua/polish.lua".text = import ./polish.nix pkgs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
-- This will run last in the setup process and is a good place to configure
|
|
||||||
-- things like custom filetypes. This just pure lua so anything that doesn't
|
|
||||||
-- fit in the normal config locations above can go here
|
|
||||||
|
|
||||||
-- Set up custom filetypes
|
|
||||||
vim.filetype.add {
|
|
||||||
extension = {
|
|
||||||
foo = "fooscript",
|
|
||||||
},
|
|
||||||
filename = {
|
|
||||||
["Foofile"] = "fooscript",
|
|
||||||
},
|
|
||||||
pattern = {
|
|
||||||
["~/%.config/foo/.*"] = "fooscript",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local dap = require "dap"
|
|
||||||
|
|
||||||
dap.adapters.codelldb = {
|
|
||||||
port = "${port}",
|
|
||||||
type = "server",
|
|
||||||
executable = {
|
|
||||||
command = "codelldb",
|
|
||||||
args = { "--port", "${port}" },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
dap.configurations.rust = {
|
|
||||||
{
|
|
||||||
name = "Launch file",
|
|
||||||
type = "codelldb",
|
|
||||||
request = "launch",
|
|
||||||
program = function() return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") end,
|
|
||||||
cwd = "${workspaceFolder}",
|
|
||||||
stopOnEntry = false,
|
|
||||||
},
|
|
||||||
}
|
|
80
modules/home-manager/programs/neovim/polish.nix
Normal file
80
modules/home-manager/programs/neovim/polish.nix
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
pkgs:
|
||||||
|
#lua
|
||||||
|
''
|
||||||
|
-- This will run last in the setup process and is a good place to configure
|
||||||
|
-- things like custom filetypes. This just pure lua so anything that doesn't
|
||||||
|
-- fit in the normal config locations above can go here
|
||||||
|
|
||||||
|
-- Set up custom filetypes
|
||||||
|
vim.filetype.add({
|
||||||
|
extension = {
|
||||||
|
foo = "fooscript",
|
||||||
|
},
|
||||||
|
filename = {
|
||||||
|
["Foofile"] = "fooscript",
|
||||||
|
},
|
||||||
|
pattern = {
|
||||||
|
["~/%.config/foo/.*"] = "fooscript",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
local dap = require("dap")
|
||||||
|
|
||||||
|
-- @type DapAdapter
|
||||||
|
dap.adapters.codelldb = {
|
||||||
|
port = "''${port}",
|
||||||
|
type = "server",
|
||||||
|
executable = {
|
||||||
|
command = "codelldb",
|
||||||
|
args = { "--port", "''${port}" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.adapters.cppdbg = {
|
||||||
|
id = "cppdbg",
|
||||||
|
type = "executable",
|
||||||
|
command =
|
||||||
|
"${pkgs.vscode-extensions.ms-vscode.cpptools}/share/vscode/extensions/ms-vscode.cpptools/debugAdapters/bin/OpenDebugAD7",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- @type DapConfiguration
|
||||||
|
dap.configurations.rust = {
|
||||||
|
{
|
||||||
|
name = "Launch file",
|
||||||
|
type = "codelldb",
|
||||||
|
request = "launch",
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||||
|
end,
|
||||||
|
cwd = "''${workspaceFolder}",
|
||||||
|
stopOnEntry = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.configurations.cpp = {
|
||||||
|
{
|
||||||
|
name = "Launch file",
|
||||||
|
type = "cppdbg",
|
||||||
|
request = "launch",
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||||
|
end,
|
||||||
|
cwd = "''${workspaceFolder}",
|
||||||
|
stopAtEntry = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "Attach to gdbserver :1234",
|
||||||
|
type = "cppdbg",
|
||||||
|
request = "launch",
|
||||||
|
MIMode = "gdb",
|
||||||
|
miDebuggerServerAddress = "localhost:1234",
|
||||||
|
miDebuggerPath = "/usr/bin/gdb",
|
||||||
|
cwd = "''${workspaceFolder}",
|
||||||
|
program = function()
|
||||||
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.configurations.c = dap.configurations.cpp
|
||||||
|
''
|
|
@ -5,12 +5,21 @@
|
||||||
boot.kernelPackages = pkgs.linuxPackages_zen;
|
boot.kernelPackages = pkgs.linuxPackages_zen;
|
||||||
|
|
||||||
# Add AMD drivers.
|
# Add AMD drivers.
|
||||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
boot.initrd.kernelModules = [
|
||||||
|
"amdgpu"
|
||||||
|
"v4l2loopback"
|
||||||
|
"zenergy"
|
||||||
|
];
|
||||||
|
|
||||||
boot.extraModulePackages = [
|
boot.extraModulePackages = [
|
||||||
config.boot.kernelPackages.v4l2loopback
|
config.boot.kernelPackages.v4l2loopback
|
||||||
|
config.boot.kernelPackages.zenergy
|
||||||
];
|
];
|
||||||
|
|
||||||
|
boot.extraModprobeConfig = ''
|
||||||
|
options v4l2loopback devices=1 video_nr=1 card_label="Virtual camera" exclusive_caps=1
|
||||||
|
'';
|
||||||
|
|
||||||
# Bootloader.
|
# Bootloader.
|
||||||
boot.loader = {
|
boot.loader = {
|
||||||
systemd-boot = {
|
systemd-boot = {
|
||||||
|
@ -46,6 +55,7 @@
|
||||||
settings = {
|
settings = {
|
||||||
PasswordAuthentication = false;
|
PasswordAuthentication = false;
|
||||||
PermitRootLogin = "no";
|
PermitRootLogin = "no";
|
||||||
|
StreamLocalBindUnlink = "yes";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
config = {
|
config = {
|
||||||
whitelist = {
|
whitelist = {
|
||||||
prefix = [
|
prefix = [
|
||||||
|
"/mnt/internal/hydractify/GitHub"
|
||||||
"/mnt/internal/personal/projects"
|
"/mnt/internal/personal/projects"
|
||||||
"/mnt/internal/repos"
|
"/mnt/internal/repos"
|
||||||
"/mnt/internal/shared/projects"
|
"/mnt/internal/shared/projects"
|
||||||
|
|
Loading…
Reference in a new issue