diff --git a/bat.nix b/bat.nix new file mode 100644 index 0000000..6583e65 --- /dev/null +++ b/bat.nix @@ -0,0 +1,13 @@ +{ theme, ... }: + +let + theme_name = "Solarized (${theme})"; +in +{ + programs = { + bat = { + enable = true; + config.theme = theme_name; + }; + }; +} diff --git a/carapace.nix b/carapace.nix new file mode 100644 index 0000000..2705a18 --- /dev/null +++ b/carapace.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + programs.carapace = { + enable = true; + enableZshIntegration = true; + }; +} + diff --git a/direnv.nix b/direnv.nix new file mode 100644 index 0000000..005868d --- /dev/null +++ b/direnv.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + programs = { + direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; + }; + }; +} diff --git a/email.nix b/email.nix new file mode 100644 index 0000000..ea5ad54 --- /dev/null +++ b/email.nix @@ -0,0 +1,125 @@ +{ 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/firefox.nix b/firefox.nix new file mode 100644 index 0000000..e71220b --- /dev/null +++ b/firefox.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs = { + firefox = { + enable = true; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c0a6b3b --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720327769, + "narHash": "sha256-kAsg3Lg4YKKpGw+f1W2s5hzjP8B0y/juowvjK8utIag=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6b7ce96f34b324e4e104abc30d06955d216bac71", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1720418205, + "narHash": "sha256-cPJoFPXU44GlhWg4pUk9oUPqurPlCFZ11ZQPk21GTPU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "655a58a72a6601292512670343087c2d75d859c1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 067acb8..3bfe5d2 100644 --- a/flake.nix +++ b/flake.nix @@ -1,8 +1,7 @@ { - description = "Home Manager configuration of mandlm"; + description = "Home Manager configuration"; inputs = { - # Specify the source of Home Manager and Nixpkgs. nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { url = "github:nix-community/home-manager"; @@ -14,16 +13,22 @@ let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; - in { - homeConfigurations."mandlm" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; + in + { + homeConfigurations = { + "mandlm@xps" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ ./home.nix ]; + modules = [ + ./home.nix + ./xps.nix + ]; - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix + extraSpecialArgs = { + username = "mandlm"; + theme = "dark"; + }; + }; }; }; } diff --git a/fzf.nix b/fzf.nix new file mode 100644 index 0000000..cce4b1a --- /dev/null +++ b/fzf.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + programs = { + fzf = { + enable = true; + enableZshIntegration = true; + }; + }; +} diff --git a/git.nix b/git.nix new file mode 100644 index 0000000..da11041 --- /dev/null +++ b/git.nix @@ -0,0 +1,71 @@ +{ ... }: + +{ + 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/gpg/default.nix b/gpg/default.nix new file mode 100644 index 0000000..fcd5f77 --- /dev/null +++ b/gpg/default.nix @@ -0,0 +1,21 @@ +{ 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/gpg/pubring.asc b/gpg/pubring.asc new file mode 100644 index 0000000..02bccb3 --- /dev/null +++ b/gpg/pubring.asc @@ -0,0 +1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yagH5yr8HuKjyAgQ8tCCE +1sQ13BGvEwFhGLkAEQEAAYkCPAQYAQgAJhYhBKf8D/dvmnmqWd0vKU5g9EIn9hG0 +BQJe+YShAhsMBQkJZgGAAAoJEE5g9EIn9hG0rgQQAILF/S4BypQZvK806L/Nr0LU +pyYBSrVQbdRLI0axDxAJ4wTyJJCB2wbgmQ8nnPJt42fzXq0bcOTFnIiZ5J6vXMou +dZ74/ZkRMhpluB869nP2hFcBJbbKsPf+6raEvMNRwcRk7Knep0wCuHw87t7xo7QK +Zs1oBpJDqdJ8StocSotw8d7Nd2FZ7pU3qPGiOqbg8th/UDgYhqeM2jLOFHJ5FN5t +JbcNWPcG2sDQPtd2u8RAoXTmoHBYa/07CrOhmFfUxE0yoOJxLZgVJNgzfmMX+Q6l +4IjnRfpQmH5PINncJmWN/FB//MRDRtTjHdI9UAyyXOHdnaquT7SfwQXE8SHKInsd +XcDAKNqRzNOG/92FOsbbhgRx2kyrhDdJRsh4zgV2OsNwBkY6wWUMM632PpIBauJN +yAFNm1Xle81CCxO43APDVnfpxC2nkkoHwy6vJlF3S4DwRTbCPLMonMMyY43pRZnR +Kumv0YJKKK8gV4hTYp1bc4fVDIgyfUmunFFA+LDwC09YbWSi9XJ7VveYD3T+l+qx +Brq7XvOXTd3E6F31Q+U+cU95YFCRUL3yVl+U4hpHdOB0K4gORNlUKhFNfzz1iyUS +tDXut79lup1kknfC4Fm3oJQFELMbnorkbnxp2HZnSjP2+yY9riV9vrCmN7+YihZC +iL8jv/hUCyjfKBN5Qa14 +=dpaN +-----END PGP PUBLIC KEY BLOCK----- diff --git a/home.nix b/home.nix index 8175994..b7b354c 100644 --- a/home.nix +++ b/home.nix @@ -1,56 +1,41 @@ -{ config, pkgs, ... }: +{ pkgs, username, ... }: { - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = "mandlm"; - home.homeDirectory = "/home/mandlm"; + home.username = "${username}"; + home.homeDirectory = "/home/${username}"; - # This value determines the Home Manager release that your configuration is - # compatible with. This helps avoid breakage when a new Home Manager release - # introduces backwards incompatible changes. - # - # You should not change this value, even if you update Home Manager. If you do - # want to update the value, then make sure to first check the Home Manager - # release notes. home.stateVersion = "24.05"; # Please read the comment before changing. - # The home.packages option allows you to install Nix packages into your - # environment. - home.packages = [ - # # Adds the 'hello' command to your environment. It prints a friendly - # # "Hello, world!" when run. - # pkgs.hello - - # # It is sometimes useful to fine-tune packages, for example, by applying - # # overrides. You can do that directly here, just don't forget the - # # parentheses. Maybe you want to install Nerd Fonts with a limited number of - # # fonts? - # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) - - # # You can also create simple shell scripts directly inside your - # # configuration. For example, this adds a command 'my-hello' to your - # # environment: - # (pkgs.writeShellScriptBin "my-hello" '' - # echo "Hello, ${config.home.username}!" - # '') + home.packages = with pkgs; [ + eza + jq + htop + ripgrep + pavucontrol + gnumake + unzip + gcc + thunderbird + keepassxc + tree + light + element-desktop + difftastic + darktable + kubectl + kubectx + simple-scan + calibre + libreoffice + gthumb + gimp + evince + screen + inkscape + chromium + xclip ]; - # Home Manager is pretty good at managing dotfiles. The primary way to manage - # plain files is through 'home.file'. - home.file = { - # # Building this configuration will create a copy of 'dotfiles/screenrc' in - # # the Nix store. Activating the configuration will then make '~/.screenrc' a - # # symlink to the Nix store copy. - # ".screenrc".source = dotfiles/screenrc; - - # # You can also set the file content immediately. - # ".gradle/gradle.properties".text = '' - # org.gradle.console=verbose - # org.gradle.daemon.idletimeout=3600000 - # ''; - }; - # 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 @@ -67,10 +52,24 @@ # # /etc/profiles/per-user/mandlm/etc/profile.d/hm-session-vars.sh # - home.sessionVariables = { - # EDITOR = "emacs"; - }; + home.sessionVariables = { }; - # Let Home Manager install and manage itself. programs.home-manager.enable = true; + + imports = [ + ./bat.nix + ./carapace.nix + ./direnv.nix + ./firefox.nix + ./fzf.nix + ./git.nix + ./gpg + ./kitty.nix + ./neovim + ./nextcloud.nix + ./starship.nix + ./sway + ./zoxide.nix + ./zsh.nix + ]; } diff --git a/kitty.nix b/kitty.nix new file mode 100644 index 0000000..372d237 --- /dev/null +++ b/kitty.nix @@ -0,0 +1,19 @@ +{ theme, ... }: + +let + theme_name = if theme == "light" then "Solarized Light" else "Solarized Dark"; +in +{ + programs = { + kitty = { + enable = true; + theme = theme_name; + font = { + name = "FiraCode"; + }; + settings = { + tab_bar_style = "powerline"; + }; + }; + }; +} diff --git a/neovim/auto-session.lua b/neovim/auto-session.lua new file mode 100644 index 0000000..a3dc5d9 --- /dev/null +++ b/neovim/auto-session.lua @@ -0,0 +1,3 @@ +require("auto-session").setup { + log_level = "error", +} diff --git a/neovim/commands.lua b/neovim/commands.lua new file mode 100644 index 0000000..10e03a5 --- /dev/null +++ b/neovim/commands.lua @@ -0,0 +1 @@ +vim.api.nvim_create_user_command("BufOnly", "%bd|e#|bd#", {}) diff --git a/neovim/comment.lua b/neovim/comment.lua new file mode 100644 index 0000000..5060319 --- /dev/null +++ b/neovim/comment.lua @@ -0,0 +1 @@ +require('Comment').setup({}) diff --git a/neovim/dap.lua b/neovim/dap.lua new file mode 100644 index 0000000..d491267 --- /dev/null +++ b/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/neovim/default.nix b/neovim/default.nix new file mode 100644 index 0000000..0026390 --- /dev/null +++ b/neovim/default.nix @@ -0,0 +1,167 @@ +{ 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/neovim/gitsigns.lua b/neovim/gitsigns.lua new file mode 100644 index 0000000..91fa65b --- /dev/null +++ b/neovim/gitsigns.lua @@ -0,0 +1 @@ +require('gitsigns').setup() diff --git a/neovim/indent-blankline.lua b/neovim/indent-blankline.lua new file mode 100644 index 0000000..d7e7b6c --- /dev/null +++ b/neovim/indent-blankline.lua @@ -0,0 +1,5 @@ +require("ibl").setup { + indent = { + char = "┊", + }, +} diff --git a/neovim/keymaps.lua b/neovim/keymaps.lua new file mode 100644 index 0000000..721631d --- /dev/null +++ b/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/neovim/lspconfig.lua b/neovim/lspconfig.lua new file mode 100644 index 0000000..bda96da --- /dev/null +++ b/neovim/lspconfig.lua @@ -0,0 +1,184 @@ +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/neovim/lualine.lua b/neovim/lualine.lua new file mode 100644 index 0000000..982987a --- /dev/null +++ b/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/neovim/luasnip.lua b/neovim/luasnip.lua new file mode 100644 index 0000000..80309d7 --- /dev/null +++ b/neovim/luasnip.lua @@ -0,0 +1 @@ +require("luasnip.loaders.from_vscode").lazy_load() diff --git a/neovim/neorg.lua b/neovim/neorg.lua new file mode 100644 index 0000000..eb9fe84 --- /dev/null +++ b/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/neovim/notify.lua b/neovim/notify.lua new file mode 100644 index 0000000..6fd7a22 --- /dev/null +++ b/neovim/notify.lua @@ -0,0 +1,2 @@ +require("notify").setup({ stages = "fade" }) +vim.notify = require("notify") diff --git a/neovim/nvim-cmp.lua b/neovim/nvim-cmp.lua new file mode 100644 index 0000000..7b0f78b --- /dev/null +++ b/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/neovim/options.lua b/neovim/options.lua new file mode 100644 index 0000000..5d9aa53 --- /dev/null +++ b/neovim/options.lua @@ -0,0 +1,61 @@ +-- 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/neovim/project-nvim.lua b/neovim/project-nvim.lua new file mode 100644 index 0000000..3b5902f --- /dev/null +++ b/neovim/project-nvim.lua @@ -0,0 +1 @@ +require('project_nvim').setup({}) diff --git a/neovim/tabline.lua b/neovim/tabline.lua new file mode 100644 index 0000000..74da8bb --- /dev/null +++ b/neovim/tabline.lua @@ -0,0 +1 @@ +require('tabline').setup({ enable = true, options = { show_bufnr = true, show_filename_only = true } }) diff --git a/neovim/telescope.lua b/neovim/telescope.lua new file mode 100644 index 0000000..2bb00cd --- /dev/null +++ b/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/neovim/themes.lua b/neovim/themes.lua new file mode 100644 index 0000000..8d0b48e --- /dev/null +++ b/neovim/themes.lua @@ -0,0 +1 @@ +vim.cmd("colorscheme solarized") diff --git a/neovim/toggleterm.lua b/neovim/toggleterm.lua new file mode 100644 index 0000000..37cbe4c --- /dev/null +++ b/neovim/toggleterm.lua @@ -0,0 +1 @@ +require("toggleterm").setup({ size = 32, open_mapping = [[]] }) diff --git a/neovim/treesitter.lua b/neovim/treesitter.lua new file mode 100644 index 0000000..eca7e14 --- /dev/null +++ b/neovim/treesitter.lua @@ -0,0 +1,14 @@ +require('nvim-treesitter.configs').setup({ + highlight = { + enable = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "v", + node_decremental = "<", + node_incremental = ">", + scope_incremental = false, + }, + }, +}) diff --git a/nextcloud.nix b/nextcloud.nix new file mode 100644 index 0000000..af8e4de --- /dev/null +++ b/nextcloud.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + services.nextcloud-client = { + enable = true; + startInBackground = true; + }; +} diff --git a/starship.nix b/starship.nix new file mode 100644 index 0000000..4cdc31f --- /dev/null +++ b/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/sway/default.nix b/sway/default.nix new file mode 100644 index 0000000..f583d3d --- /dev/null +++ b/sway/default.nix @@ -0,0 +1,146 @@ +{ config, lib, pkgs, ... }: +let + font.name = "DejaVu Sans Mono"; + font.size = 12.0; + lock_command = "${pkgs.swaylock-effects}/bin/swaylock --daemonize --screenshots --effect-blur 8x2 --ignore-empty-password --show-failed-attempts"; + swaymsg = "${pkgs.sway}/bin/swaymsg"; +in +{ + imports = [ + ./i3status-rust.nix + ./dunst.nix + ]; + + home.packages = with pkgs; [ + xdg-utils + shotman + wl-clipboard + ]; + + programs.fuzzel = { + enable = true; + settings = { + main = { + terminal = "${pkgs.kitty}/bin/kitty"; + layer = "overlay"; + font = "DejaVu Sans Mono:size=12"; + }; + colors = { + background = "002b36ff"; + border = "ffffffaa"; + }; + }; + }; + + programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + }; + + home.pointerCursor = { + name = "Adwaita"; + package = pkgs.adwaita-icon-theme; + size = 24; + x11 = { + enable = true; + defaultCursor = "Adwaita"; + }; + }; + + services.swayidle = { + enable = true; + events = [ + { event = "before-sleep"; command = lock_command; } + ]; + timeouts = [ + { timeout = 900; command = "${swaymsg} output '*' power off"; resumeCommand = "${swaymsg} output '*' power on"; } + { timeout = 1000; command = lock_command; } + ]; + }; + + services.swayosd.enable = true; + + services.poweralertd.enable = true; + + wayland.windowManager.sway = { + enable = true; + + config = { + window = { + border = 0; + titlebar = false; + }; + + modifier = "Mod4"; + terminal = "${pkgs.kitty}/bin/kitty"; + + input = { + "type:keyboard" = { + xkb_layout = "de"; + xkb_variant = "nodeadkeys"; + xkb_options = "caps:escape"; + }; + "type:touchpad" = { + natural_scroll = "enabled"; + tap = "enabled"; + accel_profile = "flat"; + dwt = "enabled"; + }; + }; + + seat = { + "*" = { + hide_cursor = "5000"; + }; + + }; + + defaultWorkspace = "1"; + + focus.newWindow = "urgent"; + + fonts = { + names = [ font.name ]; + size = font.size; + }; + + bars = [{ + mode = "hide"; + position = "top"; + statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml"; + + fonts = { + names = [ font.name ]; + size = font.size; + }; + }]; + + menu = "${pkgs.fuzzel}/bin/fuzzel"; + + keybindings = + let + modifier = config.wayland.windowManager.sway.config.modifier; + in + lib.mkOptionDefault { + "${modifier}+Shift+s" = "exec shotman --capture region --copy"; + "${modifier}+l" = "exec ${lock_command}"; + "${modifier}+Shift+m" = "output '*' power off, output '*' power on, exec ${pkgs.kanshi}/bin/kanshictl reload"; + + "--release Caps_Lock" = "exec swayosd --caps-lock"; + + "XF86AudioRaiseVolume" = "exec swayosd --output-volume raise"; + "XF86AudioLowerVolume" = "exec swayosd --output-volume lower"; + "XF86AudioMute" = "exec swayosd --output-volume mute-toggle"; + "XF86AudioMicMute" = "exec swayosd --input-volume mute-toggle"; + }; + + startup = [ + { command = "keepassxc"; } + { command = "kitty"; } + { command = "element-desktop"; } + { command = "thunderbird"; } + { command = "firefox"; } + ]; + }; + }; +} diff --git a/sway/dunst.nix b/sway/dunst.nix new file mode 100644 index 0000000..b441973 --- /dev/null +++ b/sway/dunst.nix @@ -0,0 +1,34 @@ +{ ... }: +{ + services.dunst = { + enable = true; + settings = { + global = { + follow = "keyboard"; + font = "DejaVu Sans Mono 11"; + frame_width = 1; + }; + + urgency_low = { + frame_color = "#268bd2"; + foreground = "#eee8d5"; + background = "#002b36"; + timeout = 4; + }; + + urgency_normal = { + frame_color = "#859900"; + foreground = "#eee8d5"; + background = "#002b36"; + timeout = 6; + }; + + urgency_critical = { + frame_color = "#dc322f"; + foreground = "#eee8d5"; + background = "#002b36"; + timeout = 8; + }; + }; + }; +} diff --git a/sway/i3status-rust.nix b/sway/i3status-rust.nix new file mode 100644 index 0000000..5f696ef --- /dev/null +++ b/sway/i3status-rust.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: + +{ + programs.i3status-rust = { + enable = true; + bars = { + default = { + theme = "solarized-dark"; + icons = "awesome6"; + + blocks = [ + { + block = "net"; + format = " $icon { ($ssid) |}"; + click = [{ + button = "left"; + cmd = "${pkgs.iwgtk}/bin/iwgtk"; + }]; + } + { + block = "battery"; + missing_format = ""; + format = " $icon {($time h) |}$percentage "; + } + { + block = "time"; + interval = 60; + format = " $icon $timestamp.datetime(f:'%a %d.%m %R') "; + } + ]; + }; + }; + }; +} diff --git a/xps.nix b/xps.nix new file mode 100644 index 0000000..91b9f27 --- /dev/null +++ b/xps.nix @@ -0,0 +1,62 @@ +{ ... }: + +{ + services.kanshi = { + enable = true; + + settings = [ + { + profile = { + name = "undocked"; + outputs = [ + { + criteria = "eDP-1"; + scale = 1.3; + status = "enable"; + } + ]; + }; + } + { + profile = { + name = "home_office"; + outputs = [ + { + criteria = "Acer Technologies Acer PE270K 0x0027A130"; + mode = "3840x2160"; + scale = 1.75; + status = "enable"; + position = "0,0"; + transform = "normal"; + } + { + criteria = "Acer Technologies Acer PE270K 0x0027A150"; + mode = "3840x2160"; + scale = 1.75; + status = "enable"; + position = "2194,0"; + transform = "normal"; + } + { + criteria = "eDP-1"; + status = "disable"; + } + ]; + exec = '' + exec swaymsg workspace 0, move workspace to output '"Acer Technologies Acer PE270K 0x0027A130"' + exec swaymsg workspace 8, move workspace to output '"Acer Technologies Acer PE270K 0x0027A130"' + exec swaymsg workspace 6, move workspace to output '"Acer Technologies Acer PE270K 0x0027A130"' + exec swaymsg workspace 4, move workspace to output '"Acer Technologies Acer PE270K 0x0027A130"' + exec swaymsg workspace 2, move workspace to output '"Acer Technologies Acer PE270K 0x0027A130"' + + exec swaymsg workspace 9, move workspace to output '"Acer Technologies Acer PE270K 0x0027A150"' + exec swaymsg workspace 7, move workspace to output '"Acer Technologies Acer PE270K 0x0027A150"' + exec swaymsg workspace 5, move workspace to output '"Acer Technologies Acer PE270K 0x0027A150"' + exec swaymsg workspace 3, move workspace to output '"Acer Technologies Acer PE270K 0x0027A150"' + exec swaymsg workspace 1, move workspace to output '"Acer Technologies Acer PE270K 0x0027A150"' + ''; + }; + } + ]; + }; +} diff --git a/zoxide.nix b/zoxide.nix new file mode 100644 index 0000000..435b381 --- /dev/null +++ b/zoxide.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs.zoxide = { + enable = true; + enableZshIntegration = true; + }; +} + diff --git a/zsh.nix b/zsh.nix new file mode 100644 index 0000000..e95a159 --- /dev/null +++ b/zsh.nix @@ -0,0 +1,31 @@ +{ theme, ... }: +let + zsh_autosuggest_highlight_style = if theme == "light" then "fg=180" else "fg=10"; +in +{ + programs.zsh = { + enable = true; + enableCompletion = true; + history.size = 10000; + + autosuggestion = { + enable = true; + highlight = zsh_autosuggest_highlight_style; + }; + + initExtra = '' + function set_win_title(){ + local TITLE=$(git config --get remote.origin.url || echo "$PWD") + echo -ne "\033]0; $(basename "$TITLE") \007" + } + + precmd_functions+=(set_win_title) + ''; + + shellAliases = { + ls = "eza --group-directories-first --git"; + neovide = "neovide --multigrid"; + xclip = "xclip -selection clipboard"; + }; + }; +}