From 0cf5c3433e0a82e764539a9bba1fd234666df3b3 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 08:09:32 +0200 Subject: [PATCH 01/18] build: move all files to private dir --- flake.nix | 4 ++-- bat.nix => private/bat.nix | 0 carapace.nix => private/carapace.nix | 0 direnv.nix => private/direnv.nix | 0 email.nix => private/email.nix | 0 firefox.nix => private/firefox.nix | 0 fzf.nix => private/fzf.nix | 0 git.nix => private/git.nix | 0 {gpg => private/gpg}/default.nix | 0 {gpg => private/gpg}/pubring.asc | 0 home.nix => private/home.nix | 0 kitty.nix => private/kitty.nix | 0 {neovim => private/neovim}/auto-session.lua | 0 {neovim => private/neovim}/commands.lua | 0 {neovim => private/neovim}/comment.lua | 0 {neovim => private/neovim}/dap.lua | 0 {neovim => private/neovim}/default.nix | 0 {neovim => private/neovim}/gitsigns.lua | 0 {neovim => private/neovim}/indent-blankline.lua | 0 {neovim => private/neovim}/keymaps.lua | 0 {neovim => private/neovim}/lspconfig.lua | 0 {neovim => private/neovim}/lualine.lua | 0 {neovim => private/neovim}/luasnip.lua | 0 {neovim => private/neovim}/neorg.lua | 0 {neovim => private/neovim}/notify.lua | 0 {neovim => private/neovim}/nvim-cmp.lua | 0 {neovim => private/neovim}/options.lua | 0 {neovim => private/neovim}/project-nvim.lua | 0 {neovim => private/neovim}/tabline.lua | 0 {neovim => private/neovim}/telescope.lua | 0 {neovim => private/neovim}/themes.lua | 0 {neovim => private/neovim}/toggleterm.lua | 0 {neovim => private/neovim}/treesitter.lua | 0 nextcloud.nix => private/nextcloud.nix | 0 starship.nix => private/starship.nix | 0 {sway => private/sway}/default.nix | 0 {sway => private/sway}/dunst.nix | 0 {sway => private/sway}/i3status-rust.nix | 0 xps.nix => private/xps.nix | 0 zoxide.nix => private/zoxide.nix | 0 zsh.nix => private/zsh.nix | 0 41 files changed, 2 insertions(+), 2 deletions(-) rename bat.nix => private/bat.nix (100%) rename carapace.nix => private/carapace.nix (100%) rename direnv.nix => private/direnv.nix (100%) rename email.nix => private/email.nix (100%) rename firefox.nix => private/firefox.nix (100%) rename fzf.nix => private/fzf.nix (100%) rename git.nix => private/git.nix (100%) rename {gpg => private/gpg}/default.nix (100%) rename {gpg => private/gpg}/pubring.asc (100%) rename home.nix => private/home.nix (100%) rename kitty.nix => private/kitty.nix (100%) rename {neovim => private/neovim}/auto-session.lua (100%) rename {neovim => private/neovim}/commands.lua (100%) rename {neovim => private/neovim}/comment.lua (100%) rename {neovim => private/neovim}/dap.lua (100%) rename {neovim => private/neovim}/default.nix (100%) rename {neovim => private/neovim}/gitsigns.lua (100%) rename {neovim => private/neovim}/indent-blankline.lua (100%) rename {neovim => private/neovim}/keymaps.lua (100%) rename {neovim => private/neovim}/lspconfig.lua (100%) rename {neovim => private/neovim}/lualine.lua (100%) rename {neovim => private/neovim}/luasnip.lua (100%) rename {neovim => private/neovim}/neorg.lua (100%) rename {neovim => private/neovim}/notify.lua (100%) rename {neovim => private/neovim}/nvim-cmp.lua (100%) rename {neovim => private/neovim}/options.lua (100%) rename {neovim => private/neovim}/project-nvim.lua (100%) rename {neovim => private/neovim}/tabline.lua (100%) rename {neovim => private/neovim}/telescope.lua (100%) rename {neovim => private/neovim}/themes.lua (100%) rename {neovim => private/neovim}/toggleterm.lua (100%) rename {neovim => private/neovim}/treesitter.lua (100%) rename nextcloud.nix => private/nextcloud.nix (100%) rename starship.nix => private/starship.nix (100%) rename {sway => private/sway}/default.nix (100%) rename {sway => private/sway}/dunst.nix (100%) rename {sway => private/sway}/i3status-rust.nix (100%) rename xps.nix => private/xps.nix (100%) rename zoxide.nix => private/zoxide.nix (100%) rename zsh.nix => private/zsh.nix (100%) diff --git a/flake.nix b/flake.nix index 3bfe5d2..fd43b76 100644 --- a/flake.nix +++ b/flake.nix @@ -20,8 +20,8 @@ inherit pkgs; modules = [ - ./home.nix - ./xps.nix + ./private/home.nix + ./private/xps.nix ]; extraSpecialArgs = { diff --git a/bat.nix b/private/bat.nix similarity index 100% rename from bat.nix rename to private/bat.nix diff --git a/carapace.nix b/private/carapace.nix similarity index 100% rename from carapace.nix rename to private/carapace.nix diff --git a/direnv.nix b/private/direnv.nix similarity index 100% rename from direnv.nix rename to private/direnv.nix diff --git a/email.nix b/private/email.nix similarity index 100% rename from email.nix rename to private/email.nix diff --git a/firefox.nix b/private/firefox.nix similarity index 100% rename from firefox.nix rename to private/firefox.nix diff --git a/fzf.nix b/private/fzf.nix similarity index 100% rename from fzf.nix rename to private/fzf.nix diff --git a/git.nix b/private/git.nix similarity index 100% rename from git.nix rename to private/git.nix diff --git a/gpg/default.nix b/private/gpg/default.nix similarity index 100% rename from gpg/default.nix rename to private/gpg/default.nix diff --git a/gpg/pubring.asc b/private/gpg/pubring.asc similarity index 100% rename from gpg/pubring.asc rename to private/gpg/pubring.asc diff --git a/home.nix b/private/home.nix similarity index 100% rename from home.nix rename to private/home.nix diff --git a/kitty.nix b/private/kitty.nix similarity index 100% rename from kitty.nix rename to private/kitty.nix diff --git a/neovim/auto-session.lua b/private/neovim/auto-session.lua similarity index 100% rename from neovim/auto-session.lua rename to private/neovim/auto-session.lua diff --git a/neovim/commands.lua b/private/neovim/commands.lua similarity index 100% rename from neovim/commands.lua rename to private/neovim/commands.lua diff --git a/neovim/comment.lua b/private/neovim/comment.lua similarity index 100% rename from neovim/comment.lua rename to private/neovim/comment.lua diff --git a/neovim/dap.lua b/private/neovim/dap.lua similarity index 100% rename from neovim/dap.lua rename to private/neovim/dap.lua diff --git a/neovim/default.nix b/private/neovim/default.nix similarity index 100% rename from neovim/default.nix rename to private/neovim/default.nix diff --git a/neovim/gitsigns.lua b/private/neovim/gitsigns.lua similarity index 100% rename from neovim/gitsigns.lua rename to private/neovim/gitsigns.lua diff --git a/neovim/indent-blankline.lua b/private/neovim/indent-blankline.lua similarity index 100% rename from neovim/indent-blankline.lua rename to private/neovim/indent-blankline.lua diff --git a/neovim/keymaps.lua b/private/neovim/keymaps.lua similarity index 100% rename from neovim/keymaps.lua rename to private/neovim/keymaps.lua diff --git a/neovim/lspconfig.lua b/private/neovim/lspconfig.lua similarity index 100% rename from neovim/lspconfig.lua rename to private/neovim/lspconfig.lua diff --git a/neovim/lualine.lua b/private/neovim/lualine.lua similarity index 100% rename from neovim/lualine.lua rename to private/neovim/lualine.lua diff --git a/neovim/luasnip.lua b/private/neovim/luasnip.lua similarity index 100% rename from neovim/luasnip.lua rename to private/neovim/luasnip.lua diff --git a/neovim/neorg.lua b/private/neovim/neorg.lua similarity index 100% rename from neovim/neorg.lua rename to private/neovim/neorg.lua diff --git a/neovim/notify.lua b/private/neovim/notify.lua similarity index 100% rename from neovim/notify.lua rename to private/neovim/notify.lua diff --git a/neovim/nvim-cmp.lua b/private/neovim/nvim-cmp.lua similarity index 100% rename from neovim/nvim-cmp.lua rename to private/neovim/nvim-cmp.lua diff --git a/neovim/options.lua b/private/neovim/options.lua similarity index 100% rename from neovim/options.lua rename to private/neovim/options.lua diff --git a/neovim/project-nvim.lua b/private/neovim/project-nvim.lua similarity index 100% rename from neovim/project-nvim.lua rename to private/neovim/project-nvim.lua diff --git a/neovim/tabline.lua b/private/neovim/tabline.lua similarity index 100% rename from neovim/tabline.lua rename to private/neovim/tabline.lua diff --git a/neovim/telescope.lua b/private/neovim/telescope.lua similarity index 100% rename from neovim/telescope.lua rename to private/neovim/telescope.lua diff --git a/neovim/themes.lua b/private/neovim/themes.lua similarity index 100% rename from neovim/themes.lua rename to private/neovim/themes.lua diff --git a/neovim/toggleterm.lua b/private/neovim/toggleterm.lua similarity index 100% rename from neovim/toggleterm.lua rename to private/neovim/toggleterm.lua diff --git a/neovim/treesitter.lua b/private/neovim/treesitter.lua similarity index 100% rename from neovim/treesitter.lua rename to private/neovim/treesitter.lua diff --git a/nextcloud.nix b/private/nextcloud.nix similarity index 100% rename from nextcloud.nix rename to private/nextcloud.nix diff --git a/starship.nix b/private/starship.nix similarity index 100% rename from starship.nix rename to private/starship.nix diff --git a/sway/default.nix b/private/sway/default.nix similarity index 100% rename from sway/default.nix rename to private/sway/default.nix diff --git a/sway/dunst.nix b/private/sway/dunst.nix similarity index 100% rename from sway/dunst.nix rename to private/sway/dunst.nix diff --git a/sway/i3status-rust.nix b/private/sway/i3status-rust.nix similarity index 100% rename from sway/i3status-rust.nix rename to private/sway/i3status-rust.nix diff --git a/xps.nix b/private/xps.nix similarity index 100% rename from xps.nix rename to private/xps.nix diff --git a/zoxide.nix b/private/zoxide.nix similarity index 100% rename from zoxide.nix rename to private/zoxide.nix diff --git a/zsh.nix b/private/zsh.nix similarity index 100% rename from zsh.nix rename to private/zsh.nix From 428b91c3d55b85930554c13b9f51f6cc9496058c Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 08:10:56 +0200 Subject: [PATCH 02/18] feat: import horsch config --- flake.nix | 12 ++ horsch/bat.nix | 13 ++ horsch/carapace.nix | 8 ++ horsch/direnv.nix | 11 ++ horsch/docs/Setup Log WSL+Alpine.md | 91 +++++++++++++ horsch/eza.nix | 8 ++ horsch/fzf.nix | 10 ++ horsch/git.nix | 126 ++++++++++++++++++ horsch/gpg/default.nix | 43 ++++++ horsch/gpg/horsch.pub.asc | 51 +++++++ horsch/gpg/molez.pub.asc | 52 ++++++++ horsch/gpg/vi-bim.pub.asc | 52 ++++++++ horsch/home.nix | 40 ++++++ horsch/neovim/auto-session.lua | 3 + horsch/neovim/commands.lua | 1 + horsch/neovim/comment.lua | 1 + horsch/neovim/dap.lua | 35 +++++ horsch/neovim/default.nix | 177 ++++++++++++++++++++++++ horsch/neovim/gitsigns.lua | 1 + horsch/neovim/illuminate.lua | 8 ++ horsch/neovim/indent-blankline.lua | 5 + horsch/neovim/keymaps.lua | 69 ++++++++++ horsch/neovim/lspconfig.lua | 200 ++++++++++++++++++++++++++++ horsch/neovim/lualine.lua | 7 + horsch/neovim/luasnip.lua | 1 + horsch/neovim/neorg.lua | 16 +++ horsch/neovim/notify.lua | 2 + horsch/neovim/nvim-cmp.lua | 87 ++++++++++++ horsch/neovim/options.lua | 61 +++++++++ horsch/neovim/project-nvim.lua | 1 + horsch/neovim/tabline.lua | 1 + horsch/neovim/telescope.lua | 29 ++++ horsch/neovim/themes.lua | 1 + horsch/neovim/toggleterm.lua | 1 + horsch/neovim/treesitter.lua | 93 +++++++++++++ horsch/picocom.nix | 5 + horsch/podman.nix | 5 + horsch/ripgrep.nix | 9 ++ horsch/rsync.nix | 5 + horsch/shell_aliases.nix | 11 ++ horsch/ssh.nix | 65 +++++++++ horsch/starship.nix | 11 ++ horsch/tree.nix | 5 + horsch/zoxide.nix | 9 ++ horsch/zsh.nix | 68 ++++++++++ 45 files changed, 1510 insertions(+) create mode 100644 horsch/bat.nix create mode 100644 horsch/carapace.nix create mode 100644 horsch/direnv.nix create mode 100644 horsch/docs/Setup Log WSL+Alpine.md create mode 100644 horsch/eza.nix create mode 100644 horsch/fzf.nix create mode 100644 horsch/git.nix create mode 100644 horsch/gpg/default.nix create mode 100644 horsch/gpg/horsch.pub.asc create mode 100644 horsch/gpg/molez.pub.asc create mode 100644 horsch/gpg/vi-bim.pub.asc create mode 100644 horsch/home.nix create mode 100644 horsch/neovim/auto-session.lua create mode 100644 horsch/neovim/commands.lua create mode 100644 horsch/neovim/comment.lua create mode 100644 horsch/neovim/dap.lua create mode 100644 horsch/neovim/default.nix create mode 100644 horsch/neovim/gitsigns.lua create mode 100644 horsch/neovim/illuminate.lua create mode 100644 horsch/neovim/indent-blankline.lua create mode 100644 horsch/neovim/keymaps.lua create mode 100644 horsch/neovim/lspconfig.lua create mode 100644 horsch/neovim/lualine.lua create mode 100644 horsch/neovim/luasnip.lua create mode 100644 horsch/neovim/neorg.lua create mode 100644 horsch/neovim/notify.lua create mode 100644 horsch/neovim/nvim-cmp.lua create mode 100644 horsch/neovim/options.lua create mode 100644 horsch/neovim/project-nvim.lua create mode 100644 horsch/neovim/tabline.lua create mode 100644 horsch/neovim/telescope.lua create mode 100644 horsch/neovim/themes.lua create mode 100644 horsch/neovim/toggleterm.lua create mode 100644 horsch/neovim/treesitter.lua create mode 100644 horsch/picocom.nix create mode 100644 horsch/podman.nix create mode 100644 horsch/ripgrep.nix create mode 100644 horsch/rsync.nix create mode 100644 horsch/shell_aliases.nix create mode 100644 horsch/ssh.nix create mode 100644 horsch/starship.nix create mode 100644 horsch/tree.nix create mode 100644 horsch/zoxide.nix create mode 100644 horsch/zsh.nix diff --git a/flake.nix b/flake.nix index fd43b76..50e0349 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,18 @@ theme = "dark"; }; }; + "mmandl@NB11313" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + + modules = [ + ./horsch/home.nix + ]; + + extraSpecialArgs = { + username = "mmandl"; + theme = "dark"; + }; + }; }; }; } diff --git a/horsch/bat.nix b/horsch/bat.nix new file mode 100644 index 0000000..4e4b56a --- /dev/null +++ b/horsch/bat.nix @@ -0,0 +1,13 @@ +{ ... }: + +let + theme_name = "Solarized (dark)"; +in +{ + programs = { + bat = { + enable = true; + config.theme = theme_name; + }; + }; +} diff --git a/horsch/carapace.nix b/horsch/carapace.nix new file mode 100644 index 0000000..2705a18 --- /dev/null +++ b/horsch/carapace.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + programs.carapace = { + enable = true; + enableZshIntegration = true; + }; +} + diff --git a/horsch/direnv.nix b/horsch/direnv.nix new file mode 100644 index 0000000..005868d --- /dev/null +++ b/horsch/direnv.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + programs = { + direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; + }; + }; +} diff --git a/horsch/docs/Setup Log WSL+Alpine.md b/horsch/docs/Setup Log WSL+Alpine.md new file mode 100644 index 0000000..87ed6cb --- /dev/null +++ b/horsch/docs/Setup Log WSL+Alpine.md @@ -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 '' -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 +``` diff --git a/horsch/eza.nix b/horsch/eza.nix new file mode 100644 index 0000000..7422f80 --- /dev/null +++ b/horsch/eza.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + programs.eza = { + enable = true; + git = true; + extraOptions = [ "--group-directories-first" ]; + }; +} diff --git a/horsch/fzf.nix b/horsch/fzf.nix new file mode 100644 index 0000000..0e83315 --- /dev/null +++ b/horsch/fzf.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, user, ... }: + +{ + programs = { + fzf = { + enable = true; + enableZshIntegration = true; + }; + }; +} diff --git a/horsch/git.nix b/horsch/git.nix new file mode 100644 index 0000000..b843736 --- /dev/null +++ b/horsch/git.nix @@ -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} + '') + ]; +} + diff --git a/horsch/gpg/default.nix b/horsch/gpg/default.nix new file mode 100644 index 0000000..9adcf94 --- /dev/null +++ b/horsch/gpg/default.nix @@ -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"; + } + ]; + }; +} diff --git a/horsch/gpg/horsch.pub.asc b/horsch/gpg/horsch.pub.asc new file mode 100644 index 0000000..c48050b --- /dev/null +++ b/horsch/gpg/horsch.pub.asc @@ -0,0 +1,51 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGNBGY9z3YBDACrIG26NDCvf+HV4V6LiePgvRoC4lEqaUvrf9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CsV29r5Ut4nwwFuupT74EpAnZhJ74b+WL3ZChAkXPY9BoC3x9MHYo+m5QRCC +QAVIHrtIXO3999YmCjdGB8brJUA59cFW3S8MugninEASkVcoh4YF3+gIUNwGbgKw +xkJvnhphKqM4Y2qi0dKSSh0UuDMEZkGx9hYJKwYBBAHaRw8BAQdACcX55v3TrwzY +ql0GJf46wrk0fLxtdzu1lzAUpFhuc4SJAbYEGAEKACAWIQRI3btAp75ZB1HCI2II +jtOPA2x68gUCZkGx9gIbIAAKCRAIjtOPA2x68uVVC/9KUN1CE3CzPWNSP00oy0kH +W9/8Aznmf85EqMagD1nF4+yaIiOGqYvyCy/+HWwRXsTd/QyYwrXQ5DMRmXOqAcYe +pe/diOTmFXH9OMyf6PkN589WD3DAYjWC5neYNsOoJjMzeWEOcXhuJhR6+ewmUhDe +5Ji9bwpK+Hlm32ptE6xk4XJOsls8jqcRCExcxmW2fqF9GjSUuCoNWN87Jloplcjm +WsoyoqWpxCTjcvm/OpKzzSVM20Cdov+H08eAzLsWATLqfSNrEfIaT7CuWTRvdLuS +q56wtFxsa8X2Id129EJuWyD/7yIfzuHrUdbVkCHpxU+h92RFmYfB6fcE4AydJWOc +50y5pZqcf58Ari+8NryHj0o252Gg2EXi6Wp2QdJxCdUr6baVAKd+olH1i0SP7Hvf +L0+VBbG59VWFuS3G/U0wzobNCP2284mLqkguj2t3sK3V/x4XEaEUPmuKR9PrbEok +K672Cz44DjvnnrXxlxvX7eFsjHgDvgRXoacBaZWyEss= +=oAoO +-----END PGP PUBLIC KEY BLOCK----- diff --git a/horsch/gpg/molez.pub.asc b/horsch/gpg/molez.pub.asc new file mode 100644 index 0000000..4531725 --- /dev/null +++ b/horsch/gpg/molez.pub.asc @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBF75iDUBEADKT7HJf29rKofixOegZt6C4fDWhgJuVa/tT/9CxBewpGuvt2an +JM9eTO2ZUWjcbYc4zNsMppANKyr0+i9tve7f+hA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Gok8ZyIOef5rbRD4EezBAK0XOY +b1WtzQARAQABiQI8BBgBCAAmFiEE2+TTUgq6v9+ED4/PSqJdZHqlTMcFAl75iDUC +GwwFCQlmAYAACgkQSqJdZHqlTMdRgBAAlpd9k6GB3NjmMtKtiNSsifGcRcOSbbMP +tQdMkwpFYx2gxlSJ0ANGidkCW7HcCLpEce6RunsS0o/lp9gXO7J+r0IfoLX6BhZq +EhrIMz0UyRgWJUQzq9/lyJnINLtY0JoEmvaDdAnGV4H4MoR4Pm+KioP5JHwFBUue +//M2PlBhmvuTQsoVIucZERx6gPOJDXV0GyytviSRB8BSvS0Ts+ayzbM0KgUqw6tb +p9ghej2vQImmzvkoF9RSBfe8oyRJ2qP17/uriaqUn4ETYoXyV65j8HPoxs+adyRY +I+yHlCfI27ft9rbTfZavEZSLLlUzqpzs2BfIqRLclwRm5QfIxbyZ2xwH6FCfjv0z +qH8WTFW5iSJpwCzIrVeAKyGawyHuU+Ww6qujJbhKDMzOl/UTyMtpNRnqqH+9sNaU +FuydeynUenih4/FBYwLGYIFM6rHVXCv0OYtOasyriNxCRDqbfT2NtSn8yj0Q8erp +GAcygR/FR37HTF3GRSXG3nlypzZOuaaD35OOpI6265LKPswZB5TbQB+Ggay2p2hU +EgMFmGaH+cxFjfD08CBuWaBQOlPv+1TTpnUAQc/Yx2HsnDJrtkznSN2JXrBNabfj +GBdIZ3fqpsYGf8J3EQf2/weT12oGFjXdjPRcOTu9Dord2AtgZYOdNwDNIJyBciB6 +0bwMRPpj0JE= +=B2N+ +-----END PGP PUBLIC KEY BLOCK----- diff --git a/horsch/gpg/vi-bim.pub.asc b/horsch/gpg/vi-bim.pub.asc new file mode 100644 index 0000000..9b1449f --- /dev/null +++ b/horsch/gpg/vi-bim.pub.asc @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBF75hKEBEADCK0qTyghmaW7P8xw01T7ENVZQknNlvKPpcTzOG50Tt5fzCZ4I +R+ymh1u6OysqNC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gIEPLQghNbENdwRrxMB +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----- diff --git a/horsch/home.nix b/horsch/home.nix new file mode 100644 index 0000000..84f0575 --- /dev/null +++ b/horsch/home.nix @@ -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 + ]; +} diff --git a/horsch/neovim/auto-session.lua b/horsch/neovim/auto-session.lua new file mode 100644 index 0000000..25036fa --- /dev/null +++ b/horsch/neovim/auto-session.lua @@ -0,0 +1,3 @@ +require("auto-session").setup { + log_level = "error", +} diff --git a/horsch/neovim/commands.lua b/horsch/neovim/commands.lua new file mode 100644 index 0000000..10e03a5 --- /dev/null +++ b/horsch/neovim/commands.lua @@ -0,0 +1 @@ +vim.api.nvim_create_user_command("BufOnly", "%bd|e#|bd#", {}) diff --git a/horsch/neovim/comment.lua b/horsch/neovim/comment.lua new file mode 100644 index 0000000..5060319 --- /dev/null +++ b/horsch/neovim/comment.lua @@ -0,0 +1 @@ +require('Comment').setup({}) diff --git a/horsch/neovim/dap.lua b/horsch/neovim/dap.lua new file mode 100644 index 0000000..a36d4ee --- /dev/null +++ b/horsch/neovim/dap.lua @@ -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", "", dap.continue, { noremap = true, silent = true }) +vim.keymap.set("n", "", dap.toggle_breakpoint, { noremap = true, silent = true }) +vim.keymap.set("n", "", dap.step_over, { noremap = true, silent = true }) +vim.keymap.set("n", "", dap.step_into, { noremap = true, silent = true }) + +vim.keymap.set("n", "", dap.step_out, { noremap = true, silent = true }) +vim.keymap.set("n", "", dap.step_out, { noremap = true, silent = true }) -- in kitty + +vim.keymap.set("n", "", 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 diff --git a/horsch/neovim/default.nix b/horsch/neovim/default.nix new file mode 100644 index 0000000..c1501e2 --- /dev/null +++ b/horsch/neovim/default.nix @@ -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 + ''; + }; + }; +} + + diff --git a/horsch/neovim/gitsigns.lua b/horsch/neovim/gitsigns.lua new file mode 100644 index 0000000..91fa65b --- /dev/null +++ b/horsch/neovim/gitsigns.lua @@ -0,0 +1 @@ +require('gitsigns').setup() diff --git a/horsch/neovim/illuminate.lua b/horsch/neovim/illuminate.lua new file mode 100644 index 0000000..b8dc894 --- /dev/null +++ b/horsch/neovim/illuminate.lua @@ -0,0 +1,8 @@ +local illuminate = require("illuminate") + +illuminate.configure({ + providers = { + "lsp", "treesitter", "regex", + }, + under_cursor = true, +}) diff --git a/horsch/neovim/indent-blankline.lua b/horsch/neovim/indent-blankline.lua new file mode 100644 index 0000000..6a6404f --- /dev/null +++ b/horsch/neovim/indent-blankline.lua @@ -0,0 +1,5 @@ +require("ibl").setup { + indent = { + char = "┊", + }, +} diff --git a/horsch/neovim/keymaps.lua b/horsch/neovim/keymaps.lua new file mode 100644 index 0000000..18b7360 --- /dev/null +++ b/horsch/neovim/keymaps.lua @@ -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("", ":wincmd h") +nnoremap("", ":wincmd j") +nnoremap("", ":wincmd k") +nnoremap("", ":wincmd l") + +-- Switch buffers +nnoremap("", ":TablineBufferNext") +nnoremap("", ":TablineBufferPrevious") + +-- fugitive +nnoremap("g", ":0Git") + +-- vim-flog +nnoremap("G", ":Flog -all -date=relative -open-cmd=new") + +-- 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("ff", telescope.find_files) +map_telescope("fb", telescope.buffers) +map_telescope("fg", telescope.git_files) +map_telescope("fp", telescope_projects.projects) +map_telescope("fs", telescope.lsp_document_symbols) +map_telescope("fS", telescope.lsp_dynamic_workspace_symbols) +map_telescope("", telescope.grep_string) +map_telescope("", 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', '', [[]], opts) + vim.api.nvim_buf_set_keymap(0, 't', '', [[h]], opts) + vim.api.nvim_buf_set_keymap(0, 't', '', [[j]], opts) + vim.api.nvim_buf_set_keymap(0, 't', '', [[k]], opts) + vim.api.nvim_buf_set_keymap(0, 't', '', [[l]], opts) + end, + desc = "Map terminal esc and window switch keys", +}) + +-- buffer closing +nnoremap("gq", ":Bdelete") + +-- toggle search highlighting +vim.cmd('nnoremap * v:hlsearch ? ":nohlsearch" : "*"') + +-- insert-map jj/jk to escape +require("better_escape").setup() diff --git a/horsch/neovim/lspconfig.lua b/horsch/neovim/lspconfig.lua new file mode 100644 index 0000000..5c63236 --- /dev/null +++ b/horsch/neovim/lspconfig.lua @@ -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("rn", vim.lsp.buf.rename) + nnoremap("ca", vim.lsp.buf.code_action) + nnoremap("f", format_buffer) + nnoremap("d", telescope.diagnostics) + nnoremap("D", require("lsp_lines").toggle) + nnoremap("", vim.diagnostic.goto_prev) + nnoremap("", vim.diagnostic.goto_next) + nnoremap("", ":ClangdSwitchSourceHeader") + + 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, +}) diff --git a/horsch/neovim/lualine.lua b/horsch/neovim/lualine.lua new file mode 100644 index 0000000..0c20c9b --- /dev/null +++ b/horsch/neovim/lualine.lua @@ -0,0 +1,7 @@ +require('lualine').setup({ + options = { globalstatus = true }, + sections = { + lualine_c = { { "filename", path = 1 }, "require('lsp-status').status()" } + }, + extensions = { "toggleterm" } +}) diff --git a/horsch/neovim/luasnip.lua b/horsch/neovim/luasnip.lua new file mode 100644 index 0000000..80309d7 --- /dev/null +++ b/horsch/neovim/luasnip.lua @@ -0,0 +1 @@ +require("luasnip.loaders.from_vscode").lazy_load() diff --git a/horsch/neovim/neorg.lua b/horsch/neovim/neorg.lua new file mode 100644 index 0000000..4b33c51 --- /dev/null +++ b/horsch/neovim/neorg.lua @@ -0,0 +1,16 @@ +local neorg = require("neorg") + +neorg.setup({ + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, + ["core.dirman"] = { + config = { + workspaces = { + notes = "~/notes", + }, + default_workspace = "notes", + }, + }, + } +}) diff --git a/horsch/neovim/notify.lua b/horsch/neovim/notify.lua new file mode 100644 index 0000000..6fd7a22 --- /dev/null +++ b/horsch/neovim/notify.lua @@ -0,0 +1,2 @@ +require("notify").setup({ stages = "fade" }) +vim.notify = require("notify") diff --git a/horsch/neovim/nvim-cmp.lua b/horsch/neovim/nvim-cmp.lua new file mode 100644 index 0000000..6be73a3 --- /dev/null +++ b/horsch/neovim/nvim-cmp.lua @@ -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({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete({}), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = 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" }), + [""] = 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" } + ) +}) diff --git a/horsch/neovim/options.lua b/horsch/neovim/options.lua new file mode 100644 index 0000000..3ac11ae --- /dev/null +++ b/horsch/neovim/options.lua @@ -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 +]]) diff --git a/horsch/neovim/project-nvim.lua b/horsch/neovim/project-nvim.lua new file mode 100644 index 0000000..3b5902f --- /dev/null +++ b/horsch/neovim/project-nvim.lua @@ -0,0 +1 @@ +require('project_nvim').setup({}) diff --git a/horsch/neovim/tabline.lua b/horsch/neovim/tabline.lua new file mode 100644 index 0000000..74da8bb --- /dev/null +++ b/horsch/neovim/tabline.lua @@ -0,0 +1 @@ +require('tabline').setup({ enable = true, options = { show_bufnr = true, show_filename_only = true } }) diff --git a/horsch/neovim/telescope.lua b/horsch/neovim/telescope.lua new file mode 100644 index 0000000..ef9245d --- /dev/null +++ b/horsch/neovim/telescope.lua @@ -0,0 +1,29 @@ +local telescope = require("telescope") +local actions = require("telescope.actions") +local themes = require("telescope.themes") + +telescope.setup({ + defaults = { + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.close, + [""] = actions.close + }, + n = { + [""] = actions.close, + [""] = actions.close + } + } + }, + extensions = { + ["ui-select"] = { + themes.get_dropdown({}) + }, + } +}) + +telescope.load_extension("fzf") +telescope.load_extension("ui-select") +telescope.load_extension("projects") diff --git a/horsch/neovim/themes.lua b/horsch/neovim/themes.lua new file mode 100644 index 0000000..8d0b48e --- /dev/null +++ b/horsch/neovim/themes.lua @@ -0,0 +1 @@ +vim.cmd("colorscheme solarized") diff --git a/horsch/neovim/toggleterm.lua b/horsch/neovim/toggleterm.lua new file mode 100644 index 0000000..37cbe4c --- /dev/null +++ b/horsch/neovim/toggleterm.lua @@ -0,0 +1 @@ +require("toggleterm").setup({ size = 32, open_mapping = [[]] }) diff --git a/horsch/neovim/treesitter.lua b/horsch/neovim/treesitter.lua new file mode 100644 index 0000000..a9750c6 --- /dev/null +++ b/horsch/neovim/treesitter.lua @@ -0,0 +1,93 @@ +require('nvim-treesitter.configs').setup({ + highlight = { + enable = true, + }, + indent = { + enable = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + node_decremental = "", + 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//.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 = { + ["df"] = "@function.outer", + ["dF"] = "@class.outer", + }, + }, + }, + }, +}) diff --git a/horsch/picocom.nix b/horsch/picocom.nix new file mode 100644 index 0000000..3194059 --- /dev/null +++ b/horsch/picocom.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: + +{ + home.packages = [ pkgs.picocom ]; +} diff --git a/horsch/podman.nix b/horsch/podman.nix new file mode 100644 index 0000000..8cdbd28 --- /dev/null +++ b/horsch/podman.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: + +{ + home.packages = [ pkgs.podman ]; +} diff --git a/horsch/ripgrep.nix b/horsch/ripgrep.nix new file mode 100644 index 0000000..feb6335 --- /dev/null +++ b/horsch/ripgrep.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs = { + ripgrep = { + enable = true; + }; + }; +} diff --git a/horsch/rsync.nix b/horsch/rsync.nix new file mode 100644 index 0000000..f1cef88 --- /dev/null +++ b/horsch/rsync.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: + +{ + home.packages = [ pkgs.rsync ]; +} diff --git a/horsch/shell_aliases.nix b/horsch/shell_aliases.nix new file mode 100644 index 0000000..762ac23 --- /dev/null +++ b/horsch/shell_aliases.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + home.shellAliases = { + g = "git"; + gg = "git graph"; + gs = "git status"; + gd = "git diff"; + k = "kubectl"; + }; +} diff --git a/horsch/ssh.nix b/horsch/ssh.nix new file mode 100644 index 0000000..50a07a7 --- /dev/null +++ b/horsch/ssh.nix @@ -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"; + }; + }; + }; + }; +} + diff --git a/horsch/starship.nix b/horsch/starship.nix new file mode 100644 index 0000000..4cdc31f --- /dev/null +++ b/horsch/starship.nix @@ -0,0 +1,11 @@ +{ lib, ... }: + +{ + programs.starship = { + enable = true; + settings = { + format = lib.concatStrings [ "$all" "$directory" "$character" ]; + hostname.format = "[$ssh_symbol$hostname]($style) "; + }; + }; +} diff --git a/horsch/tree.nix b/horsch/tree.nix new file mode 100644 index 0000000..0a8fb13 --- /dev/null +++ b/horsch/tree.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: + +{ + home.packages = [ pkgs.tree ]; +} diff --git a/horsch/zoxide.nix b/horsch/zoxide.nix new file mode 100644 index 0000000..435b381 --- /dev/null +++ b/horsch/zoxide.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs.zoxide = { + enable = true; + enableZshIntegration = true; + }; +} + diff --git a/horsch/zsh.nix b/horsch/zsh.nix new file mode 100644 index 0000000..5588dff --- /dev/null +++ b/horsch/zsh.nix @@ -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." + } + ''; + }; +} From 27b66ec830e09413edcdca6c54f69f580800b8c7 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 08:17:30 +0200 Subject: [PATCH 03/18] feat: use user and theme attributes --- flake.nix | 8 ++++++-- horsch/bat.nix | 4 ++-- horsch/git.nix | 6 +++--- horsch/home.nix | 6 +++--- horsch/neovim/default.nix | 4 ++-- private/home.nix | 6 +++--- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index 50e0349..09c265e 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,9 @@ ]; extraSpecialArgs = { - username = "mandlm"; + user = "mandlm"; + userName = "Michael Mandl"; + userEmail = "mandlm@molez.net"; theme = "dark"; }; }; @@ -37,7 +39,9 @@ ]; extraSpecialArgs = { - username = "mmandl"; + user = "mmandl"; + userName = "Michael Mandl"; + userEmail = "michael.mandl@horsch.com"; theme = "dark"; }; }; diff --git a/horsch/bat.nix b/horsch/bat.nix index 4e4b56a..6583e65 100644 --- a/horsch/bat.nix +++ b/horsch/bat.nix @@ -1,7 +1,7 @@ -{ ... }: +{ theme, ... }: let - theme_name = "Solarized (dark)"; + theme_name = "Solarized (${theme})"; in { programs = { diff --git a/horsch/git.nix b/horsch/git.nix index b843736..1fb9730 100644 --- a/horsch/git.nix +++ b/horsch/git.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, userName, userEmail, ... }: { programs = { @@ -7,8 +7,8 @@ git = { enable = true; - userName = "Michael Mandl"; - userEmail = "michael.mandl@horsch.com"; + inherit userName; + inherit userEmail; signing = { key = "088ED38F036C7AF2"; diff --git a/horsch/home.nix b/horsch/home.nix index 84f0575..1364f46 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -1,8 +1,8 @@ -{ pkgs, ... }: +{ pkgs, user, ... }: { - home.username = "mmandl"; - home.homeDirectory = "/home/mmandl"; + home.username = user; + home.homeDirectory = "/home/${user}"; home.stateVersion = "24.05"; # Please read the comment before changing. diff --git a/horsch/neovim/default.nix b/horsch/neovim/default.nix index c1501e2..d144971 100644 --- a/horsch/neovim/default.nix +++ b/horsch/neovim/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, theme, ... }: let pkg_src = pkgs; in @@ -160,7 +160,7 @@ in ${builtins.readFile ./telescope.lua } ${builtins.readFile ./themes.lua } - vim.opt.background = 'dark' + vim.opt.background = '${theme}' ${builtins.readFile ./project-nvim.lua } ${builtins.readFile ./dap.lua } diff --git a/private/home.nix b/private/home.nix index b7b354c..45080d4 100644 --- a/private/home.nix +++ b/private/home.nix @@ -1,8 +1,8 @@ -{ pkgs, username, ... }: +{ pkgs, user, ... }: { - home.username = "${username}"; - home.homeDirectory = "/home/${username}"; + home.username = user; + home.homeDirectory = "/home/${user}"; home.stateVersion = "24.05"; # Please read the comment before changing. From 7b8e76860c5b9ec70612907c0d8818b14e8dab22 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 08:28:44 +0200 Subject: [PATCH 04/18] refactor: extract common config files --- horsch/bat.nix => bat.nix | 0 horsch/carapace.nix => carapace.nix | 0 horsch/direnv.nix => direnv.nix | 0 horsch/eza.nix => eza.nix | 0 private/fzf.nix => fzf.nix | 0 horsch/fzf.nix | 10 ---------- horsch/home.nix | 16 ++++++++-------- private/bat.nix | 13 ------------- private/carapace.nix | 8 -------- private/direnv.nix | 11 ----------- private/home.nix | 16 ++++++++-------- private/starship.nix | 11 ----------- private/zoxide.nix | 9 --------- horsch/ripgrep.nix => ripgrep.nix | 0 horsch/starship.nix => starship.nix | 0 horsch/zoxide.nix => zoxide.nix | 0 16 files changed, 16 insertions(+), 78 deletions(-) rename horsch/bat.nix => bat.nix (100%) rename horsch/carapace.nix => carapace.nix (100%) rename horsch/direnv.nix => direnv.nix (100%) rename horsch/eza.nix => eza.nix (100%) rename private/fzf.nix => fzf.nix (100%) delete mode 100644 horsch/fzf.nix delete mode 100644 private/bat.nix delete mode 100644 private/carapace.nix delete mode 100644 private/direnv.nix delete mode 100644 private/starship.nix delete mode 100644 private/zoxide.nix rename horsch/ripgrep.nix => ripgrep.nix (100%) rename horsch/starship.nix => starship.nix (100%) rename horsch/zoxide.nix => zoxide.nix (100%) diff --git a/horsch/bat.nix b/bat.nix similarity index 100% rename from horsch/bat.nix rename to bat.nix diff --git a/horsch/carapace.nix b/carapace.nix similarity index 100% rename from horsch/carapace.nix rename to carapace.nix diff --git a/horsch/direnv.nix b/direnv.nix similarity index 100% rename from horsch/direnv.nix rename to direnv.nix diff --git a/horsch/eza.nix b/eza.nix similarity index 100% rename from horsch/eza.nix rename to eza.nix diff --git a/private/fzf.nix b/fzf.nix similarity index 100% rename from private/fzf.nix rename to fzf.nix diff --git a/horsch/fzf.nix b/horsch/fzf.nix deleted file mode 100644 index 0e83315..0000000 --- a/horsch/fzf.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, lib, pkgs, user, ... }: - -{ - programs = { - fzf = { - enable = true; - enableZshIntegration = true; - }; - }; -} diff --git a/horsch/home.nix b/horsch/home.nix index 1364f46..0af011e 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -18,23 +18,23 @@ ]; imports = [ - ./bat.nix - ./carapace.nix - ./direnv.nix - ./eza.nix - ./fzf.nix + ../bat.nix + ../carapace.nix + ../direnv.nix + ../eza.nix + ../fzf.nix + ../ripgrep.nix + ../starship.nix + ../zoxide.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 ]; } diff --git a/private/bat.nix b/private/bat.nix deleted file mode 100644 index 6583e65..0000000 --- a/private/bat.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ theme, ... }: - -let - theme_name = "Solarized (${theme})"; -in -{ - programs = { - bat = { - enable = true; - config.theme = theme_name; - }; - }; -} diff --git a/private/carapace.nix b/private/carapace.nix deleted file mode 100644 index 2705a18..0000000 --- a/private/carapace.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - programs.carapace = { - enable = true; - enableZshIntegration = true; - }; -} - diff --git a/private/direnv.nix b/private/direnv.nix deleted file mode 100644 index 005868d..0000000 --- a/private/direnv.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: - -{ - programs = { - direnv = { - enable = true; - enableZshIntegration = true; - nix-direnv.enable = true; - }; - }; -} diff --git a/private/home.nix b/private/home.nix index 45080d4..cbef863 100644 --- a/private/home.nix +++ b/private/home.nix @@ -7,10 +7,8 @@ home.stateVersion = "24.05"; # Please read the comment before changing. home.packages = with pkgs; [ - eza jq htop - ripgrep pavucontrol gnumake unzip @@ -57,19 +55,21 @@ programs.home-manager.enable = true; imports = [ - ./bat.nix - ./carapace.nix - ./direnv.nix + ../bat.nix + ../carapace.nix + ../direnv.nix + ../eza.nix + ../fzf.nix + ../ripgrep.nix + ../starship.nix + ../zoxide.nix ./firefox.nix - ./fzf.nix ./git.nix ./gpg ./kitty.nix ./neovim ./nextcloud.nix - ./starship.nix ./sway - ./zoxide.nix ./zsh.nix ]; } diff --git a/private/starship.nix b/private/starship.nix deleted file mode 100644 index 4cdc31f..0000000 --- a/private/starship.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ lib, ... }: - -{ - programs.starship = { - enable = true; - settings = { - format = lib.concatStrings [ "$all" "$directory" "$character" ]; - hostname.format = "[$ssh_symbol$hostname]($style) "; - }; - }; -} diff --git a/private/zoxide.nix b/private/zoxide.nix deleted file mode 100644 index 435b381..0000000 --- a/private/zoxide.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - programs.zoxide = { - enable = true; - enableZshIntegration = true; - }; -} - diff --git a/horsch/ripgrep.nix b/ripgrep.nix similarity index 100% rename from horsch/ripgrep.nix rename to ripgrep.nix diff --git a/horsch/starship.nix b/starship.nix similarity index 100% rename from horsch/starship.nix rename to starship.nix diff --git a/horsch/zoxide.nix b/zoxide.nix similarity index 100% rename from horsch/zoxide.nix rename to zoxide.nix From 92369cc90b2be80f28b41e7bac3bcbc2ed6b0b9e Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:37:49 +0200 Subject: [PATCH 05/18] refactor: extract git config --- flake.nix | 2 ++ horsch/git.nix => git.nix | 4 +-- horsch/home.nix | 2 +- private/git.nix | 71 --------------------------------------- private/home.nix | 2 +- 5 files changed, 6 insertions(+), 75 deletions(-) rename horsch/git.nix => git.nix (96%) delete mode 100644 private/git.nix diff --git a/flake.nix b/flake.nix index 09c265e..c920da2 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,7 @@ user = "mandlm"; userName = "Michael Mandl"; userEmail = "mandlm@molez.net"; + userSigningKey = "4AA25D647AA54CC7"; theme = "dark"; }; }; @@ -42,6 +43,7 @@ user = "mmandl"; userName = "Michael Mandl"; userEmail = "michael.mandl@horsch.com"; + userSigningKey = "088ED38F036C7AF2"; theme = "dark"; }; }; diff --git a/horsch/git.nix b/git.nix similarity index 96% rename from horsch/git.nix rename to git.nix index 1fb9730..ebd6389 100644 --- a/horsch/git.nix +++ b/git.nix @@ -1,4 +1,4 @@ -{ pkgs, userName, userEmail, ... }: +{ pkgs, userName, userEmail, userSigningKey, ... }: { programs = { @@ -11,7 +11,7 @@ inherit userEmail; signing = { - key = "088ED38F036C7AF2"; + key = userSigningKey; signByDefault = true; }; diff --git a/horsch/home.nix b/horsch/home.nix index 0af011e..5b2eb7e 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -26,7 +26,7 @@ ../ripgrep.nix ../starship.nix ../zoxide.nix - ./git.nix + ../git.nix ./gpg ./neovim ./picocom.nix diff --git a/private/git.nix b/private/git.nix deleted file mode 100644 index da11041..0000000 --- a/private/git.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ ... }: - -{ - programs = { - git = { - enable = true; - extraConfig = { - core.editor = "nvim"; - - diff.external = "difft --background light"; - diff.tool = "difftastic"; - diff.ignoreSubmodules = "none"; - - difftool.difftastic.cmd = "difft --background light \"$LOCAL\" \"$REMOTE\""; - difftool.prompt = false; - - 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; - - user.private.email = "mandlm@molez.net"; - user.private.name = "Michael Mandl"; - user.private.signingkey = "4AA25D647AA54CC7"; - - user.swp.email = "mandl@vi-bim.de"; - user.swp.name = "Michael Mandl"; - user.swp.signingkey = "4E60F44227F611B4"; - - worktree.guessRemote = true; - }; - - aliases = { - identity = ''! git config user.name "$(git config user.$1.name)"; git config user.email "$(git config user.$1.email)"; git config user.signingkey "$(git config user.$1.signingkey)"; git config commit.gpgsign "true"; : ''; - clone-worktree = ''! mkdir $2; git clone $1 $2/.base; BRANCH=`git -C $2/.base symbolic-ref --short HEAD`; echo "branch is $BRANCH"; git -C $2/.base checkout --detach HEAD; git -C $2/.base worktree add ../$BRANCH; :''; - graph = "log --graph --all --max-count 32"; - }; - - ignores = [ - ".env" - ".direnv" - "*.swp" - ]; - }; - }; -} - diff --git a/private/home.nix b/private/home.nix index cbef863..7769b43 100644 --- a/private/home.nix +++ b/private/home.nix @@ -64,7 +64,7 @@ ../starship.nix ../zoxide.nix ./firefox.nix - ./git.nix + ../git.nix ./gpg ./kitty.nix ./neovim From bbd6c2e0ccb8e38e6c97e3b1346f63c618267433 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:38:04 +0200 Subject: [PATCH 06/18] refactor: extract wsl doc --- {horsch/docs => docs}/Setup Log WSL+Alpine.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {horsch/docs => docs}/Setup Log WSL+Alpine.md (100%) diff --git a/horsch/docs/Setup Log WSL+Alpine.md b/docs/Setup Log WSL+Alpine.md similarity index 100% rename from horsch/docs/Setup Log WSL+Alpine.md rename to docs/Setup Log WSL+Alpine.md From c0596e817eed98afb2fb7ff2b4679480f337e61a Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:41:47 +0200 Subject: [PATCH 07/18] refactor: extract tree config --- horsch/home.nix | 2 +- private/home.nix | 2 +- horsch/tree.nix => tree.nix | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename horsch/tree.nix => tree.nix (100%) diff --git a/horsch/home.nix b/horsch/home.nix index 5b2eb7e..92e3e23 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -34,7 +34,7 @@ ./rsync.nix ./shell_aliases.nix ./ssh.nix - ./tree.nix + ../tree.nix ./zsh.nix ]; } diff --git a/private/home.nix b/private/home.nix index 7769b43..893a32a 100644 --- a/private/home.nix +++ b/private/home.nix @@ -15,7 +15,6 @@ gcc thunderbird keepassxc - tree light element-desktop difftastic @@ -65,6 +64,7 @@ ../zoxide.nix ./firefox.nix ../git.nix + ../tree.nix ./gpg ./kitty.nix ./neovim diff --git a/horsch/tree.nix b/tree.nix similarity index 100% rename from horsch/tree.nix rename to tree.nix From a97d3266e114cb6430467b2f600e0b20b24f0e95 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:42:04 +0200 Subject: [PATCH 08/18] refactor: extract rsync config --- horsch/home.nix | 2 +- horsch/rsync.nix => rsync.nix | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename horsch/rsync.nix => rsync.nix (100%) diff --git a/horsch/home.nix b/horsch/home.nix index 92e3e23..5483124 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -31,7 +31,7 @@ ./neovim ./picocom.nix ./podman.nix - ./rsync.nix + ../rsync.nix ./shell_aliases.nix ./ssh.nix ../tree.nix diff --git a/horsch/rsync.nix b/rsync.nix similarity index 100% rename from horsch/rsync.nix rename to rsync.nix From a211568b7d3c782b4942396bd1ac72691e582f25 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:42:59 +0200 Subject: [PATCH 09/18] refactor: extract shell aliases --- horsch/home.nix | 2 +- private/home.nix | 1 + horsch/shell_aliases.nix => shell_aliases.nix | 0 3 files changed, 2 insertions(+), 1 deletion(-) rename horsch/shell_aliases.nix => shell_aliases.nix (100%) diff --git a/horsch/home.nix b/horsch/home.nix index 5483124..9263989 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -32,7 +32,7 @@ ./picocom.nix ./podman.nix ../rsync.nix - ./shell_aliases.nix + ../shell_aliases.nix ./ssh.nix ../tree.nix ./zsh.nix diff --git a/private/home.nix b/private/home.nix index 893a32a..05e2ac8 100644 --- a/private/home.nix +++ b/private/home.nix @@ -62,6 +62,7 @@ ../ripgrep.nix ../starship.nix ../zoxide.nix + ../shell_aliases.nix ./firefox.nix ../git.nix ../tree.nix diff --git a/horsch/shell_aliases.nix b/shell_aliases.nix similarity index 100% rename from horsch/shell_aliases.nix rename to shell_aliases.nix From 4545f0f9f24bccb1acc0edd81d8d3737a867eeb1 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:43:45 +0200 Subject: [PATCH 10/18] refactor: extract podman and picocom config --- horsch/home.nix | 4 ++-- horsch/picocom.nix => picocom.nix | 0 horsch/podman.nix => podman.nix | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename horsch/picocom.nix => picocom.nix (100%) rename horsch/podman.nix => podman.nix (100%) diff --git a/horsch/home.nix b/horsch/home.nix index 9263989..ead119d 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -29,8 +29,8 @@ ../git.nix ./gpg ./neovim - ./picocom.nix - ./podman.nix + ../picocom.nix + ../podman.nix ../rsync.nix ../shell_aliases.nix ./ssh.nix diff --git a/horsch/picocom.nix b/picocom.nix similarity index 100% rename from horsch/picocom.nix rename to picocom.nix diff --git a/horsch/podman.nix b/podman.nix similarity index 100% rename from horsch/podman.nix rename to podman.nix From 4f5cdea23f63b60d128926798185859499cc305c Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:47:17 +0200 Subject: [PATCH 11/18] refactor: extract firefox, kitty, nextcloud, xps config --- private/firefox.nix => firefox.nix | 0 flake.nix | 2 +- private/kitty.nix => kitty.nix | 0 private/nextcloud.nix => nextcloud.nix | 0 private/email.nix | 125 ------------------------- private/home.nix | 6 +- private/xps.nix => xps.nix | 0 7 files changed, 4 insertions(+), 129 deletions(-) rename private/firefox.nix => firefox.nix (100%) rename private/kitty.nix => kitty.nix (100%) rename private/nextcloud.nix => nextcloud.nix (100%) delete mode 100644 private/email.nix rename private/xps.nix => xps.nix (100%) diff --git a/private/firefox.nix b/firefox.nix similarity index 100% rename from private/firefox.nix rename to firefox.nix diff --git a/flake.nix b/flake.nix index c920da2..6fc16e2 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ modules = [ ./private/home.nix - ./private/xps.nix + ./xps.nix ]; extraSpecialArgs = { diff --git a/private/kitty.nix b/kitty.nix similarity index 100% rename from private/kitty.nix rename to kitty.nix diff --git a/private/nextcloud.nix b/nextcloud.nix similarity index 100% rename from private/nextcloud.nix rename to nextcloud.nix diff --git a/private/email.nix b/private/email.nix deleted file mode 100644 index ea5ad54..0000000 --- a/private/email.nix +++ /dev/null @@ -1,125 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - home.packages = [ pkgs.libsecret ]; - - programs.msmtp.enable = true; - programs.mbsync.enable = true; - programs.neomutt = { - enable = true; - sidebar.enable = true; - vimKeys = true; - macros = [ - { - action = "mbsync -all"; - key = "S"; - map = [ "index" ]; - } - ]; - }; - - accounts.email = { - maildirBasePath = "${config.xdg.dataHome}/mail"; - - accounts = { - molez = rec { - primary = true; - - realName = "Michael Mandl"; - address = "mandlm@molez.net"; - - userName = address; - passwordCommand = "secret-tool lookup email mandlm@molez.net"; - - imap = { - host = "mail.molez.net"; - port = 993; - tls.enable = true; - }; - - smtp = { - host = "mail.molez.net"; - port = 465; - tls.enable = true; - }; - - gpg = { - key = "0x4AA25D647AA54CC7"; - signByDefault = true; - }; - - msmtp.enable = true; - mbsync = { - enable = true; - create = "both"; - expunge = "both"; - }; - - neomutt.enable = true; - }; - swp = { - realName = "Michael Mandl"; - address = "mandl@vi-bim.de"; - - userName = "mandl"; - passwordCommand = "secret-tool lookup email mandl@vi-bim.de"; - - imap = { - host = "swpmail.softwareparadies.de"; - port = 993; - tls.enable = true; - }; - - smtp = { - host = "swpmail.softwareparadies.de"; - port = 465; - tls.enable = true; - }; - - gpg = { - key = "0x4E60F44227F611B4 "; - signByDefault = true; - }; - - signature = { - showSignature = "append"; - text = '' - -- - Mit freundlichen Grüßen - - Michael Mandl - Entwicklung - ------------------------------------------ - swp software systems GmbH & Co. KG - - Königsbrücker Straße 124 - 01099 Dresden - Tel: 0351-492850 - Fax: 0351-4928550 - www: https://www.vi-bim.de - - Kennen Sie schon unsere FAQ-Wissensdatenbank? Einfach hier klicken: - https://faq.vi-bim.de - - Unsere Datenschutzerklärung finden Sie unter https://datenschutz.vi-bim.de - - Registergericht: Amtsgericht Dresden HRA 3008 - persönlich haftender Gesellschafter: - swp Beteiligungs GmbH - Registergericht: Amtsgericht Dresden HRB 15 20 9 - Geschäftsführer: Holger Schönemann, Stefan Urlberger - ''; - }; - - msmtp.enable = true; - mbsync = { - enable = true; - create = "both"; - expunge = "both"; - }; - - neomutt.enable = true; - }; - }; - }; -} diff --git a/private/home.nix b/private/home.nix index 05e2ac8..2531589 100644 --- a/private/home.nix +++ b/private/home.nix @@ -63,13 +63,13 @@ ../starship.nix ../zoxide.nix ../shell_aliases.nix - ./firefox.nix + ../firefox.nix ../git.nix ../tree.nix ./gpg - ./kitty.nix + ../kitty.nix ./neovim - ./nextcloud.nix + ../nextcloud.nix ./sway ./zsh.nix ]; diff --git a/private/xps.nix b/xps.nix similarity index 100% rename from private/xps.nix rename to xps.nix From f73b6206cd11143d15767d0ff2c93477fdcde559 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:49:11 +0200 Subject: [PATCH 12/18] refactor: extract sway config --- horsch/home.nix | 12 ++++++------ private/home.nix | 18 +++++++++--------- {private/sway => sway}/default.nix | 0 {private/sway => sway}/dunst.nix | 0 {private/sway => sway}/i3status-rust.nix | 0 5 files changed, 15 insertions(+), 15 deletions(-) rename {private/sway => sway}/default.nix (100%) rename {private/sway => sway}/dunst.nix (100%) rename {private/sway => sway}/i3status-rust.nix (100%) diff --git a/horsch/home.nix b/horsch/home.nix index ead119d..c0c0df6 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -23,18 +23,18 @@ ../direnv.nix ../eza.nix ../fzf.nix - ../ripgrep.nix - ../starship.nix - ../zoxide.nix ../git.nix - ./gpg - ./neovim ../picocom.nix ../podman.nix + ../ripgrep.nix ../rsync.nix ../shell_aliases.nix - ./ssh.nix + ../starship.nix ../tree.nix + ../zoxide.nix + ./gpg + ./neovim + ./ssh.nix ./zsh.nix ]; } diff --git a/private/home.nix b/private/home.nix index 2531589..2c3ce9a 100644 --- a/private/home.nix +++ b/private/home.nix @@ -58,19 +58,19 @@ ../carapace.nix ../direnv.nix ../eza.nix - ../fzf.nix - ../ripgrep.nix - ../starship.nix - ../zoxide.nix - ../shell_aliases.nix ../firefox.nix + ../fzf.nix ../git.nix - ../tree.nix - ./gpg ../kitty.nix - ./neovim ../nextcloud.nix - ./sway + ../ripgrep.nix + ../shell_aliases.nix + ../starship.nix + ../sway + ../tree.nix + ../zoxide.nix + ./gpg + ./neovim ./zsh.nix ]; } diff --git a/private/sway/default.nix b/sway/default.nix similarity index 100% rename from private/sway/default.nix rename to sway/default.nix diff --git a/private/sway/dunst.nix b/sway/dunst.nix similarity index 100% rename from private/sway/dunst.nix rename to sway/dunst.nix diff --git a/private/sway/i3status-rust.nix b/sway/i3status-rust.nix similarity index 100% rename from private/sway/i3status-rust.nix rename to sway/i3status-rust.nix From 35550c608576d7debfee2f4ec7c4ef3995115da4 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:52:58 +0200 Subject: [PATCH 13/18] refactor: extract neovim config --- horsch/home.nix | 2 +- {horsch/neovim => neovim}/auto-session.lua | 0 {horsch/neovim => neovim}/commands.lua | 0 {horsch/neovim => neovim}/comment.lua | 0 {horsch/neovim => neovim}/dap.lua | 0 {horsch/neovim => neovim}/default.nix | 11 +- {horsch/neovim => neovim}/gitsigns.lua | 0 {horsch/neovim => neovim}/illuminate.lua | 0 .../neovim => neovim}/indent-blankline.lua | 0 {horsch/neovim => neovim}/keymaps.lua | 0 {horsch/neovim => neovim}/lspconfig.lua | 0 {horsch/neovim => neovim}/lualine.lua | 0 {horsch/neovim => neovim}/luasnip.lua | 0 {horsch/neovim => neovim}/neorg.lua | 0 {horsch/neovim => neovim}/notify.lua | 0 {horsch/neovim => neovim}/nvim-cmp.lua | 0 {horsch/neovim => neovim}/options.lua | 0 {horsch/neovim => neovim}/project-nvim.lua | 0 {horsch/neovim => neovim}/tabline.lua | 0 {horsch/neovim => neovim}/telescope.lua | 0 {horsch/neovim => neovim}/themes.lua | 0 {horsch/neovim => neovim}/toggleterm.lua | 0 {horsch/neovim => neovim}/treesitter.lua | 0 private/home.nix | 2 +- private/neovim/auto-session.lua | 3 - private/neovim/commands.lua | 1 - private/neovim/comment.lua | 1 - private/neovim/dap.lua | 35 ---- private/neovim/default.nix | 167 ---------------- private/neovim/gitsigns.lua | 1 - private/neovim/indent-blankline.lua | 5 - private/neovim/keymaps.lua | 69 ------- private/neovim/lspconfig.lua | 184 ------------------ private/neovim/lualine.lua | 7 - private/neovim/luasnip.lua | 1 - private/neovim/neorg.lua | 16 -- private/neovim/notify.lua | 2 - private/neovim/nvim-cmp.lua | 87 --------- private/neovim/options.lua | 61 ------ private/neovim/project-nvim.lua | 1 - private/neovim/tabline.lua | 1 - private/neovim/telescope.lua | 29 --- private/neovim/themes.lua | 1 - private/neovim/toggleterm.lua | 1 - private/neovim/treesitter.lua | 14 -- 45 files changed, 6 insertions(+), 696 deletions(-) rename {horsch/neovim => neovim}/auto-session.lua (100%) rename {horsch/neovim => neovim}/commands.lua (100%) rename {horsch/neovim => neovim}/comment.lua (100%) rename {horsch/neovim => neovim}/dap.lua (100%) rename {horsch/neovim => neovim}/default.nix (94%) rename {horsch/neovim => neovim}/gitsigns.lua (100%) rename {horsch/neovim => neovim}/illuminate.lua (100%) rename {horsch/neovim => neovim}/indent-blankline.lua (100%) rename {horsch/neovim => neovim}/keymaps.lua (100%) rename {horsch/neovim => neovim}/lspconfig.lua (100%) rename {horsch/neovim => neovim}/lualine.lua (100%) rename {horsch/neovim => neovim}/luasnip.lua (100%) rename {horsch/neovim => neovim}/neorg.lua (100%) rename {horsch/neovim => neovim}/notify.lua (100%) rename {horsch/neovim => neovim}/nvim-cmp.lua (100%) rename {horsch/neovim => neovim}/options.lua (100%) rename {horsch/neovim => neovim}/project-nvim.lua (100%) rename {horsch/neovim => neovim}/tabline.lua (100%) rename {horsch/neovim => neovim}/telescope.lua (100%) rename {horsch/neovim => neovim}/themes.lua (100%) rename {horsch/neovim => neovim}/toggleterm.lua (100%) rename {horsch/neovim => neovim}/treesitter.lua (100%) delete mode 100644 private/neovim/auto-session.lua delete mode 100644 private/neovim/commands.lua delete mode 100644 private/neovim/comment.lua delete mode 100644 private/neovim/dap.lua delete mode 100644 private/neovim/default.nix delete mode 100644 private/neovim/gitsigns.lua delete mode 100644 private/neovim/indent-blankline.lua delete mode 100644 private/neovim/keymaps.lua delete mode 100644 private/neovim/lspconfig.lua delete mode 100644 private/neovim/lualine.lua delete mode 100644 private/neovim/luasnip.lua delete mode 100644 private/neovim/neorg.lua delete mode 100644 private/neovim/notify.lua delete mode 100644 private/neovim/nvim-cmp.lua delete mode 100644 private/neovim/options.lua delete mode 100644 private/neovim/project-nvim.lua delete mode 100644 private/neovim/tabline.lua delete mode 100644 private/neovim/telescope.lua delete mode 100644 private/neovim/themes.lua delete mode 100644 private/neovim/toggleterm.lua delete mode 100644 private/neovim/treesitter.lua diff --git a/horsch/home.nix b/horsch/home.nix index c0c0df6..7fc5243 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -24,6 +24,7 @@ ../eza.nix ../fzf.nix ../git.nix + ../neovim ../picocom.nix ../podman.nix ../ripgrep.nix @@ -33,7 +34,6 @@ ../tree.nix ../zoxide.nix ./gpg - ./neovim ./ssh.nix ./zsh.nix ]; diff --git a/horsch/neovim/auto-session.lua b/neovim/auto-session.lua similarity index 100% rename from horsch/neovim/auto-session.lua rename to neovim/auto-session.lua diff --git a/horsch/neovim/commands.lua b/neovim/commands.lua similarity index 100% rename from horsch/neovim/commands.lua rename to neovim/commands.lua diff --git a/horsch/neovim/comment.lua b/neovim/comment.lua similarity index 100% rename from horsch/neovim/comment.lua rename to neovim/comment.lua diff --git a/horsch/neovim/dap.lua b/neovim/dap.lua similarity index 100% rename from horsch/neovim/dap.lua rename to neovim/dap.lua diff --git a/horsch/neovim/default.nix b/neovim/default.nix similarity index 94% rename from horsch/neovim/default.nix rename to neovim/default.nix index d144971..77082d5 100644 --- a/horsch/neovim/default.nix +++ b/neovim/default.nix @@ -1,18 +1,15 @@ { pkgs, theme, ... }: -let - pkg_src = pkgs; -in { # symlink for a stable path - home.file.".vscode-extensions/vscode-lldb".source = pkg_src.vscode-extensions.vadimcn.vscode-lldb; + home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb; programs = { neovim = { enable = true; - package = pkg_src.neovim-unwrapped; + package = pkgs.neovim-unwrapped; defaultEditor = true; - plugins = with pkg_src.vimPlugins; [ + plugins = with pkgs.vimPlugins; [ # theme nvim-solarized-lua @@ -93,7 +90,7 @@ in withNodeJs = true; - extraPackages = with pkg_src; [ + extraPackages = with pkgs; [ # language servers lua-language-server terraform-ls diff --git a/horsch/neovim/gitsigns.lua b/neovim/gitsigns.lua similarity index 100% rename from horsch/neovim/gitsigns.lua rename to neovim/gitsigns.lua diff --git a/horsch/neovim/illuminate.lua b/neovim/illuminate.lua similarity index 100% rename from horsch/neovim/illuminate.lua rename to neovim/illuminate.lua diff --git a/horsch/neovim/indent-blankline.lua b/neovim/indent-blankline.lua similarity index 100% rename from horsch/neovim/indent-blankline.lua rename to neovim/indent-blankline.lua diff --git a/horsch/neovim/keymaps.lua b/neovim/keymaps.lua similarity index 100% rename from horsch/neovim/keymaps.lua rename to neovim/keymaps.lua diff --git a/horsch/neovim/lspconfig.lua b/neovim/lspconfig.lua similarity index 100% rename from horsch/neovim/lspconfig.lua rename to neovim/lspconfig.lua diff --git a/horsch/neovim/lualine.lua b/neovim/lualine.lua similarity index 100% rename from horsch/neovim/lualine.lua rename to neovim/lualine.lua diff --git a/horsch/neovim/luasnip.lua b/neovim/luasnip.lua similarity index 100% rename from horsch/neovim/luasnip.lua rename to neovim/luasnip.lua diff --git a/horsch/neovim/neorg.lua b/neovim/neorg.lua similarity index 100% rename from horsch/neovim/neorg.lua rename to neovim/neorg.lua diff --git a/horsch/neovim/notify.lua b/neovim/notify.lua similarity index 100% rename from horsch/neovim/notify.lua rename to neovim/notify.lua diff --git a/horsch/neovim/nvim-cmp.lua b/neovim/nvim-cmp.lua similarity index 100% rename from horsch/neovim/nvim-cmp.lua rename to neovim/nvim-cmp.lua diff --git a/horsch/neovim/options.lua b/neovim/options.lua similarity index 100% rename from horsch/neovim/options.lua rename to neovim/options.lua diff --git a/horsch/neovim/project-nvim.lua b/neovim/project-nvim.lua similarity index 100% rename from horsch/neovim/project-nvim.lua rename to neovim/project-nvim.lua diff --git a/horsch/neovim/tabline.lua b/neovim/tabline.lua similarity index 100% rename from horsch/neovim/tabline.lua rename to neovim/tabline.lua diff --git a/horsch/neovim/telescope.lua b/neovim/telescope.lua similarity index 100% rename from horsch/neovim/telescope.lua rename to neovim/telescope.lua diff --git a/horsch/neovim/themes.lua b/neovim/themes.lua similarity index 100% rename from horsch/neovim/themes.lua rename to neovim/themes.lua diff --git a/horsch/neovim/toggleterm.lua b/neovim/toggleterm.lua similarity index 100% rename from horsch/neovim/toggleterm.lua rename to neovim/toggleterm.lua diff --git a/horsch/neovim/treesitter.lua b/neovim/treesitter.lua similarity index 100% rename from horsch/neovim/treesitter.lua rename to neovim/treesitter.lua diff --git a/private/home.nix b/private/home.nix index 2c3ce9a..a55d592 100644 --- a/private/home.nix +++ b/private/home.nix @@ -62,6 +62,7 @@ ../fzf.nix ../git.nix ../kitty.nix + ../neovim ../nextcloud.nix ../ripgrep.nix ../shell_aliases.nix @@ -70,7 +71,6 @@ ../tree.nix ../zoxide.nix ./gpg - ./neovim ./zsh.nix ]; } diff --git a/private/neovim/auto-session.lua b/private/neovim/auto-session.lua deleted file mode 100644 index a3dc5d9..0000000 --- a/private/neovim/auto-session.lua +++ /dev/null @@ -1,3 +0,0 @@ -require("auto-session").setup { - log_level = "error", -} diff --git a/private/neovim/commands.lua b/private/neovim/commands.lua deleted file mode 100644 index 10e03a5..0000000 --- a/private/neovim/commands.lua +++ /dev/null @@ -1 +0,0 @@ -vim.api.nvim_create_user_command("BufOnly", "%bd|e#|bd#", {}) diff --git a/private/neovim/comment.lua b/private/neovim/comment.lua deleted file mode 100644 index 5060319..0000000 --- a/private/neovim/comment.lua +++ /dev/null @@ -1 +0,0 @@ -require('Comment').setup({}) diff --git a/private/neovim/dap.lua b/private/neovim/dap.lua deleted file mode 100644 index d491267..0000000 --- a/private/neovim/dap.lua +++ /dev/null @@ -1,35 +0,0 @@ -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", "", dap.continue, { noremap = true, silent = true }) -vim.keymap.set("n", "", dap.toggle_breakpoint, { noremap = true, silent = true }) -vim.keymap.set("n", "", dap.step_over, { noremap = true, silent = true }) -vim.keymap.set("n", "", dap.step_into, { noremap = true, silent = true }) - -vim.keymap.set("n", "", dap.step_out, { noremap = true, silent = true }) -vim.keymap.set("n", "", dap.step_out, { noremap = true, silent = true }) -- in kitty - -vim.keymap.set("n", "", 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 diff --git a/private/neovim/default.nix b/private/neovim/default.nix deleted file mode 100644 index 0026390..0000000 --- a/private/neovim/default.nix +++ /dev/null @@ -1,167 +0,0 @@ -{ pkgs, theme, ... }: - -{ - - # symlink for a stable path - home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb; - - programs = { - neovim = { - enable = true; - package = pkgs.neovim-unwrapped; - defaultEditor = true; - plugins = with pkgs.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 - 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 pkgs; [ - # language servers - lua-language-server - terraform-ls - tflint - bash-language-server - nodePackages.dockerfile-language-server-nodejs - nodePackages.eslint_d - nodePackages.prettier - nodePackages.typescript - nodePackages.typescript-language-server - nodePackages.vscode-langservers-extracted - nodePackages.yaml-language-server - lldb - vscode-extensions.vadimcn.vscode-lldb - marksman - clang-tools - cmake-language-server - texlab - nixd - nixpkgs-fmt - ]; - - 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 = '${theme}' - - ${builtins.readFile ./project-nvim.lua } - ${builtins.readFile ./dap.lua } - ${builtins.readFile ./neorg.lua } - - vim.g.gitblame_date_format = "%r" - - -- setup illuminate highlight groups - vim.api.nvim_set_hl(0, "IlluminatedWordText", { bold = true }) - vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "IlluminatedWordText" }) - vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "IlluminatedWordText" }) - EOF - ''; - }; - }; -} - - diff --git a/private/neovim/gitsigns.lua b/private/neovim/gitsigns.lua deleted file mode 100644 index 91fa65b..0000000 --- a/private/neovim/gitsigns.lua +++ /dev/null @@ -1 +0,0 @@ -require('gitsigns').setup() diff --git a/private/neovim/indent-blankline.lua b/private/neovim/indent-blankline.lua deleted file mode 100644 index d7e7b6c..0000000 --- a/private/neovim/indent-blankline.lua +++ /dev/null @@ -1,5 +0,0 @@ -require("ibl").setup { - indent = { - char = "┊", - }, -} diff --git a/private/neovim/keymaps.lua b/private/neovim/keymaps.lua deleted file mode 100644 index 721631d..0000000 --- a/private/neovim/keymaps.lua +++ /dev/null @@ -1,69 +0,0 @@ -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("", ":wincmd h") -nnoremap("", ":wincmd j") -nnoremap("", ":wincmd k") -nnoremap("", ":wincmd l") - --- Switch buffers -nnoremap("", ":TablineBufferNext") -nnoremap("", ":TablineBufferPrevious") - --- fugitive -nnoremap("g", ":0Git") - --- vim-flog -nnoremap("G", ":Flog -all -date=relative -open-cmd=new") - --- 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("ff", telescope.find_files) -map_telescope("fb", telescope.buffers) -map_telescope("fg", telescope.git_files) -map_telescope("fp", telescope_projects.projects) -map_telescope("fs", telescope.lsp_document_symbols) -map_telescope("fS", telescope.lsp_dynamic_workspace_symbols) -map_telescope("", telescope.grep_string) -map_telescope("", 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', '', [[]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[h]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[j]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[k]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[l]], opts) - end, - desc = "Map terminal esc and window switch keys", -}) - --- buffer closing -nnoremap("gq", ":Bdelete") - --- toggle search highlighting -vim.cmd('nnoremap * v:hlsearch ? ":nohlsearch" : "*"') - --- insert-map jj/jk to escape -require("better_escape").setup() diff --git a/private/neovim/lspconfig.lua b/private/neovim/lspconfig.lua deleted file mode 100644 index bda96da..0000000 --- a/private/neovim/lspconfig.lua +++ /dev/null @@ -1,184 +0,0 @@ -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("rn", vim.lsp.buf.rename) - nnoremap("ca", vim.lsp.buf.code_action) - nnoremap("f", format_buffer) - nnoremap("d", telescope.diagnostics) - nnoremap("D", require("lsp_lines").toggle) - nnoremap("", vim.diagnostic.goto_prev) - nnoremap("", vim.diagnostic.goto_next) - - 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"] = {}, - ["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, - }, - }, - }, - ["marksman"] = {}, - ["nixd"] = {}, - ["pylsp"] = { - pylsp = { - plugins = { - pycodestyle = { - maxLineLength = 120 - } - } - } - }, - ["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 = "always", - 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, -}) diff --git a/private/neovim/lualine.lua b/private/neovim/lualine.lua deleted file mode 100644 index 982987a..0000000 --- a/private/neovim/lualine.lua +++ /dev/null @@ -1,7 +0,0 @@ -require('lualine').setup({ - options = { globalstatus = true }, - sections = { - lualine_c = { { "filename", path = 1 }, "require('lsp-status').status()" } - }, - extensions = { "toggleterm" } -}) diff --git a/private/neovim/luasnip.lua b/private/neovim/luasnip.lua deleted file mode 100644 index 80309d7..0000000 --- a/private/neovim/luasnip.lua +++ /dev/null @@ -1 +0,0 @@ -require("luasnip.loaders.from_vscode").lazy_load() diff --git a/private/neovim/neorg.lua b/private/neovim/neorg.lua deleted file mode 100644 index eb9fe84..0000000 --- a/private/neovim/neorg.lua +++ /dev/null @@ -1,16 +0,0 @@ -local neorg = require("neorg") - -neorg.setup({ - load = { - ["core.defaults"] = {}, - ["core.concealer"] = {}, - ["core.dirman"] = { - config = { - workspaces = { - notes = "~/notes", - }, - default_workspace = "notes", - }, - }, - } -}) diff --git a/private/neovim/notify.lua b/private/neovim/notify.lua deleted file mode 100644 index 6fd7a22..0000000 --- a/private/neovim/notify.lua +++ /dev/null @@ -1,2 +0,0 @@ -require("notify").setup({ stages = "fade" }) -vim.notify = require("notify") diff --git a/private/neovim/nvim-cmp.lua b/private/neovim/nvim-cmp.lua deleted file mode 100644 index 7b0f78b..0000000 --- a/private/neovim/nvim-cmp.lua +++ /dev/null @@ -1,87 +0,0 @@ -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({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete({}), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = 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" }), - [""] = 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" } - ) -}) diff --git a/private/neovim/options.lua b/private/neovim/options.lua deleted file mode 100644 index 5d9aa53..0000000 --- a/private/neovim/options.lua +++ /dev/null @@ -1,61 +0,0 @@ --- termguicolors -vim.opt.termguicolors = true - --- line numbers -vim.opt.number = true - --- tabwidth -vim.opt.tabstop = 4 -vim.opt.shiftwidth = 4 - --- 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 -]]) diff --git a/private/neovim/project-nvim.lua b/private/neovim/project-nvim.lua deleted file mode 100644 index 3b5902f..0000000 --- a/private/neovim/project-nvim.lua +++ /dev/null @@ -1 +0,0 @@ -require('project_nvim').setup({}) diff --git a/private/neovim/tabline.lua b/private/neovim/tabline.lua deleted file mode 100644 index 74da8bb..0000000 --- a/private/neovim/tabline.lua +++ /dev/null @@ -1 +0,0 @@ -require('tabline').setup({ enable = true, options = { show_bufnr = true, show_filename_only = true } }) diff --git a/private/neovim/telescope.lua b/private/neovim/telescope.lua deleted file mode 100644 index 2bb00cd..0000000 --- a/private/neovim/telescope.lua +++ /dev/null @@ -1,29 +0,0 @@ -local telescope = require("telescope") -local actions = require("telescope.actions") -local themes = require("telescope.themes") - -telescope.setup({ - defaults = { - mappings = { - i = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - [""] = actions.close, - [""] = actions.close - }, - n = { - [""] = actions.close, - [""] = actions.close - } - } - }, - extensions = { - ["ui-select"] = { - themes.get_dropdown({}) - }, - } -}) - -telescope.load_extension("fzf") -telescope.load_extension("ui-select") -telescope.load_extension("projects") diff --git a/private/neovim/themes.lua b/private/neovim/themes.lua deleted file mode 100644 index 8d0b48e..0000000 --- a/private/neovim/themes.lua +++ /dev/null @@ -1 +0,0 @@ -vim.cmd("colorscheme solarized") diff --git a/private/neovim/toggleterm.lua b/private/neovim/toggleterm.lua deleted file mode 100644 index 37cbe4c..0000000 --- a/private/neovim/toggleterm.lua +++ /dev/null @@ -1 +0,0 @@ -require("toggleterm").setup({ size = 32, open_mapping = [[]] }) diff --git a/private/neovim/treesitter.lua b/private/neovim/treesitter.lua deleted file mode 100644 index eca7e14..0000000 --- a/private/neovim/treesitter.lua +++ /dev/null @@ -1,14 +0,0 @@ -require('nvim-treesitter.configs').setup({ - highlight = { - enable = true, - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "v", - node_decremental = "<", - node_incremental = ">", - scope_incremental = false, - }, - }, -}) From 8f1ca25dba2260cbd5f8026a0542b3c0fe7f4bcf Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 12:58:04 +0200 Subject: [PATCH 14/18] refactor: extract gpg config --- flake.nix | 6 +- git.nix | 4 +- {horsch/gpg => gpg}/default.nix | 6 +- {horsch/gpg => gpg}/horsch.pub.asc | 0 {horsch/gpg => gpg}/molez.pub.asc | 0 {horsch/gpg => gpg}/vi-bim.pub.asc | 0 horsch/home.nix | 2 +- private/gpg/default.nix | 21 ------- private/gpg/pubring.asc | 99 ------------------------------ private/home.nix | 2 +- 10 files changed, 10 insertions(+), 130 deletions(-) rename {horsch/gpg => gpg}/default.nix (89%) rename {horsch/gpg => gpg}/horsch.pub.asc (100%) rename {horsch/gpg => gpg}/molez.pub.asc (100%) rename {horsch/gpg => gpg}/vi-bim.pub.asc (100%) delete mode 100644 private/gpg/default.nix delete mode 100644 private/gpg/pubring.asc diff --git a/flake.nix b/flake.nix index 6fc16e2..b9eb1ff 100644 --- a/flake.nix +++ b/flake.nix @@ -28,7 +28,8 @@ user = "mandlm"; userName = "Michael Mandl"; userEmail = "mandlm@molez.net"; - userSigningKey = "4AA25D647AA54CC7"; + gpgSigningKey = "4AA25D647AA54CC7"; + gpgSSHKeys = [ "1F937AC8F77ED74CE24EAAE79B5601F73C6D115F" ]; theme = "dark"; }; }; @@ -43,7 +44,8 @@ user = "mmandl"; userName = "Michael Mandl"; userEmail = "michael.mandl@horsch.com"; - userSigningKey = "088ED38F036C7AF2"; + gpgSigningKey = "088ED38F036C7AF2"; + gpgSSHKeys = [ "AEB2BF3FF9CF9529E9A3C6F1A202D21686FF9278" ]; theme = "dark"; }; }; diff --git a/git.nix b/git.nix index ebd6389..739bf02 100644 --- a/git.nix +++ b/git.nix @@ -1,4 +1,4 @@ -{ pkgs, userName, userEmail, userSigningKey, ... }: +{ pkgs, userName, userEmail, gpgSigningKey, ... }: { programs = { @@ -11,7 +11,7 @@ inherit userEmail; signing = { - key = userSigningKey; + key = gpgSigningKey; signByDefault = true; }; diff --git a/horsch/gpg/default.nix b/gpg/default.nix similarity index 89% rename from horsch/gpg/default.nix rename to gpg/default.nix index 9adcf94..4a3069c 100644 --- a/horsch/gpg/default.nix +++ b/gpg/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, gpgSSHKeys, ... }: { services.gpg-agent = { @@ -6,9 +6,7 @@ enableZshIntegration = true; pinentryPackage = pkgs.pinentry-curses; enableSshSupport = true; - sshKeys = [ - "AEB2BF3FF9CF9529E9A3C6F1A202D21686FF9278" - ]; + sshKeys = gpgSSHKeys; defaultCacheTtl = 3600 * 12; defaultCacheTtlSsh = 3600 * 12; maxCacheTtl = 3600 * 12; diff --git a/horsch/gpg/horsch.pub.asc b/gpg/horsch.pub.asc similarity index 100% rename from horsch/gpg/horsch.pub.asc rename to gpg/horsch.pub.asc diff --git a/horsch/gpg/molez.pub.asc b/gpg/molez.pub.asc similarity index 100% rename from horsch/gpg/molez.pub.asc rename to gpg/molez.pub.asc diff --git a/horsch/gpg/vi-bim.pub.asc b/gpg/vi-bim.pub.asc similarity index 100% rename from horsch/gpg/vi-bim.pub.asc rename to gpg/vi-bim.pub.asc diff --git a/horsch/home.nix b/horsch/home.nix index 7fc5243..535176f 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -24,6 +24,7 @@ ../eza.nix ../fzf.nix ../git.nix + ../gpg ../neovim ../picocom.nix ../podman.nix @@ -33,7 +34,6 @@ ../starship.nix ../tree.nix ../zoxide.nix - ./gpg ./ssh.nix ./zsh.nix ]; diff --git a/private/gpg/default.nix b/private/gpg/default.nix deleted file mode 100644 index fcd5f77..0000000 --- a/private/gpg/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs, ... }: - -{ - services.gpg-agent = { - enable = true; - enableZshIntegration = true; - pinentryPackage = pkgs.pinentry-gnome3; - enableSshSupport = true; - sshKeys = [ "1F937AC8F77ED74CE24EAAE79B5601F73C6D115F" ]; - }; - - programs.gpg = { - enable = true; - mutableKeys = true; - mutableTrust = true; - publicKeys = [{ - source = ./pubring.asc; - trust = "ultimate"; - }]; - }; -} diff --git a/private/gpg/pubring.asc b/private/gpg/pubring.asc deleted file mode 100644 index 02bccb3..0000000 --- a/private/gpg/pubring.asc +++ /dev/null @@ -1,99 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- - -mQINBF75iDUBEADKT7HJf29rKofixOegZt6C4fDWhgJuVa/tT/9CxBewpGuvt2an -JM9eTO2ZUWjcbYc4zNsMppANKyr0+i9tve7f+hA5sXDbUNXXjxJz0tu2L3qToTqK -fkvpy4D5dFQYB/N+9n1JKouXNcZKmoTzH9ur6gxmDTdrKcOzjsJQvFjg/nf3jLzT -kj1REcCFxCqXQBVbnWObnaM/+2coofA11XO8KcA/qyVf2014Vj+LCtg8cYUWwOGn -1nomHkJpqAD1k1wYfiEq+2wwgYP9Qvb1WhHzfpRmLT6C1RR9gqnWdNhkRPNrEXOV -2lIAdKg0JJ2jZaOvblGfSA5ObndgwjCMu+0eE5bwSTYAXKwFoZC8/q78t1q2Wrgt -s9+zUWFQiTltXtGhtwiaZLEmkj8Dlg3C3EltaJAOX06AkVQiGY/DUfFL5uVXDSyE -2MBBFKk92ekGdFN6Vh1psw4lxQBUg/aGXA7zf+DR8UBQkGklDJPw0QbD15OEOsG0 -e1JbAa/rHt2w9a/Cn3Mzk18S0nwJXNmGk55Nm2TC5jNnP/COI6Pn2EE9t6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0YJKKK8gV4hTYp1bc4fVDIgyfUmunFFA+LDwC09YbWSi9XJ7VveYD3T+l+qx -Brq7XvOXTd3E6F31Q+U+cU95YFCRUL3yVl+U4hpHdOB0K4gORNlUKhFNfzz1iyUS -tDXut79lup1kknfC4Fm3oJQFELMbnorkbnxp2HZnSjP2+yY9riV9vrCmN7+YihZC -iL8jv/hUCyjfKBN5Qa14 -=dpaN ------END PGP PUBLIC KEY BLOCK----- diff --git a/private/home.nix b/private/home.nix index a55d592..700d018 100644 --- a/private/home.nix +++ b/private/home.nix @@ -61,6 +61,7 @@ ../firefox.nix ../fzf.nix ../git.nix + ../gpg ../kitty.nix ../neovim ../nextcloud.nix @@ -70,7 +71,6 @@ ../sway ../tree.nix ../zoxide.nix - ./gpg ./zsh.nix ]; } From 55af25ccb32bb63d51e0f3fe799c726d7026b059 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 13:06:26 +0200 Subject: [PATCH 15/18] refactor: extract zsh config --- horsch/home.nix | 1 + horsch/zsh.nix | 97 ++++++++++++++++---------------------- private/home.nix | 2 +- private/zsh.nix => zsh.nix | 10 ++-- 4 files changed, 47 insertions(+), 63 deletions(-) rename private/zsh.nix => zsh.nix (78%) diff --git a/horsch/home.nix b/horsch/home.nix index 535176f..e51921f 100644 --- a/horsch/home.nix +++ b/horsch/home.nix @@ -34,6 +34,7 @@ ../starship.nix ../tree.nix ../zoxide.nix + ../zsh.nix ./ssh.nix ./zsh.nix ]; diff --git a/horsch/zsh.nix b/horsch/zsh.nix index 5588dff..d3919cc 100644 --- a/horsch/zsh.nix +++ b/horsch/zsh.nix @@ -1,68 +1,53 @@ { ... }: { - programs.zsh = { - enable = true; - enableCompletion = true; - history.size = 10000; + programs.zsh.initExtra = '' + if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ]; + then + source $HOME/.nix-profile/etc/profile.d/nix.sh + fi - autosuggestion = { - enable = true; - highlight = "fg=10"; - }; + function sc-log { + ssh smartcan "SYSTEMD_COLORS=true journalctl --follow --no-tail --unit smartcan-''${1:-*}" + } - syntaxHighlighting = { - enable = true; - }; + function sc-restart { + ssh smartcan "systemctl restart smartcan-''${1}" + } - initExtra = '' - if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ]; - then - source $HOME/.nix-profile/etc/profile.d/nix.sh + 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 - function sc-log { - ssh smartcan "SYSTEMD_COLORS=true journalctl --follow --no-tail --unit smartcan-''${1:-*}" - } + if [ ! -f ''${update_file} ]; then + echo "file \"''${update_file}\" does not exist" + return 2 + fi - function sc-restart { - ssh smartcan "systemctl restart smartcan-''${1}" - } + echo "flashing ''${update_file} to device..." + cat "''${update_file}" | ssh ''${ssh_login} "swupdate-client -" - function fu-reboot { - ssh fusion "reboot" - } + if [ $? -ne 0 ]; then + echo "update failed" + return 3 + fi - function fu-flash { - local ssh_login="fusion" - local update_file=''${1} + echo "rebooting device" + ssh ''${ssh_login} reboot - 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." - } - ''; - }; + echo "done." + } + ''; } diff --git a/private/home.nix b/private/home.nix index 700d018..bf61c77 100644 --- a/private/home.nix +++ b/private/home.nix @@ -71,6 +71,6 @@ ../sway ../tree.nix ../zoxide.nix - ./zsh.nix + ../zsh.nix ]; } diff --git a/private/zsh.nix b/zsh.nix similarity index 78% rename from private/zsh.nix rename to zsh.nix index e95a159..f451771 100644 --- a/private/zsh.nix +++ b/zsh.nix @@ -13,6 +13,10 @@ in highlight = zsh_autosuggest_highlight_style; }; + syntaxHighlighting = { + enable = true; + }; + initExtra = '' function set_win_title(){ local TITLE=$(git config --get remote.origin.url || echo "$PWD") @@ -21,11 +25,5 @@ in precmd_functions+=(set_win_title) ''; - - shellAliases = { - ls = "eza --group-directories-first --git"; - neovide = "neovide --multigrid"; - xclip = "xclip -selection clipboard"; - }; }; } From f6f01771ab91097aa0a521d62cca5803756af439 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 13:09:24 +0200 Subject: [PATCH 16/18] refactor: extract home configs --- flake.nix | 4 ++-- horsch/home.nix => horsch.nix | 37 +++++++++++++++++---------------- private/home.nix => private.nix | 36 ++++++++++++++++---------------- 3 files changed, 39 insertions(+), 38 deletions(-) rename horsch/home.nix => horsch.nix (54%) rename private/home.nix => private.nix (78%) diff --git a/flake.nix b/flake.nix index b9eb1ff..5ca8177 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ inherit pkgs; modules = [ - ./private/home.nix + ./private.nix ./xps.nix ]; @@ -37,7 +37,7 @@ inherit pkgs; modules = [ - ./horsch/home.nix + ./horsch.nix ]; extraSpecialArgs = { diff --git a/horsch/home.nix b/horsch.nix similarity index 54% rename from horsch/home.nix rename to horsch.nix index e51921f..4ae54de 100644 --- a/horsch/home.nix +++ b/horsch.nix @@ -18,24 +18,25 @@ ]; 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 - ../starship.nix - ../tree.nix - ../zoxide.nix - ../zsh.nix - ./ssh.nix + ./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 + ./starship.nix + ./tree.nix + ./zoxide.nix ./zsh.nix + + ./horsch/ssh.nix + ./horsch/zsh.nix ]; } diff --git a/private/home.nix b/private.nix similarity index 78% rename from private/home.nix rename to private.nix index bf61c77..20c5ecd 100644 --- a/private/home.nix +++ b/private.nix @@ -54,23 +54,23 @@ programs.home-manager.enable = true; imports = [ - ../bat.nix - ../carapace.nix - ../direnv.nix - ../eza.nix - ../firefox.nix - ../fzf.nix - ../git.nix - ../gpg - ../kitty.nix - ../neovim - ../nextcloud.nix - ../ripgrep.nix - ../shell_aliases.nix - ../starship.nix - ../sway - ../tree.nix - ../zoxide.nix - ../zsh.nix + ./bat.nix + ./carapace.nix + ./direnv.nix + ./eza.nix + ./firefox.nix + ./fzf.nix + ./git.nix + ./gpg + ./kitty.nix + ./neovim + ./nextcloud.nix + ./ripgrep.nix + ./shell_aliases.nix + ./starship.nix + ./sway + ./tree.nix + ./zoxide.nix + ./zsh.nix ]; } From c2afb2c5d1c8f779c0ef52abf3f687cd34a6df1e Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 13:21:28 +0200 Subject: [PATCH 17/18] refactor: extract shell setup --- flake.nix | 8 +++++ git.nix => git/default.nix | 0 horsch.nix | 19 ---------- neovim/default.nix | 1 - private.nix | 38 -------------------- bat.nix => shell/bat.nix | 0 carapace.nix => shell/carapace.nix | 0 shell/default.nix | 25 +++++++++++++ direnv.nix => shell/direnv.nix | 0 eza.nix => shell/eza.nix | 0 fzf.nix => shell/fzf.nix | 0 ripgrep.nix => shell/ripgrep.nix | 0 rsync.nix => shell/rsync.nix | 0 shell_aliases.nix => shell/shell_aliases.nix | 0 starship.nix => shell/starship.nix | 0 tree.nix => shell/tree.nix | 0 zoxide.nix => shell/zoxide.nix | 0 zsh.nix => shell/zsh.nix | 0 18 files changed, 33 insertions(+), 58 deletions(-) rename git.nix => git/default.nix (100%) rename bat.nix => shell/bat.nix (100%) rename carapace.nix => shell/carapace.nix (100%) create mode 100644 shell/default.nix rename direnv.nix => shell/direnv.nix (100%) rename eza.nix => shell/eza.nix (100%) rename fzf.nix => shell/fzf.nix (100%) rename ripgrep.nix => shell/ripgrep.nix (100%) rename rsync.nix => shell/rsync.nix (100%) rename shell_aliases.nix => shell/shell_aliases.nix (100%) rename starship.nix => shell/starship.nix (100%) rename tree.nix => shell/tree.nix (100%) rename zoxide.nix => shell/zoxide.nix (100%) rename zsh.nix => shell/zsh.nix (100%) diff --git a/flake.nix b/flake.nix index 5ca8177..76c916e 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,10 @@ inherit pkgs; modules = [ + ./shell + ./git + ./gpg + ./neovim ./private.nix ./xps.nix ]; @@ -37,6 +41,10 @@ inherit pkgs; modules = [ + ./shell + ./git + ./gpg + ./neovim ./horsch.nix ]; diff --git a/git.nix b/git/default.nix similarity index 100% rename from git.nix rename to git/default.nix diff --git a/horsch.nix b/horsch.nix index 4ae54de..68a3050 100644 --- a/horsch.nix +++ b/horsch.nix @@ -6,10 +6,6 @@ home.stateVersion = "24.05"; # Please read the comment before changing. - home.sessionVariables = { - EDITOR = "nvim"; - }; - programs.home-manager.enable = true; home.packages = with pkgs; [ @@ -18,23 +14,8 @@ ]; 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 - ./starship.nix - ./tree.nix - ./zoxide.nix - ./zsh.nix ./horsch/ssh.nix ./horsch/zsh.nix diff --git a/neovim/default.nix b/neovim/default.nix index 77082d5..69a51eb 100644 --- a/neovim/default.nix +++ b/neovim/default.nix @@ -1,6 +1,5 @@ { pkgs, theme, ... }: { - # symlink for a stable path home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb; diff --git a/private.nix b/private.nix index 20c5ecd..0194cc4 100644 --- a/private.nix +++ b/private.nix @@ -7,17 +7,13 @@ home.stateVersion = "24.05"; # Please read the comment before changing. home.packages = with pkgs; [ - jq - htop pavucontrol gnumake - unzip gcc thunderbird keepassxc light element-desktop - difftastic darktable kubectl kubectx @@ -27,50 +23,16 @@ gthumb gimp evince - screen inkscape chromium - xclip ]; - # Home Manager can also manage your environment variables through - # 'home.sessionVariables'. These will be explicitly sourced when using a - # shell provided by Home Manager. If you don't want to manage your shell - # through Home Manager then you have to manually source 'hm-session-vars.sh' - # located at either - # - # ~/.nix-profile/etc/profile.d/hm-session-vars.sh - # - # or - # - # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh - # - # or - # - # /etc/profiles/per-user/mandlm/etc/profile.d/hm-session-vars.sh - # - home.sessionVariables = { }; - programs.home-manager.enable = true; imports = [ - ./bat.nix - ./carapace.nix - ./direnv.nix - ./eza.nix ./firefox.nix - ./fzf.nix - ./git.nix - ./gpg ./kitty.nix - ./neovim ./nextcloud.nix - ./ripgrep.nix - ./shell_aliases.nix - ./starship.nix ./sway - ./tree.nix - ./zoxide.nix - ./zsh.nix ]; } diff --git a/bat.nix b/shell/bat.nix similarity index 100% rename from bat.nix rename to shell/bat.nix diff --git a/carapace.nix b/shell/carapace.nix similarity index 100% rename from carapace.nix rename to shell/carapace.nix diff --git a/shell/default.nix b/shell/default.nix new file mode 100644 index 0000000..575337c --- /dev/null +++ b/shell/default.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + difftastic + htop + jq + unzip + xclip + ]; + + imports = [ + ./bat.nix + ./carapace.nix + ./direnv.nix + ./eza.nix + ./fzf.nix + ./ripgrep.nix + ./rsync.nix + ./shell_aliases.nix + ./starship.nix + ./tree.nix + ./zoxide.nix + ./zsh.nix + ]; +} diff --git a/direnv.nix b/shell/direnv.nix similarity index 100% rename from direnv.nix rename to shell/direnv.nix diff --git a/eza.nix b/shell/eza.nix similarity index 100% rename from eza.nix rename to shell/eza.nix diff --git a/fzf.nix b/shell/fzf.nix similarity index 100% rename from fzf.nix rename to shell/fzf.nix diff --git a/ripgrep.nix b/shell/ripgrep.nix similarity index 100% rename from ripgrep.nix rename to shell/ripgrep.nix diff --git a/rsync.nix b/shell/rsync.nix similarity index 100% rename from rsync.nix rename to shell/rsync.nix diff --git a/shell_aliases.nix b/shell/shell_aliases.nix similarity index 100% rename from shell_aliases.nix rename to shell/shell_aliases.nix diff --git a/starship.nix b/shell/starship.nix similarity index 100% rename from starship.nix rename to shell/starship.nix diff --git a/tree.nix b/shell/tree.nix similarity index 100% rename from tree.nix rename to shell/tree.nix diff --git a/zoxide.nix b/shell/zoxide.nix similarity index 100% rename from zoxide.nix rename to shell/zoxide.nix diff --git a/zsh.nix b/shell/zsh.nix similarity index 100% rename from zsh.nix rename to shell/zsh.nix From a13a15cbd982813a452f044d056ec07249d9cb8d Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 10 Jul 2024 13:40:41 +0200 Subject: [PATCH 18/18] feat: enable pre-commit checks --- .envrc | 8 ++++++++ .gitignore | 1 - .nix/flake.lock | 25 +++++++++++++++++++++++++ .nix/flake.nix | 32 ++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 27 +++++++++++++++++++++++++++ README.md | 1 - git/default.nix | 15 +++++++-------- horsch/ssh.nix | 1 - horsch/zsh.nix | 14 +++++++------- neovim/default.nix | 10 ++++------ shell/carapace.nix | 1 - shell/zoxide.nix | 1 - 12 files changed, 110 insertions(+), 26 deletions(-) create mode 100644 .envrc create mode 100644 .nix/flake.lock create mode 100644 .nix/flake.nix create mode 100644 .pre-commit-config.yaml diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..a8d08c3 --- /dev/null +++ b/.envrc @@ -0,0 +1,8 @@ +use flake .nix + +if on_git_branch; then + echo + git status --short --branch + echo + git fetch +fi diff --git a/.gitignore b/.gitignore index a806510..3357b94 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ # Ignore build outputs from performing a nix-build or `nix build` command result result-* - diff --git a/.nix/flake.lock b/.nix/flake.lock new file mode 100644 index 0000000..f09af8e --- /dev/null +++ b/.nix/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1720418205, + "narHash": "sha256-cPJoFPXU44GlhWg4pUk9oUPqurPlCFZ11ZQPk21GTPU=", + "rev": "655a58a72a6601292512670343087c2d75d859c1", + "revCount": 650378, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.650378%2Brev-655a58a72a6601292512670343087c2d75d859c1/019095fe-96b2-7a7c-ad7c-2131b3fb6fa7/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/.nix/flake.nix b/.nix/flake.nix new file mode 100644 index 0000000..0cbe327 --- /dev/null +++ b/.nix/flake.nix @@ -0,0 +1,32 @@ +{ + description = "A flake editing flake"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + + outputs = { nixpkgs, ... }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell.override + { + # Override stdenv in order to change compiler: + # stdenv = pkgs.clangStdenv; + } + { + packages = with pkgs; [ + pre-commit + commitizen + ]; + + shellHook = '' + pre-commit install --allow-missing-config --hook-type pre-commit --hook-type commit-msg + ''; + }; + }); + }; +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..87f991d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,27 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: detect-private-key + - id: mixed-line-ending + + - repo: https://github.com/commitizen-tools/commitizen + rev: v3.27.0 + hooks: + - id: commitizen + stages: [commit-msg] + + - repo: local + hooks: + - id: home-manager-check + name: Home Manager Config Check + entry: home-manager switch --dry-run + language: system + pass_filenames: false + exclude: ^docs/ diff --git a/README.md b/README.md index 6a6da41..c8292c9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ # home-manager - diff --git a/git/default.nix b/git/default.nix index 739bf02..8f2e90f 100644 --- a/git/default.nix +++ b/git/default.nix @@ -82,7 +82,7 @@ uri=''${1} dir=''${2} - if [[ -z ''${dir} ]]; then + if [[ -z ''${dir} ]]; then dir=''$(basename ''${1} .git) fi @@ -102,17 +102,17 @@ '') (writeShellScriptBin "git-make-relative" '' - + gitfile=''${1} - if [[ -z ''${gitfile} ]]; then + if [[ -z ''${gitfile} ]]; then gitfile=".git" - fi + fi - if [[ ! -f ''${gitfile} ]]; then + if [[ ! -f ''${gitfile} ]]; then echo "file ''${gitfile} does not exist" - exit 1 - fi + exit 1 + fi gitdir=$(grep "gitdir:" ''${gitfile} | cut -d: -f2 | xargs) rel_gitdir=$(realpath -s --relative-to=. ''${gitdir}) @@ -123,4 +123,3 @@ '') ]; } - diff --git a/horsch/ssh.nix b/horsch/ssh.nix index 50a07a7..7890487 100644 --- a/horsch/ssh.nix +++ b/horsch/ssh.nix @@ -62,4 +62,3 @@ }; }; } - diff --git a/horsch/zsh.nix b/horsch/zsh.nix index d3919cc..768828f 100644 --- a/horsch/zsh.nix +++ b/horsch/zsh.nix @@ -2,8 +2,8 @@ { programs.zsh.initExtra = '' if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ]; - then - source $HOME/.nix-profile/etc/profile.d/nix.sh + then + source $HOME/.nix-profile/etc/profile.d/nix.sh fi function sc-log { @@ -24,16 +24,16 @@ if [ -z ''${update_file} ]; then update_file=$(find build/tmp/deploy/images -name "*.swu" -type f | fzf --select-1) - fi + fi if [ -z ''${update_file} ]; then - echo "no file selected" - return 1 + echo "no file selected" + return 1 fi if [ ! -f ''${update_file} ]; then - echo "file \"''${update_file}\" does not exist" - return 2 + echo "file \"''${update_file}\" does not exist" + return 2 fi echo "flashing ''${update_file} to device..." diff --git a/neovim/default.nix b/neovim/default.nix index 69a51eb..a52092c 100644 --- a/neovim/default.nix +++ b/neovim/default.nix @@ -1,6 +1,6 @@ { pkgs, theme, ... }: { - # symlink for a stable path + # symlink for a stable path home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb; programs = { @@ -16,14 +16,14 @@ vim-bbye ansible-vim - # ui + # ui dressing-nvim # session handling project-nvim auto-session - # escape handling + # escape handling better-escape-nvim nvim-treesitter.withAllGrammars @@ -82,7 +82,7 @@ nvim-dap nvim-dap-ui - # neorg + # neorg neorg neorg-telescope ]; @@ -169,5 +169,3 @@ }; }; } - - diff --git a/shell/carapace.nix b/shell/carapace.nix index 2705a18..3b137ec 100644 --- a/shell/carapace.nix +++ b/shell/carapace.nix @@ -5,4 +5,3 @@ enableZshIntegration = true; }; } - diff --git a/shell/zoxide.nix b/shell/zoxide.nix index 435b381..043ffeb 100644 --- a/shell/zoxide.nix +++ b/shell/zoxide.nix @@ -6,4 +6,3 @@ enableZshIntegration = true; }; } -