feat: import horsch config

This commit is contained in:
Michael Mandl 2024-07-10 08:10:56 +02:00
parent 0cf5c3433e
commit 428b91c3d5
Signed by: mandlm
GPG key ID: 088ED38F036C7AF2
45 changed files with 1510 additions and 0 deletions

View file

@ -29,6 +29,18 @@
theme = "dark";
};
};
"mmandl@NB11313" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./horsch/home.nix
];
extraSpecialArgs = {
username = "mmandl";
theme = "dark";
};
};
};
};
}

13
horsch/bat.nix Normal file
View file

@ -0,0 +1,13 @@
{ ... }:
let
theme_name = "Solarized (dark)";
in
{
programs = {
bat = {
enable = true;
config.theme = theme_name;
};
};
}

8
horsch/carapace.nix Normal file
View file

@ -0,0 +1,8 @@
{ ... }:
{
programs.carapace = {
enable = true;
enableZshIntegration = true;
};
}

11
horsch/direnv.nix Normal file
View file

@ -0,0 +1,11 @@
{ ... }:
{
programs = {
direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
};
}

View file

@ -0,0 +1,91 @@
# Setup Log WSL/Alpine
## User setup
```bash
su -
apk add sudo
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
adduser mmandl sudo
passwd mmandl
logout
```
## Home-manager setup
```bash
# Install nix package manager
sudo apk add curl xz openssh-client
curl -L https://nixos.org/nix/install | sh
echo ". /home/mmandl/.nix-profile/etc/profile.d/nix.sh" >> ~/.profile
# Add home-manager channel and install
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
```
## Home-manager config
```bash
# Extract initial home-manager config
unzip /mnt/c/Users/mmandl/Downloads/home-manager-main.zip
mv home-manager-main home-manager
rm -rf .config/home-manager
ln -s ../home-manager .config/home-manager
# Enable nix flakes support
mkdir -p .config/nix
echo "experimental-features = nix-command flakes" > .config/nix/nix.conf
# Install and configure user environment
home-manager switch
# Install zsh
sudo apk add zsh
chsh -s /bin/zsh
# Install gpg and ssh private keys
gpg --import /mnt/c/Users/mmandl/OneDrive\ -\ Horsch\ Maschinen\ GmbH/Dokumente/GPG/Michael\ Mandl\ michael.mandl@horsch.com\ \(0x088ED38F036C7AF2\)\ pub-sec.asc
# Switch to final home-manager config
rm -rf home-manager
git clone git@github.com:mmandl-horsch/home-manager.git
```
## Docker
```bash
# Enable openrc on boot
echo "[boot]\ncommand = /sbin/openrc default" > /etc/wsl.conf
# Install docker
sudo apk add docker
sudo rc-update add docker default
sudo adduser mmandl docker
# Install buildserver CA
firefox https://confluence.horsch.com/display/DFEDOCU1/SE+Tools+-+Buildserver+-+SSL?preview=/114590403/114590426/20201123_horsch_buildserver_ca_install.sh
sudo sh 20201123_horsch_buildserver_ca_install.sh
```
## VSCode
```bash
# Install vscode server runtime dependency
sudo apk add libstdc++
```
## Yocto
```bash
# Install non-busybox `readlink`
sudo apk add coreutils
```
## Kernel Module Autoloading
```bash
sudo apk add alpine-config
sudo setup-devd udev
```

8
horsch/eza.nix Normal file
View file

@ -0,0 +1,8 @@
{ ... }:
{
programs.eza = {
enable = true;
git = true;
extraOptions = [ "--group-directories-first" ];
};
}

10
horsch/fzf.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, user, ... }:
{
programs = {
fzf = {
enable = true;
enableZshIntegration = true;
};
};
}

126
horsch/git.nix Normal file
View file

@ -0,0 +1,126 @@
{ pkgs, ... }:
{
programs = {
less.enable = true;
git = {
enable = true;
userName = "Michael Mandl";
userEmail = "michael.mandl@horsch.com";
signing = {
key = "088ED38F036C7AF2";
signByDefault = true;
};
difftastic = {
enable = true;
background = "light";
};
lfs = {
enable = true;
};
extraConfig = {
core.editor = "nvim";
core.pager = "less -FX";
credential.helper = "cache --timeout=3600";
diff.ignoreSubmodules = "none";
fetch.writeCommitGraph = true;
fetch.recurseSubmodules = true;
format.pretty = "format:%C(yellow)%h %Cblue%>(12)%ad %C(red)%G? %Cgreen%<(7,trunc)%aN%Cred%d %Creset%s";
init.defaultBranch = "main";
log.date = "relative";
merge.ff = false;
merge.tool = "nvim";
mergetool.nvim.cmd = "nvim -f -c \"Gdiffsplit!\" \"$MERGED\"";
mergetool.prompt = false;
pager.difftool = true;
pull.rebase = true;
push.recurseSubmodules = "on-demand";
rebase.autostash = true;
rerere.enabled = true;
status.submoduleSummary = true;
submodule.recurse = true;
worktree.guessRemote = true;
};
aliases = {
graph = "log --graph --all --max-count 32";
};
ignores = [
".env"
".direnv"
"*.swp"
];
};
};
home.packages = with pkgs; [
(writeShellScriptBin "git-clone-worktree" ''
uri=''${1}
dir=''${2}
if [[ -z ''${dir} ]]; then
dir=''$(basename ''${1} .git)
fi
if [[ -e ''${dir} ]]; then
echo "error: directory ''${dir} already exists"
exit 1
fi
mkdir ''${dir}
git clone ''${uri} ''${dir}/.base
branch=`git -C ''${dir}/.base symbolic-ref --short HEAD`
echo "default branch is ''${branch}"
git -C ''${dir}/.base checkout --detach HEAD
git -C ''${dir}/.base worktree add ../''${branch}
'')
(writeShellScriptBin "git-make-relative" ''
gitfile=''${1}
if [[ -z ''${gitfile} ]]; then
gitfile=".git"
fi
if [[ ! -f ''${gitfile} ]]; then
echo "file ''${gitfile} does not exist"
exit 1
fi
gitdir=$(grep "gitdir:" ''${gitfile} | cut -d: -f2 | xargs)
rel_gitdir=$(realpath -s --relative-to=. ''${gitdir})
echo "relative path: ''${rel_gitdir}"
sed -i -e "s,gitdir:.*,gitdir: ''${rel_gitdir}," ''${gitfile}
'')
];
}

43
horsch/gpg/default.nix Normal file
View file

@ -0,0 +1,43 @@
{ pkgs, ... }:
{
services.gpg-agent = {
enable = true;
enableZshIntegration = true;
pinentryPackage = pkgs.pinentry-curses;
enableSshSupport = true;
sshKeys = [
"AEB2BF3FF9CF9529E9A3C6F1A202D21686FF9278"
];
defaultCacheTtl = 3600 * 12;
defaultCacheTtlSsh = 3600 * 12;
maxCacheTtl = 3600 * 12;
maxCacheTtlSsh = 3600 * 12;
extraConfig = ''
allow-loopback-pinentry
'';
};
programs.gpg = {
enable = true;
mutableKeys = false;
mutableTrust = false;
settings = {
pinentry-mode = "loopback";
};
publicKeys = [
{
source = ./molez.pub.asc;
trust = "ultimate";
}
{
source = ./vi-bim.pub.asc;
trust = "ultimate";
}
{
source = ./horsch.pub.asc;
trust = "ultimate";
}
];
};
}

51
horsch/gpg/horsch.pub.asc Normal file
View file

@ -0,0 +1,51 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBGY9z3YBDACrIG26NDCvf+HV4V6LiePgvRoC4lEqaUvrf9USsTvbLA7WQdTm
KagTM4rI3H7R1VzJmbQSpFRdue1JaO4wAqTlbYTJNOxJrYdH/dBvMXq+flMGlbsq
jzsWmNW08XzGxC1OiYlnX+xId9EqWdvDH9apCL5MaWh3+c8k3+CSZdhQzcbIT+Lw
Tl2epyV5KytQmpK6Ov0XCt0doNqzwGelsQZudJ2APKTYYVob7BgYjZ4kv92eaCcp
0VoRRQV3kZrXwMRZ5vieIZQVIYlh3lXA8WKS18XBjsZqgSzF/PEHoH64f+KP8D0v
nh9H9zV+aKjc+lyptCB1mJNUfEprWVpvNImLlL+JC6x1yoMUY10UN+spKkuSynis
IFug55tTsxDP5XmrkrpOucXi766HcEGo/e3lI8MVCserlDgGnFHckwYeILHIjziw
xIYDw2O0VXpJLvVpZFLd2mxHKlIXJri2nl89KqvzAYD7LG5qfE21INrJjAz4m0/I
3+B+tKs3v/ipaecAEQEAAbQoTWljaGFlbCBNYW5kbCA8bWljaGFlbC5tYW5kbEBo
b3JzY2guY29tPokBzAQTAQoANhYhBEjdu0CnvlkHUcIjYgiO048DbHryBQJmPc92
AhsDBAsJCAcEFQoJCAUWAgMBAAIeAQIXgAAKCRAIjtOPA2x68lw+C/0QvfX+tjCu
MOLdwL/2xkKrTQMSj0vXeOVjoPjPAltDFzgYv+Ax6CP4NjmaQpQqg1t4oKmIaVNm
IQdTpq6z8c4tBiHbFvY4JlDm9fMa/wn2iM2u+D4tIro8ulA1PKyJGYrFmo4RdUW3
8u5vyU+V9yWvRfmjS4efloUur8nfz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4F15nP
Qdw8WUktCZzP1WJ7gEt9roWIru2WxOILDvJey0/8PWowzK9seHflHSOu052ivFXx
dm37/uURZ89gnKZDtlyvv7h9S/2daU2icmoB+cq/B7io8gIEPLQghNbENdwRrxMB
YRi5ABEBAAGJAjwEGAEIACYWIQSn/A/3b5p5qlndLylOYPRCJ/YRtAUCXvmEoQIb
DAUJCWYBgAAKCRBOYPRCJ/YRtK4EEACCxf0uAcqUGbyvNOi/za9C1KcmAUq1UG3U
SyNGsQ8QCeME8iSQgdsG4JkPJ5zybeNn816tG3DkxZyImeSer1zKLnWe+P2ZETIa
ZbgfOvZz9oRXASW2yrD3/uq2hLzDUcHEZOyp3qdMArh8PO7e8aO0CmbNaAaSQ6nS
fEraHEqLcPHezXdhWe6VN6jxojqm4PLYf1A4GIanjNoyzhRyeRTebSW3DVj3BtrA
0D7XdrvEQKF05qBwWGv9OwqzoZhX1MRNMqDicS2YFSTYM35jF/kOpeCI50X6UJh+
TyDZ3CZljfxQf/zEQ0bU4x3SPVAMslzh3Z2qrk+0n8EFxPEhyiJ7HV3AwCjakczT
hv/dhTrG24YEcdpMq4Q3SUbIeM4FdjrDcAZGOsFlDDOt9j6SAWriTcgBTZtV5XvN
QgsTuNwDw1Z36cQtp5JKB8MuryZRd0uA8EU2wjyzKJzDMmON6UWZ0Srpr9GCSiiv
IFeIU2KdW3OH1QyIMn1JrpxRQPiw8AtPWG1kovVye1b3mA90/pfqsQa6u17zl03d
xOhd9UPlPnFPeWBQkVC98lZflOIaR3TgdCuIDkTZVCoRTX889YslErQ17re/Zbqd
ZJJ3wuBZt6CUBRCzG56K5G58adh2Z0oz9vsmPa4lfb6wpje/mIoWQoi/I7/4VAso
3ygTeUGteA==
=Ok46
-----END PGP PUBLIC KEY BLOCK-----

40
horsch/home.nix Normal file
View file

@ -0,0 +1,40 @@
{ pkgs, ... }:
{
home.username = "mmandl";
home.homeDirectory = "/home/mmandl";
home.stateVersion = "24.05"; # Please read the comment before changing.
home.sessionVariables = {
EDITOR = "nvim";
};
programs.home-manager.enable = true;
home.packages = with pkgs; [
wsl-open
xdg-utils
];
imports = [
./bat.nix
./carapace.nix
./direnv.nix
./eza.nix
./fzf.nix
./git.nix
./gpg
./neovim
./picocom.nix
./podman.nix
./ripgrep.nix
./rsync.nix
./shell_aliases.nix
./ssh.nix
./starship.nix
./tree.nix
./zoxide.nix
./zsh.nix
];
}

View file

@ -0,0 +1,3 @@
require("auto-session").setup {
log_level = "error",
}

View file

@ -0,0 +1 @@
vim.api.nvim_create_user_command("BufOnly", "%bd|e#|bd#", {})

View file

@ -0,0 +1 @@
require('Comment').setup({})

35
horsch/neovim/dap.lua Normal file
View file

@ -0,0 +1,35 @@
local dap = require("dap")
local dapui = require("dapui")
dapui.setup()
vim.fn.sign_define("DapBreakpoint", { text = "🔴", texthl = "", linehl = "", numhl = "" })
-- debugging keymaps
vim.keymap.set("n", "<F5>", dap.continue, { noremap = true, silent = true })
vim.keymap.set("n", "<F9>", dap.toggle_breakpoint, { noremap = true, silent = true })
vim.keymap.set("n", "<F10>", dap.step_over, { noremap = true, silent = true })
vim.keymap.set("n", "<F11>", dap.step_into, { noremap = true, silent = true })
vim.keymap.set("n", "<S-F11>", dap.step_out, { noremap = true, silent = true })
vim.keymap.set("n", "<F23>", dap.step_out, { noremap = true, silent = true }) -- <Shift-F11> in kitty
vim.keymap.set("n", "<M-k>", dapui.eval, { noremap = true, silent = true })
-- trigger auto-completion in repl
vim.cmd([[
augroup TriggerDapReplAutoCompletion
autocmd!
autocmd FileType dap-repl lua require("dap.ext.autocompl").attach()
augroup END
]])
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end

177
horsch/neovim/default.nix Normal file
View file

@ -0,0 +1,177 @@
{ pkgs, ... }:
let
pkg_src = pkgs;
in
{
# symlink for a stable path
home.file.".vscode-extensions/vscode-lldb".source = pkg_src.vscode-extensions.vadimcn.vscode-lldb;
programs = {
neovim = {
enable = true;
package = pkg_src.neovim-unwrapped;
defaultEditor = true;
plugins = with pkg_src.vimPlugins; [
# theme
nvim-solarized-lua
delimitMate
vim-bbye
ansible-vim
# ui
dressing-nvim
# session handling
project-nvim
auto-session
# escape handling
better-escape-nvim
nvim-treesitter.withAllGrammars
nvim-treesitter-textobjects
markdown-preview-nvim # use({ "iamcco/markdown-preview.nvim", run = ":call mkdp#util#install()" })
toggleterm-nvim
nvim-notify
comment-nvim
lualine-nvim
tabline-nvim
indent-blankline-nvim
plenary-nvim
vim-illuminate
registers-nvim
vim-surround
editorconfig-nvim
# git
gitsigns-nvim
vim-fugitive
vim-flog
git-blame-nvim
nvim-web-devicons # used by diffview-nvim
# snippets
friendly-snippets
luasnip
# auto-completion
nvim-cmp
cmp-nvim-lsp
cmp-buffer
cmp-path
cmp-cmdline
cmp-nvim-lua
cmp_luasnip
cmp-calc
cmp-nvim-lsp-signature-help
# telescope
telescope-nvim
telescope-fzf-native-nvim
telescope-ui-select-nvim
# LSP
nvim-lspconfig
lsp-status-nvim
rustaceanvim
neodev-nvim
null-ls-nvim
lsp_lines-nvim
lsp-inlayhints-nvim
# debugging
nvim-dap
nvim-dap-ui
# neorg
neorg
neorg-telescope
];
withNodeJs = true;
extraPackages = with pkg_src; [
# language servers
lua-language-server
terraform-ls
tflint
bash-language-server
nodePackages.yaml-language-server
nodePackages.prettier
nodePackages.eslint_d
nodePackages.typescript-language-server
nodePackages.typescript
nodePackages.dockerfile-language-server-nodejs
nodePackages.vscode-langservers-extracted
vscode-extensions.vue.volar
lldb
vscode-extensions.vadimcn.vscode-lldb
marksman
clang-tools
cmake-language-server
texlab
nixd
nixpkgs-fmt
bitbake-language-server
(python3.withPackages (ps: with ps; [
pep8
autopep8
python-lsp-server
]))
pyright
#clipboard
xclip
];
extraLuaPackages = luaPackages: [
luaPackages.lua-utils-nvim
luaPackages.pathlib-nvim
];
extraConfig = ''
lua << EOF
vim.o.guifont = "DejaVu Sans Mono:h10"
if vim.g.neovide then
vim.g.neovide_fullscreen = true
vim.g.neovide_cursor_animation_length = 0.01
vim.g.neovide_cursor_trail_length = 0.01
end
${builtins.readFile ./keymaps.lua }
${builtins.readFile ./options.lua }
${builtins.readFile ./commands.lua }
${builtins.readFile ./treesitter.lua }
${builtins.readFile ./lspconfig.lua }
${builtins.readFile ./auto-session.lua }
${builtins.readFile ./toggleterm.lua }
${builtins.readFile ./notify.lua }
${builtins.readFile ./comment.lua }
${builtins.readFile ./lualine.lua }
${builtins.readFile ./tabline.lua }
${builtins.readFile ./indent-blankline.lua }
${builtins.readFile ./gitsigns.lua }
${builtins.readFile ./luasnip.lua }
${builtins.readFile ./nvim-cmp.lua }
${builtins.readFile ./telescope.lua }
${builtins.readFile ./themes.lua }
vim.opt.background = 'dark'
${builtins.readFile ./project-nvim.lua }
${builtins.readFile ./dap.lua }
${builtins.readFile ./neorg.lua }
${builtins.readFile ./illuminate.lua }
vim.g.gitblame_date_format = "%r"
EOF
'';
};
};
}

View file

@ -0,0 +1 @@
require('gitsigns').setup()

View file

@ -0,0 +1,8 @@
local illuminate = require("illuminate")
illuminate.configure({
providers = {
"lsp", "treesitter", "regex",
},
under_cursor = true,
})

View file

@ -0,0 +1,5 @@
require("ibl").setup {
indent = {
char = "",
},
}

69
horsch/neovim/keymaps.lua Normal file
View file

@ -0,0 +1,69 @@
local function nnoremap(key, command)
vim.api.nvim_set_keymap("n", key, command, { noremap = true })
end
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Move around windows
nnoremap("<C-h>", ":wincmd h<CR>")
nnoremap("<C-j>", ":wincmd j<CR>")
nnoremap("<C-k>", ":wincmd k<CR>")
nnoremap("<C-l>", ":wincmd l<CR>")
-- Switch buffers
nnoremap("<C-PageDown>", ":TablineBufferNext<CR>")
nnoremap("<C-PageUp>", ":TablineBufferPrevious<CR>")
-- fugitive
nnoremap("<leader>g", ":0Git<CR>")
-- vim-flog
nnoremap("<leader>G", ":Flog -all -date=relative -open-cmd=new<CR>")
-- telescope
local telescope = require("telescope.builtin")
local telescope_themes = require("telescope.themes")
local telescope_projects = require("telescope").extensions.projects
local function map_telescope(key, telescope_function)
vim.api.nvim_set_keymap("n", key, "", {
noremap = true,
callback = function()
local theme = telescope_themes.get_dropdown({ layout_config = { width = 0.9 } })
telescope_function(theme)
end,
})
end
map_telescope("<leader>ff", telescope.find_files)
map_telescope("<leader>fb", telescope.buffers)
map_telescope("<leader>fg", telescope.git_files)
map_telescope("<leader>fp", telescope_projects.projects)
map_telescope("<leader>fs", telescope.lsp_document_symbols)
map_telescope("<leader>fS", telescope.lsp_dynamic_workspace_symbols)
map_telescope("<C-f>", telescope.grep_string)
map_telescope("<C-g>", telescope.live_grep)
-- terminal
vim.api.nvim_create_autocmd("TermOpen", {
pattern = "term://*",
callback = function()
local opts = { noremap = true }
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
end,
desc = "Map terminal esc and window switch keys",
})
-- buffer closing
nnoremap("gq", ":Bdelete<CR>")
-- toggle search highlighting
vim.cmd('nnoremap <expr> * v:hlsearch ? ":nohlsearch<cr>" : "*"')
-- insert-map jj/jk to escape
require("better_escape").setup()

200
horsch/neovim/lspconfig.lua Normal file
View file

@ -0,0 +1,200 @@
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local on_attach = function(client, bufnr)
local function nnoremap(key, command)
vim.keymap.set("n", key, command, { noremap = true, silent = true, buffer = bufnr })
end
local function format_buffer()
vim.lsp.buf.format({
timeout_ms = 3000,
async = false,
filter = function(formatter)
return formatter.name ~= "tsserver" and formatter.name ~= "volar"
end
})
end
require("lsp-inlayhints").on_attach(client, bufnr)
local telescope = require("telescope.builtin")
nnoremap("gD", vim.lsp.buf.declaration)
nnoremap("gd", telescope.lsp_definitions)
nnoremap("gt", telescope.lsp_type_definitions)
nnoremap("gi", telescope.lsp_implementations)
nnoremap("gr", telescope.lsp_references)
nnoremap("K", vim.lsp.buf.hover)
nnoremap("<leader>rn", vim.lsp.buf.rename)
nnoremap("<leader>ca", vim.lsp.buf.code_action)
nnoremap("<leader>f", format_buffer)
nnoremap("<leader>d", telescope.diagnostics)
nnoremap("<leader>D", require("lsp_lines").toggle)
nnoremap("<C-p>", vim.diagnostic.goto_prev)
nnoremap("<C-n>", vim.diagnostic.goto_next)
nnoremap("<M-o>", ":ClangdSwitchSourceHeader<CR>")
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = format_buffer,
})
end
end
require("lsp-inlayhints").setup({})
local lsp_status = require("lsp-status")
lsp_status.config({
current_function = false,
show_filename = false,
diagnostics = true,
status_symbol = "",
})
lsp_status.register_progress()
-- setup lua language server for init.nvim and nvim plugin development
require("neodev").setup({
override = function(root_dir, options)
if require("neodev.util").has_file(root_dir, "/etc/nixos") then
options.enabled = true
options.plugins = true
end
end,
})
local capabilities = require("cmp_nvim_lsp").default_capabilities(lsp_status.capabilities)
local servers = {
["bashls"] = {},
["bitbake_language_server"] = {},
["clangd"] = {},
["cmake"] = {},
["dockerls"] = {},
["eslint"] = {},
["html"] = {},
["jsonls"] = {},
["lua_ls"] = {
Lua = {
runtime = {
version = "LuaJIT",
},
diagnostics = {
globals = { "vim" },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
format = {
enable = true,
defaultConfig = {
indent_style = "space",
indent_size = "2",
},
},
},
},
["marksman"] = {},
["nixd"] = {},
["pylsp"] = {
pylsp = {
plugins = {
autopep8 = {
enabled = true
},
flake8 = {
enabled = true
},
pycodestyle = {
maxLineLength = 120,
enabled = true,
}
}
}
},
["pyright"] = {},
["terraformls"] = {},
["texlab"] = {},
["tflint"] = {},
["tsserver"] = {},
["yamlls"] = {
yaml = {
keyOrdering = false
}
},
}
local lspconfig = require("lspconfig")
for lsp, settings in pairs(servers) do
lspconfig[lsp].setup({
settings = settings,
on_attach = on_attach,
capabilities = capabilities,
})
end
-- setup rustaceanvim
vim.g.rustaceanvim = {
server = {
on_attach = on_attach,
settings = {
["rust-analyzer"] = {
cargo = {
loadOutDirsFromCheck = true,
},
checkOnSave = { command = "clippy" },
procMacro = {
enable = true,
},
},
},
},
}
-- setup null-ls for markdown formatting
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.prettier,
null_ls.builtins.diagnostics.tsc,
},
on_attach = on_attach,
})
-- setup lsp_lines
require("lsp_lines").setup()
-- setup vim diagnostics
vim.diagnostic.config({
virtual_text = false,
signs = true,
update_in_insert = true,
underline = true,
severity_sort = true,
float = {
border = "rounded",
source = true,
header = "",
prefix = "",
},
})
-- setup diagnostics signs
local diagnostics_signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(diagnostics_signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
-- setup volar
lspconfig["volar"].setup({
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' },
on_attach = on_attach,
capabilities = capabilities,
})

View file

@ -0,0 +1,7 @@
require('lualine').setup({
options = { globalstatus = true },
sections = {
lualine_c = { { "filename", path = 1 }, "require('lsp-status').status()" }
},
extensions = { "toggleterm" }
})

View file

@ -0,0 +1 @@
require("luasnip.loaders.from_vscode").lazy_load()

16
horsch/neovim/neorg.lua Normal file
View file

@ -0,0 +1,16 @@
local neorg = require("neorg")
neorg.setup({
load = {
["core.defaults"] = {},
["core.concealer"] = {},
["core.dirman"] = {
config = {
workspaces = {
notes = "~/notes",
},
default_workspace = "notes",
},
},
}
})

2
horsch/neovim/notify.lua Normal file
View file

@ -0,0 +1,2 @@
require("notify").setup({ stages = "fade" })
vim.notify = require("notify")

View file

@ -0,0 +1,87 @@
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(
col, col):match("%s") == nil
end
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer" },
{ name = "nvim-lua" },
{ name = "calc" },
}),
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
experimental = { ghost_text = true },
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
fields = { "menu", "abbr", "kind" },
format = function(entry, item)
local menu_icon = {
nvim_lsp = "λ",
luasnip = "",
buffer = "Ω",
path = "🖿",
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
})
-- `/` cmdline setup.
cmp.setup.cmdline("/", {
sources = cmp.config.sources(
{ name = "buffer" }
)
})
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
sources = cmp.config.sources(
{ name = "path" },
{ name = "cmdline" }
)
})

61
horsch/neovim/options.lua Normal file
View file

@ -0,0 +1,61 @@
-- termguicolors
vim.opt.termguicolors = true
-- line numbers
vim.opt.number = true
-- tabwidth
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
-- indent with spaces
vim.opt.expandtab = true
-- scroll offset
vim.opt.scrolloff = 4
-- don't warp lines
vim.opt.wrap = false
-- split to right/below
vim.opt.splitright = true
vim.opt.splitbelow = true
-- presistent undo
vim.opt.undofile = true
-- searching
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- preview commands
vim.opt.inccommand = "split"
-- completion
vim.opt.completeopt = "menu,menuone,noselect"
-- folding
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
vim.opt.foldlevelstart = 99
-- disable mouse
vim.opt.mouse = ""
-- set cursorline in active window
vim.cmd([[
augroup CursorLine
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
augroup END
]])
-- configure terminal
vim.cmd([[
augroup terminal_setup
autocmd!
autocmd TermOpen * startinsert
autocmd TermOpen * setlocal nonumber norelativenumber
augroup END
]])

View file

@ -0,0 +1 @@
require('project_nvim').setup({})

View file

@ -0,0 +1 @@
require('tabline').setup({ enable = true, options = { show_bufnr = true, show_filename_only = true } })

View file

@ -0,0 +1,29 @@
local telescope = require("telescope")
local actions = require("telescope.actions")
local themes = require("telescope.themes")
telescope.setup({
defaults = {
mappings = {
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<ESC>"] = actions.close,
["<C-c>"] = actions.close
},
n = {
["<ESC>"] = actions.close,
["<C-c>"] = actions.close
}
}
},
extensions = {
["ui-select"] = {
themes.get_dropdown({})
},
}
})
telescope.load_extension("fzf")
telescope.load_extension("ui-select")
telescope.load_extension("projects")

1
horsch/neovim/themes.lua Normal file
View file

@ -0,0 +1 @@
vim.cmd("colorscheme solarized")

View file

@ -0,0 +1 @@
require("toggleterm").setup({ size = 32, open_mapping = [[<F4>]] })

View file

@ -0,0 +1,93 @@
require('nvim-treesitter.configs').setup({
highlight = {
enable = true,
},
indent = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
node_decremental = "<bs>",
scope_incremental = false,
},
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" },
["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" },
["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" },
["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" },
["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" },
["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" },
["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" },
["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" },
["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" },
["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" },
["af"] = { query = "@call.outer", desc = "Select outer part of a function call" },
["if"] = { query = "@call.inner", desc = "Select inner part of a function call" },
["am"] = { query = "@function.outer", desc = "Select outer part of a method/function definition" },
["im"] = { query = "@function.inner", desc = "Select inner part of a method/function definition" },
["ac"] = { query = "@class.outer", desc = "Select outer part of a class" },
["ic"] = { query = "@class.inner", desc = "Select inner part of a class" },
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]f"] = { query = "@call.outer", desc = "Next function call start" },
["]m"] = { query = "@function.outer", desc = "Next method/function def start" },
["]c"] = { query = "@class.outer", desc = "Next class start" },
["]i"] = { query = "@conditional.outer", desc = "Next conditional start" },
["]l"] = { query = "@loop.outer", desc = "Next loop start" },
-- You can pass a query group to use query from `queries/<lang>/<query_group>.scm file in your runtime path.
-- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm.
["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" },
["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" },
},
goto_next_end = {
["]F"] = { query = "@call.outer", desc = "Next function call end" },
["]M"] = { query = "@function.outer", desc = "Next method/function def end" },
["]C"] = { query = "@class.outer", desc = "Next class end" },
["]I"] = { query = "@conditional.outer", desc = "Next conditional end" },
["]L"] = { query = "@loop.outer", desc = "Next loop end" },
},
goto_previous_start = {
["[f"] = { query = "@call.outer", desc = "Prev function call start" },
["[m"] = { query = "@function.outer", desc = "Prev method/function def start" },
["[c"] = { query = "@class.outer", desc = "Prev class start" },
["[i"] = { query = "@conditional.outer", desc = "Prev conditional start" },
["[l"] = { query = "@loop.outer", desc = "Prev loop start" },
},
goto_previous_end = {
["[F"] = { query = "@call.outer", desc = "Prev function call end" },
["[M"] = { query = "@function.outer", desc = "Prev method/function def end" },
["[C"] = { query = "@class.outer", desc = "Prev class end" },
["[I"] = { query = "@conditional.outer", desc = "Prev conditional end" },
["[L"] = { query = "@loop.outer", desc = "Prev loop end" },
},
},
lsp_interop = {
enable = true,
border = 'none',
floating_preview_opts = {},
peek_definition_code = {
["<leader>df"] = "@function.outer",
["<leader>dF"] = "@class.outer",
},
},
},
},
})

5
horsch/picocom.nix Normal file
View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.picocom ];
}

5
horsch/podman.nix Normal file
View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.podman ];
}

9
horsch/ripgrep.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
programs = {
ripgrep = {
enable = true;
};
};
}

5
horsch/rsync.nix Normal file
View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.rsync ];
}

11
horsch/shell_aliases.nix Normal file
View file

@ -0,0 +1,11 @@
{ ... }:
{
home.shellAliases = {
g = "git";
gg = "git graph";
gs = "git status";
gd = "git diff";
k = "kubectl";
};
}

65
horsch/ssh.nix Normal file
View file

@ -0,0 +1,65 @@
{ ... }:
{
programs = {
ssh = {
enable = true;
matchBlocks = {
SmartCAN = {
host = "smartcan 192.168.5.1";
user = "root";
hostname = "192.168.5.1";
checkHostIP = false;
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
LogLevel = "ERROR";
};
};
Fusion-USB = {
host = "fusion-usb fusion 172.16.0.1";
user = "root";
hostname = "172.16.0.1";
checkHostIP = false;
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
LogLevel = "ERROR";
};
};
Fusion-Wifi = {
host = "fusion-wifi 172.16.1.1";
user = "root";
hostname = "172.16.1.1";
checkHostIP = false;
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
LogLevel = "ERROR";
};
};
Fusion-TX = {
host = "fusion-tx 10.100.30.160";
user = "root";
hostname = "10.100.30.160";
checkHostIP = false;
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
LogLevel = "ERROR";
};
};
hcvpnde = {
host = "hcvpnde hcvpnde.horsch.com";
hostname = "hcvpnde.horsch.com";
};
smartcan-vpn = {
host = "smartcan3-*";
user = "root";
proxyJump = "hcvpnde";
};
};
};
};
}

11
horsch/starship.nix Normal file
View file

@ -0,0 +1,11 @@
{ lib, ... }:
{
programs.starship = {
enable = true;
settings = {
format = lib.concatStrings [ "$all" "$directory" "$character" ];
hostname.format = "[$ssh_symbol$hostname]($style) ";
};
};
}

5
horsch/tree.nix Normal file
View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
home.packages = [ pkgs.tree ];
}

9
horsch/zoxide.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
}

68
horsch/zsh.nix Normal file
View file

@ -0,0 +1,68 @@
{ ... }:
{
programs.zsh = {
enable = true;
enableCompletion = true;
history.size = 10000;
autosuggestion = {
enable = true;
highlight = "fg=10";
};
syntaxHighlighting = {
enable = true;
};
initExtra = ''
if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ];
then
source $HOME/.nix-profile/etc/profile.d/nix.sh
fi
function sc-log {
ssh smartcan "SYSTEMD_COLORS=true journalctl --follow --no-tail --unit smartcan-''${1:-*}"
}
function sc-restart {
ssh smartcan "systemctl restart smartcan-''${1}"
}
function fu-reboot {
ssh fusion "reboot"
}
function fu-flash {
local ssh_login="fusion"
local update_file=''${1}
if [ -z ''${update_file} ]; then
update_file=$(find build/tmp/deploy/images -name "*.swu" -type f | fzf --select-1)
fi
if [ -z ''${update_file} ]; then
echo "no file selected"
return 1
fi
if [ ! -f ''${update_file} ]; then
echo "file \"''${update_file}\" does not exist"
return 2
fi
echo "flashing ''${update_file} to device..."
cat "''${update_file}" | ssh ''${ssh_login} "swupdate-client -"
if [ $? -ne 0 ]; then
echo "update failed"
return 3
fi
echo "rebooting device"
ssh ''${ssh_login} reboot
echo "done."
}
'';
};
}