From cfaef26e8718916adcc68fbfb63b15f2389b2cd2 Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Fri, 6 Oct 2023 23:10:55 +0200 Subject: move all the files --- .emacs | 146 -------- .gitmodules | 10 +- configuration.nix | 154 -------- drduh/installer | 1 + drduh/signed.txt | 20 ++ drduh/yubikey-installer.nix | 171 +++++++++ emacs/init.el | 154 -------- email/gmail.nix | 118 ------- email/mailsync.nix | 34 -- email/neomutt.nix | 198 ----------- email/notmuch.nix | 22 -- flake.lock | 36 +- flake.nix | 37 +- home.nix | 243 ------------- home/codeium.nix | 58 --- home/dwm | 1 - home/dwmblocks | 1 - home/kak-lsp.toml | 428 ----------------------- home/kakoune.nix | 35 -- home/meta.nix | 8 - home/mpv.nix | 47 --- home/neovim.nix | 104 ------ home/newsboat.nix | 83 ----- home/packages.nix | 90 ----- home/st | 1 - home/suckless.nix | 73 ---- home/zathura.nix | 27 -- installer | 1 - lemptop.nix | 39 --- lib/default.nix | 4 + machines/lemptop.nix | 39 +++ modules/nix.nix | 1 - mut/bin/checkout | 69 ++++ mut/bin/compile | 40 +++ mut/bin/filter-ansi | 2 + mut/bin/get-sshables | 7 + mut/bin/kakup | 100 ++++++ mut/bin/kubeconfig-merge | 3 + mut/bin/lfub | 24 ++ mut/bin/linkhandler | 26 ++ mut/bin/mailsync | 112 ++++++ mut/bin/maimpick | 18 + mut/bin/news | 5 + mut/bin/nixup | 94 +++++ mut/bin/notmuch-hook | 17 + mut/bin/openfile | 10 + mut/bin/pass-ansible-vault-client | 17 + mut/bin/sb-battery | 37 ++ mut/bin/sb-clock | 29 ++ mut/bin/sb-internet | 26 ++ mut/bin/sb-mailbox | 20 ++ mut/bin/sb-nettraf | 29 ++ mut/bin/sb-news | 17 + mut/bin/set-bg | 15 + mut/bin/spectrwmbar | 59 ++++ mut/bin/sysact | 21 ++ mut/bin/terragrunt | 94 +++++ mut/bin/tmux-normal-mode | 28 ++ mut/bin/transadd | 9 + mut/emacs/init.el | 181 ++++++++++ mut/neovim/README.md | 2 + mut/neovim/compiler/ansible-lint.vim | 11 + mut/neovim/compiler/go-test.vim | 14 + mut/neovim/compiler/helm.vim | 14 + mut/neovim/compiler/racket.vim | 26 ++ mut/neovim/compiler/terragrunt.vim | 21 ++ mut/neovim/debug | 8 + mut/neovim/fnl/conf/diagnostic.fnl | 16 + mut/neovim/fnl/conf/events.fnl | 32 ++ mut/neovim/fnl/conf/filetype.fnl | 44 +++ mut/neovim/fnl/conf/init.fnl | 172 +++++++++ mut/neovim/fnl/conf/lsp.fnl | 75 ++++ mut/neovim/fnl/conf/macros.fnl | 45 +++ mut/neovim/fnl/conf/newtab/init.fnl | 36 ++ mut/neovim/fnl/conf/nix-develop/init.fnl | 122 +++++++ mut/neovim/fnl/conf/pkgs.fnl | 15 + mut/neovim/fnl/conf/pkgs/cmp.fnl | 114 ++++++ mut/neovim/fnl/conf/pkgs/conjure.fnl | 17 + mut/neovim/fnl/conf/pkgs/dap.fnl | 78 +++++ mut/neovim/fnl/conf/pkgs/gitsigns.fnl | 2 + mut/neovim/fnl/conf/pkgs/harpoon.fnl | 39 +++ mut/neovim/fnl/conf/pkgs/heirline.fnl | 241 +++++++++++++ mut/neovim/fnl/conf/pkgs/lsp_lines.fnl | 2 + mut/neovim/fnl/conf/pkgs/lsp_signature.fnl | 3 + mut/neovim/fnl/conf/pkgs/lspconfig.fnl | 51 +++ mut/neovim/fnl/conf/pkgs/neotest.fnl | 4 + mut/neovim/fnl/conf/pkgs/noice.fnl | 34 ++ mut/neovim/fnl/conf/pkgs/null-ls.fnl | 21 ++ mut/neovim/fnl/conf/pkgs/test.fnl | 9 + mut/neovim/fnl/conf/pkgs/tree-sitter-context.fnl | 2 + mut/neovim/fnl/conf/pkgs/treesitter.fnl | 2 + mut/neovim/fnl/conf/pkgs/venn.fnl | 18 + mut/neovim/fnl/conf/settings.fnl | 69 ++++ mut/neovim/fnl/conf/wict-nvim/builder.fnl | 99 ++++++ mut/neovim/fnl/conf/wict-nvim/effects.fnl | 81 +++++ mut/neovim/fnl/conf/wict-nvim/frames/frame.fnl | 61 ++++ mut/neovim/fnl/conf/wict-nvim/frames/vec.fnl | 28 ++ mut/neovim/fnl/conf/wict-nvim/init.fnl | 31 ++ mut/neovim/fnl/conf/wictl-nvim/init.fnl | 58 +++ mut/neovim/fnl/conf/wictl-nvim/resolvers.fnl | 5 + mut/neovim/fnl/conf/wictl-nvim/term.fnl | 54 +++ mut/neovim/init.fnl | 36 ++ mut/neovim/init.lua | 46 +++ mut/neovim/test.py | 0 neovim/README.md | 2 - neovim/compiler/ansible-lint.vim | 11 - neovim/compiler/go-test.vim | 14 - neovim/compiler/helm.vim | 14 - neovim/compiler/racket.vim | 26 -- neovim/compiler/terragrunt.vim | 21 -- neovim/debug | 8 - neovim/fnl/conf/diagnostic.fnl | 16 - neovim/fnl/conf/events.fnl | 32 -- neovim/fnl/conf/filetype.fnl | 44 --- neovim/fnl/conf/init.fnl | 172 --------- neovim/fnl/conf/lsp.fnl | 75 ---- neovim/fnl/conf/macros.fnl | 45 --- neovim/fnl/conf/newtab/init.fnl | 36 -- neovim/fnl/conf/nix-develop/init.fnl | 122 ------- neovim/fnl/conf/pkgs.fnl | 15 - neovim/fnl/conf/pkgs/cmp.fnl | 114 ------ neovim/fnl/conf/pkgs/conjure.fnl | 17 - neovim/fnl/conf/pkgs/dap.fnl | 78 ----- neovim/fnl/conf/pkgs/gitsigns.fnl | 2 - neovim/fnl/conf/pkgs/harpoon.fnl | 39 --- neovim/fnl/conf/pkgs/heirline.fnl | 241 ------------- neovim/fnl/conf/pkgs/lsp_lines.fnl | 2 - neovim/fnl/conf/pkgs/lsp_signature.fnl | 3 - neovim/fnl/conf/pkgs/lspconfig.fnl | 51 --- neovim/fnl/conf/pkgs/neotest.fnl | 4 - neovim/fnl/conf/pkgs/noice.fnl | 34 -- neovim/fnl/conf/pkgs/null-ls.fnl | 21 -- neovim/fnl/conf/pkgs/test.fnl | 9 - neovim/fnl/conf/pkgs/tree-sitter-context.fnl | 2 - neovim/fnl/conf/pkgs/treesitter.fnl | 2 - neovim/fnl/conf/pkgs/venn.fnl | 18 - neovim/fnl/conf/settings.fnl | 69 ---- neovim/fnl/conf/wict-nvim/builder.fnl | 99 ------ neovim/fnl/conf/wict-nvim/effects.fnl | 81 ----- neovim/fnl/conf/wict-nvim/frames/frame.fnl | 61 ---- neovim/fnl/conf/wict-nvim/frames/vec.fnl | 28 -- neovim/fnl/conf/wict-nvim/init.fnl | 31 -- neovim/fnl/conf/wictl-nvim/init.fnl | 58 --- neovim/fnl/conf/wictl-nvim/resolvers.fnl | 5 - neovim/fnl/conf/wictl-nvim/term.fnl | 54 --- neovim/init.fnl | 36 -- neovim/init.lua | 46 --- neovim/test.py | 0 overlays/#vimPlugins.nix# | 53 --- overlays/.#vimPlugins.nix | 1 - overlays/vimPlugins.nix | 1 + profiles/core/configuration.nix | 154 ++++++++ profiles/core/hm.nix | 24 ++ profiles/core/home.nix | 242 +++++++++++++ profiles/email/gmail.nix | 118 +++++++ profiles/email/mailsync.nix | 34 ++ profiles/email/neomutt.nix | 198 +++++++++++ profiles/email/notmuch.nix | 22 ++ profiles/nix.nix | 1 + profiles/station/codeium.nix | 58 +++ profiles/station/kak-lsp.toml | 428 +++++++++++++++++++++++ profiles/station/kakoune.nix | 35 ++ profiles/station/meta.nix | 8 + profiles/station/mpv.nix | 47 +++ profiles/station/neovim.nix | 104 ++++++ profiles/station/newsboat.nix | 83 +++++ profiles/station/packages.nix | 90 +++++ profiles/station/suckless.nix | 73 ++++ profiles/station/zathura.nix | 27 ++ shell-scripts.nix | 29 -- shell-scripts/checkout | 69 ---- shell-scripts/compile | 40 --- shell-scripts/filter-ansi | 2 - shell-scripts/get-sshables | 7 - shell-scripts/kakup | 100 ------ shell-scripts/kubeconfig-merge | 3 - shell-scripts/lfub | 24 -- shell-scripts/linkhandler | 26 -- shell-scripts/mailsync | 112 ------ shell-scripts/maimpick | 18 - shell-scripts/news | 5 - shell-scripts/nixup | 94 ----- shell-scripts/notmuch-hook | 17 - shell-scripts/openfile | 10 - shell-scripts/pass-ansible-vault-client | 17 - shell-scripts/sb-battery | 37 -- shell-scripts/sb-clock | 29 -- shell-scripts/sb-internet | 26 -- shell-scripts/sb-mailbox | 20 -- shell-scripts/sb-nettraf | 29 -- shell-scripts/sb-news | 17 - shell-scripts/set-bg | 15 - shell-scripts/spectrwmbar | 59 ---- shell-scripts/sysact | 21 -- shell-scripts/terragrunt | 94 ----- shell-scripts/tmux-normal-mode | 28 -- shell-scripts/transadd | 9 - signed.txt | 20 -- yubikey-installer.nix | 171 --------- 199 files changed, 4965 insertions(+), 5193 deletions(-) delete mode 100644 .emacs delete mode 100644 configuration.nix create mode 120000 drduh/installer create mode 100644 drduh/signed.txt create mode 100644 drduh/yubikey-installer.nix delete mode 100644 emacs/init.el delete mode 100644 email/gmail.nix delete mode 100644 email/mailsync.nix delete mode 100644 email/neomutt.nix delete mode 100644 email/notmuch.nix delete mode 100644 home.nix delete mode 100644 home/codeium.nix delete mode 160000 home/dwm delete mode 160000 home/dwmblocks delete mode 100644 home/kak-lsp.toml delete mode 100644 home/kakoune.nix delete mode 100644 home/meta.nix delete mode 100644 home/mpv.nix delete mode 100644 home/neovim.nix delete mode 100644 home/newsboat.nix delete mode 100644 home/packages.nix delete mode 160000 home/st delete mode 100644 home/suckless.nix delete mode 100644 home/zathura.nix delete mode 120000 installer delete mode 100644 lemptop.nix create mode 100644 machines/lemptop.nix delete mode 100644 modules/nix.nix create mode 100644 mut/bin/checkout create mode 100755 mut/bin/compile create mode 100755 mut/bin/filter-ansi create mode 100755 mut/bin/get-sshables create mode 100755 mut/bin/kakup create mode 100644 mut/bin/kubeconfig-merge create mode 100644 mut/bin/lfub create mode 100755 mut/bin/linkhandler create mode 100644 mut/bin/mailsync create mode 100644 mut/bin/maimpick create mode 100755 mut/bin/news create mode 100755 mut/bin/nixup create mode 100644 mut/bin/notmuch-hook create mode 100644 mut/bin/openfile create mode 100755 mut/bin/pass-ansible-vault-client create mode 100644 mut/bin/sb-battery create mode 100644 mut/bin/sb-clock create mode 100644 mut/bin/sb-internet create mode 100644 mut/bin/sb-mailbox create mode 100644 mut/bin/sb-nettraf create mode 100644 mut/bin/sb-news create mode 100644 mut/bin/set-bg create mode 100644 mut/bin/spectrwmbar create mode 100755 mut/bin/sysact create mode 100755 mut/bin/terragrunt create mode 100644 mut/bin/tmux-normal-mode create mode 100644 mut/bin/transadd create mode 100644 mut/emacs/init.el create mode 100644 mut/neovim/README.md create mode 100644 mut/neovim/compiler/ansible-lint.vim create mode 100644 mut/neovim/compiler/go-test.vim create mode 100644 mut/neovim/compiler/helm.vim create mode 100644 mut/neovim/compiler/racket.vim create mode 100644 mut/neovim/compiler/terragrunt.vim create mode 100644 mut/neovim/debug create mode 100644 mut/neovim/fnl/conf/diagnostic.fnl create mode 100644 mut/neovim/fnl/conf/events.fnl create mode 100644 mut/neovim/fnl/conf/filetype.fnl create mode 100644 mut/neovim/fnl/conf/init.fnl create mode 100644 mut/neovim/fnl/conf/lsp.fnl create mode 100644 mut/neovim/fnl/conf/macros.fnl create mode 100644 mut/neovim/fnl/conf/newtab/init.fnl create mode 100644 mut/neovim/fnl/conf/nix-develop/init.fnl create mode 100644 mut/neovim/fnl/conf/pkgs.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/cmp.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/conjure.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/dap.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/gitsigns.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/harpoon.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/heirline.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/lsp_lines.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/lsp_signature.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/lspconfig.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/neotest.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/noice.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/null-ls.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/test.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/tree-sitter-context.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/treesitter.fnl create mode 100644 mut/neovim/fnl/conf/pkgs/venn.fnl create mode 100644 mut/neovim/fnl/conf/settings.fnl create mode 100644 mut/neovim/fnl/conf/wict-nvim/builder.fnl create mode 100644 mut/neovim/fnl/conf/wict-nvim/effects.fnl create mode 100644 mut/neovim/fnl/conf/wict-nvim/frames/frame.fnl create mode 100644 mut/neovim/fnl/conf/wict-nvim/frames/vec.fnl create mode 100644 mut/neovim/fnl/conf/wict-nvim/init.fnl create mode 100644 mut/neovim/fnl/conf/wictl-nvim/init.fnl create mode 100644 mut/neovim/fnl/conf/wictl-nvim/resolvers.fnl create mode 100644 mut/neovim/fnl/conf/wictl-nvim/term.fnl create mode 100644 mut/neovim/init.fnl create mode 100644 mut/neovim/init.lua create mode 100644 mut/neovim/test.py delete mode 100644 neovim/README.md delete mode 100644 neovim/compiler/ansible-lint.vim delete mode 100644 neovim/compiler/go-test.vim delete mode 100644 neovim/compiler/helm.vim delete mode 100644 neovim/compiler/racket.vim delete mode 100644 neovim/compiler/terragrunt.vim delete mode 100644 neovim/debug delete mode 100644 neovim/fnl/conf/diagnostic.fnl delete mode 100644 neovim/fnl/conf/events.fnl delete mode 100644 neovim/fnl/conf/filetype.fnl delete mode 100644 neovim/fnl/conf/init.fnl delete mode 100644 neovim/fnl/conf/lsp.fnl delete mode 100644 neovim/fnl/conf/macros.fnl delete mode 100644 neovim/fnl/conf/newtab/init.fnl delete mode 100644 neovim/fnl/conf/nix-develop/init.fnl delete mode 100644 neovim/fnl/conf/pkgs.fnl delete mode 100644 neovim/fnl/conf/pkgs/cmp.fnl delete mode 100644 neovim/fnl/conf/pkgs/conjure.fnl delete mode 100644 neovim/fnl/conf/pkgs/dap.fnl delete mode 100644 neovim/fnl/conf/pkgs/gitsigns.fnl delete mode 100644 neovim/fnl/conf/pkgs/harpoon.fnl delete mode 100644 neovim/fnl/conf/pkgs/heirline.fnl delete mode 100644 neovim/fnl/conf/pkgs/lsp_lines.fnl delete mode 100644 neovim/fnl/conf/pkgs/lsp_signature.fnl delete mode 100644 neovim/fnl/conf/pkgs/lspconfig.fnl delete mode 100644 neovim/fnl/conf/pkgs/neotest.fnl delete mode 100644 neovim/fnl/conf/pkgs/noice.fnl delete mode 100644 neovim/fnl/conf/pkgs/null-ls.fnl delete mode 100644 neovim/fnl/conf/pkgs/test.fnl delete mode 100644 neovim/fnl/conf/pkgs/tree-sitter-context.fnl delete mode 100644 neovim/fnl/conf/pkgs/treesitter.fnl delete mode 100644 neovim/fnl/conf/pkgs/venn.fnl delete mode 100644 neovim/fnl/conf/settings.fnl delete mode 100644 neovim/fnl/conf/wict-nvim/builder.fnl delete mode 100644 neovim/fnl/conf/wict-nvim/effects.fnl delete mode 100644 neovim/fnl/conf/wict-nvim/frames/frame.fnl delete mode 100644 neovim/fnl/conf/wict-nvim/frames/vec.fnl delete mode 100644 neovim/fnl/conf/wict-nvim/init.fnl delete mode 100644 neovim/fnl/conf/wictl-nvim/init.fnl delete mode 100644 neovim/fnl/conf/wictl-nvim/resolvers.fnl delete mode 100644 neovim/fnl/conf/wictl-nvim/term.fnl delete mode 100644 neovim/init.fnl delete mode 100644 neovim/init.lua delete mode 100644 neovim/test.py delete mode 100644 overlays/#vimPlugins.nix# delete mode 120000 overlays/.#vimPlugins.nix create mode 100644 profiles/core/configuration.nix create mode 100644 profiles/core/hm.nix create mode 100644 profiles/core/home.nix create mode 100644 profiles/email/gmail.nix create mode 100644 profiles/email/mailsync.nix create mode 100644 profiles/email/neomutt.nix create mode 100644 profiles/email/notmuch.nix create mode 100644 profiles/nix.nix create mode 100644 profiles/station/codeium.nix create mode 100644 profiles/station/kak-lsp.toml create mode 100644 profiles/station/kakoune.nix create mode 100644 profiles/station/meta.nix create mode 100644 profiles/station/mpv.nix create mode 100644 profiles/station/neovim.nix create mode 100644 profiles/station/newsboat.nix create mode 100644 profiles/station/packages.nix create mode 100644 profiles/station/suckless.nix create mode 100644 profiles/station/zathura.nix delete mode 100644 shell-scripts.nix delete mode 100644 shell-scripts/checkout delete mode 100755 shell-scripts/compile delete mode 100755 shell-scripts/filter-ansi delete mode 100755 shell-scripts/get-sshables delete mode 100755 shell-scripts/kakup delete mode 100644 shell-scripts/kubeconfig-merge delete mode 100644 shell-scripts/lfub delete mode 100755 shell-scripts/linkhandler delete mode 100644 shell-scripts/mailsync delete mode 100644 shell-scripts/maimpick delete mode 100755 shell-scripts/news delete mode 100755 shell-scripts/nixup delete mode 100644 shell-scripts/notmuch-hook delete mode 100644 shell-scripts/openfile delete mode 100755 shell-scripts/pass-ansible-vault-client delete mode 100644 shell-scripts/sb-battery delete mode 100644 shell-scripts/sb-clock delete mode 100644 shell-scripts/sb-internet delete mode 100644 shell-scripts/sb-mailbox delete mode 100644 shell-scripts/sb-nettraf delete mode 100644 shell-scripts/sb-news delete mode 100644 shell-scripts/set-bg delete mode 100644 shell-scripts/spectrwmbar delete mode 100755 shell-scripts/sysact delete mode 100755 shell-scripts/terragrunt delete mode 100644 shell-scripts/tmux-normal-mode delete mode 100644 shell-scripts/transadd delete mode 100644 signed.txt delete mode 100644 yubikey-installer.nix diff --git a/.emacs b/.emacs deleted file mode 100644 index 30830b9..0000000 --- a/.emacs +++ /dev/null @@ -1,146 +0,0 @@ -;; do autoload stuff here -(package-initialize) -(require 'package) -(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) - -(defvar rc/package-contents-refreshed nil) - -(defun rc/package-refresh-contents-once () - (when (not rc/package-contents-refreshed) - (setq rc/package-contents-refreshed t) - (package-refresh-contents))) - -(defun rc/require-one-package (package) - (when (not (package-installed-p package)) - (rc/package-refresh-contents-once) - (package-install package))) - -(defun rc/require (&rest packages) - (dolist (package packages) - (rc/require-one-package package))) - -(defun rc/require-theme (theme) - (let ((theme-package (->> theme - (symbol-name) - (funcall (-flip #'concat) "-theme") - (intern)))) - (rc/require theme-package) - (load-theme theme t))) - - -(rc/require 'dash) -(require 'dash) -(rc/require 'dash-functional) -(require 'dash-functional) - -(defun rc/get-default-font () - (cond - ((eq system-type 'windows-nt) "Consolas-13"))) -(add-to-list 'default-frame-alist `(font . ,(rc/get-default-font))) -(rc/require 'ansi-color) - -(rc/require 'ido) -(rc/require 'ido-completing-read+) -(rc/require 'smex) -(ido-mode t) -(ido-everywhere t) -(ido-ubiquitous-mode t) - -(global-set-key (kbd "M-x") 'smex) -(global-set-key (kbd "M-X") 'smex-major-mode-commands) -;; This is your old M-x. p -(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command) - -(tool-bar-mode 0) -(menu-bar-mode 0) -(scroll-bar-mode 0) -(column-number-mode 1) -(show-paren-mode 1) - -(setq-default inhibit-splash-screen t - make-backup-files nil - tab-width 4 - indent-tabs-mode nil - compilation-scroll-output t - visible-bell (equal system-type 'windows-nt)) - -(setq-default c-basic-offset 4 - c-default-style '((java-mode . "java") - (awk-mode . "awk") - (other . "bsd"))) -(setq split-width-threshold 9999) - -(defun rc/duplicate-line () - "Duplicate current line" - (interactive) - (let ((column (- (point) (point-at-bol))) - (line (let ((s (thing-at-point 'line t))) - (if s (string-remove-suffix "\n" s) "")))) - (move-end-of-line 1) - (newline) - (insert line) - (move-beginning-of-line 1) - (forward-char column))) - -(global-set-key (kbd "M-J") 'text-scale-decrease) -(global-set-key (kbd "M-K") 'text-scale-increase) - -(global-set-key (kbd "M-c") 'rc/duplicate-line) -(global-set-key (kbd "C-c p") 'find-file-at-point) -(global-display-line-numbers-mode) -(setq next-line-add-newlines t) -(setq display-line-numbers-type 'relative) - -(rc/require 'direnv 'editorconfig 'multiple-cursors) -(editorconfig-mode 1) -(electric-pair-mode) -(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) -(global-set-key (kbd "C->") 'mc/mark-next-like-this) -(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) -(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) -(global-set-key (kbd "C-.") 'mc/mark-all-in-region) - -(rc/require 'cl-lib 'magit) -(setq magit-auto-revert-mode nil) -(global-set-key (kbd "C-c m s") 'magit-status) -(global-set-key (kbd "C-c m l") 'magit-log) - -(require 'dired-x) -(setq dired-omit-files - (concat dired-omit-files "\\|^\\..+$")) -(setq-default dired-dwim-target t) -(setq dired-listing-switches "-alh") - -;; stolen from: https://emacs.stackexchange.com/questions/24698/ansi-escape-sequences-in-compilation-mode -(rc/require 'ansi-color) -(defun endless/colorize-compilation () - "Colorize from `compilation-filter-start' to `point'." - (let ((inhibit-read-only t)) - (ansi-color-apply-on-region - compilation-filter-start (point)))) -(add-hook 'compilation-filter-hook - #'endless/colorize-compilation) - -(rc/require - 'nix-mode - 'yaml-pro - ) - -(rc/require-theme 'gruber-darker) - -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(custom-enabled-themes '(gruber-darker)) - '(custom-safe-themes - '("e13beeb34b932f309fb2c360a04a460821ca99fe58f69e65557d6c1b10ba18c7" default)) - '(package-selected-packages - '(paredit nix-mode direnv gruber-darker-theme magit multiple-cursors ido-completing-read+ editorconfig smex))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) diff --git a/.gitmodules b/.gitmodules index ca9ca5b..83fdce4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ -[submodule "home/dwm"] - path = home/dwm +[submodule "mut/dwm"] + path = mut/dwm url = https://github.com/mvinkio/dwm -[submodule "home/st"] - path = home/st +[submodule "mut/st"] + path = mut/st url = https://github.com/mvinkio/st -[submodule "home/dwmblocks"] +[submodule "mut/dwmblocks"] path = home/dwmblocks url = https://github.com/mvinkio/dwmblocks diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index e677306..0000000 --- a/configuration.nix +++ /dev/null @@ -1,154 +0,0 @@ -{ - config, - pkgs, - ... -}: { - users.users.mike = { - isNormalUser = true; - extraGroups = ["wheel" "networkmanager" "docker" "transmission"]; - }; - - virtualisation.docker.enable = true; - - hardware.keyboard.qmk.enable = true; - services.udev.extraRules = '' - # Atmel DFU - ### ATmega16U2 - SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2fef", TAG+="uaccess" - ### ATmega32U2 - SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff0", TAG+="uaccess" - ### ATmega16U4 - SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff3", TAG+="uaccess" - ### ATmega32U4 - SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff4", TAG+="uaccess" - ### AT90USB64 - SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff9", TAG+="uaccess" - ### AT90USB162 - SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffa", TAG+="uaccess" - ### AT90USB128 - SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffb", TAG+="uaccess" - - # Input Club - SUBSYSTEMS=="usb", ATTRS{idVendor}=="1c11", ATTRS{idProduct}=="b007", TAG+="uaccess" - - # STM32duino - SUBSYSTEMS=="usb", ATTRS{idVendor}=="1eaf", ATTRS{idProduct}=="0003", TAG+="uaccess" - # STM32 DFU - SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", TAG+="uaccess" - - # BootloadHID - SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", TAG+="uaccess" - - # USBAspLoader - SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", TAG+="uaccess" - - # USBtinyISP - SUBSYSTEMS=="usb", ATTRS{idVendor}=="1782", ATTRS{idProduct}=="0c9f", TAG+="uaccess" - - # ModemManager should ignore the following devices - # Atmel SAM-BA (Massdrop) - SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - - # Caterina (Pro Micro) - ## pid.codes shared PID - ### Keyboardio Atreus 2 Bootloader - SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2302", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ## Spark Fun Electronics - ### Pro Micro 3V3/8MHz - SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9203", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### Pro Micro 5V/16MHz - SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9205", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### LilyPad 3V3/8MHz (and some Pro Micro clones) - SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9207", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ## Pololu Electronics - ### A-Star 32U4 - SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="0101", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ## Arduino SA - ### Leonardo - SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### Micro - SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0037", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ## Adafruit Industries LLC - ### Feather 32U4 - SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000c", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### ItsyBitsy 32U4 3V3/8MHz - SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000d", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### ItsyBitsy 32U4 5V/16MHz - SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000e", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ## dog hunter AG - ### Leonardo - SUBSYSTEMS=="usb", ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### Micro - SUBSYSTEMS=="usb", ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="0037", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - - # hid_listen - KERNEL=="hidraw*", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" - - # hid bootloaders - ## QMK HID - SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2067", TAG+="uaccess" - ## PJRC's HalfKay - SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0478", TAG+="uaccess" - - # APM32 DFU - SUBSYSTEMS=="usb", ATTRS{idVendor}=="314b", ATTRS{idProduct}=="0106", TAG+="uaccess" - - # GD32V DFU - SUBSYSTEMS=="usb", ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", TAG+="uaccess" - - # WB32 DFU - SUBSYSTEMS=="usb", ATTRS{idVendor}=="342d", ATTRS{idProduct}=="dfa0", TAG+="uaccess" - ''; - - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.hostName = "lemptop"; - networking.networkmanager.enable = true; - time.timeZone = "Europe/Amsterdam"; - - services.xserver.enable = true; - services.xserver.displayManager.startx.enable = true; - services.xserver.libinput.enable = true; - - services.udev.packages = [ pkgs.yubikey-personalization ]; - services.pcscd.enable = true; - security.pam.services = { - login.u2fAuth = true; - sudo.u2fAuth = true; - }; - - sound.enable = true; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - - services.transmission = { - enable = true; - }; - - hardware.bluetooth.enable = true; - services.blueman.enable = true; - - programs.slock.enable = true; - - documentation.dev.enable = true; - environment.systemPackages = with pkgs; [ - man-pages - man-pages-posix - vim - wget - git - pinentry-curses - ]; - - system.stateVersion = "23.05"; - nix.package = pkgs.nixUnstable; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; -} diff --git a/drduh/installer b/drduh/installer new file mode 120000 index 0000000..5743a7f --- /dev/null +++ b/drduh/installer @@ -0,0 +1 @@ +/nix/store/bc1gji3lg1yqs4c8yazdfdgwj2aqb676-nixos-yubikey-22.11beta-297654.gfedcba-x86_64-linux.iso \ No newline at end of file diff --git a/drduh/signed.txt b/drduh/signed.txt new file mode 100644 index 0000000..e5ee920 --- /dev/null +++ b/drduh/signed.txt @@ -0,0 +1,20 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA512 + +test message string +-----BEGIN PGP SIGNATURE----- + +iQIzBAEBCgAdFiEEZEPiBfFrOLTcspamK6IYQ5k48SgFAmSjBIQACgkQK6IYQ5k4 +8ShT6Q/6AlvJQ4+7bNUTanYsm1i1coAwedVYhtys2IJEZ39U1mBp7s23NqntB8fB +huZasAfK0uOyfD263/RxVLKit2iKQRd5SzdbNIlUCHW2M+a8ueJwe+rYanIz8zLD +cr5ykWgB6RTgVRLZTK0R1Nk3j2ojlW3N9VmtiUnEAq7aSbzk0071edRvKSw4g6vJ +E8BrbE8SuhreYVtceiyLUp8w1XKosSVafbD2hhNe+MPCgjVJwVs82f2PzEs8OOSP +omQw/fLO51gnBx1Si0b37M5Ye+6Q9CAA9AY61+U3MumBQTKVpwL/XEvRgioXmBPY +tvqkD4PON7SjxLKI33daVgitBDeoweZ93NwBHGQ9neWLjSVbkl4fzrjw3MU3dDc5 +w/RjqAiaTdFb/MJ/kgUdj6xAi81JRh/rcHFfwF16gqRiaqgJG1CQrCYGtq13O+Ik +EtsCbQcgzhBQonrFgFNc881YABnXKpFnFR+Xuq1zRryxdyOyqFrQ8qV1WPIck00E +6hd/qFUdnVDulf9jzRmDer5yo916g/8KXMsWP45XXvoEL/5weI5kalCJbQl6k/xu +89RNwu4uJzWFKER1JAQvTC6vzI7D4f6OKc+uCyy5lNq0iuEx9xzDxdaHPaGAgYgv +5tB6TPfiixnHayj2P5svcmZxTGxk7X5cJ8cUtcIBz9dLg2FasrU= +=Xa80 +-----END PGP SIGNATURE----- diff --git a/drduh/yubikey-installer.nix b/drduh/yubikey-installer.nix new file mode 100644 index 0000000..7c8a428 --- /dev/null +++ b/drduh/yubikey-installer.nix @@ -0,0 +1,171 @@ +# yubikey-installer.nix +let + configuration = { config, lib, pkgs, ... }: + with pkgs; + let + src = fetchGit "https://github.com/drduh/YubiKey-Guide"; + + guide = "${src}/README.md"; + + contrib = "${src}/contrib"; + + drduhConfig = fetchGit "https://github.com/drduh/config"; + + gpg-conf = "${drduhConfig}/gpg.conf"; + + xserverCfg = config.services.xserver; + + pinentryFlavour = if xserverCfg.desktopManager.lxqt.enable || xserverCfg.desktopManager.plasma5.enable then + "qt" + else if xserverCfg.desktopManager.xfce.enable then + "gtk2" + else if xserverCfg.enable || config.programs.sway.enable then + "gnome3" + else + "curses"; + + # Instead of hard-coding the pinentry program, chose the appropriate one + # based on the environment of the image the user has chosen to build. + gpg-agent-conf = runCommand "gpg-agent.conf" {} '' + sed '/pinentry-program/d' ${drduhConfig}/gpg-agent.conf > $out + echo "pinentry-program ${pinentry.${pinentryFlavour}}/bin/pinentry" >> $out + ''; + + view-yubikey-guide = writeShellScriptBin "view-yubikey-guide" '' + viewer="$(type -P xdg-open || true)" + if [ -z "$viewer" ]; then + viewer="${glow}/bin/glow -p" + fi + exec $viewer "${guide}" + ''; + + shortcut = makeDesktopItem { + name = "yubikey-guide"; + icon = "${yubikey-manager-qt}/share/ykman-gui/icons/ykman.png"; + desktopName = "drduh's YubiKey Guide"; + genericName = "Guide to using YubiKey for GPG and SSH"; + comment = "Open the guide in a reader program"; + categories = [ "Documentation" ]; + exec = "${view-yubikey-guide}/bin/view-yubikey-guide"; + }; + + yubikey-guide = symlinkJoin { + name = "yubikey-guide"; + paths = [ view-yubikey-guide shortcut ]; + }; + + in { + nixpkgs.config = { allowBroken = true; }; + + isoImage.isoBaseName = lib.mkForce "nixos-yubikey"; + # Uncomment this to disable compression and speed up image creation time + #isoImage.squashfsCompression = "gzip -Xcompression-level 1"; + + boot.kernelPackages = linuxPackages_latest; + # Always copytoram so that, if the image is booted from, e.g., a + # USB stick, nothing is mistakenly written to persistent storage. + boot.kernelParams = [ "copytoram" ]; + # Secure defaults + boot.cleanTmpDir = true; + boot.kernel.sysctl = { "kernel.unprivileged_bpf_disabled" = 1; }; + + services.pcscd.enable = true; + services.udev.packages = [ yubikey-personalization ]; + + programs = { + ssh.startAgent = false; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + environment.systemPackages = [ + # Tools for backing up keys + paperkey + pgpdump + parted + cryptsetup + + # Yubico's official tools + yubikey-manager + yubikey-manager-qt + yubikey-personalization + yubikey-personalization-gui + yubico-piv-tool + yubioath-desktop + + # Testing + ent + (haskell.lib.justStaticExecutables haskellPackages.hopenpgp-tools) + + # Password generation tools + diceware + pwgen + + # Miscellaneous tools that might be useful beyond the scope of the guide + cfssl + pcsctools + + # This guide itself (run `view-yubikey-guide` on the terminal to open it + # in a non-graphical environment). + yubikey-guide + ]; + + # Disable networking so the system is air-gapped + # Comment all of these lines out if you'll need internet access + boot.initrd.network.enable = false; + networking.dhcpcd.enable = false; + networking.dhcpcd.allowInterfaces = []; + networking.interfaces = {}; + networking.firewall.enable = true; + networking.useDHCP = false; + networking.useNetworkd = false; + networking.wireless.enable = false; + networking.networkmanager.enable = lib.mkForce false; + + # Unset history so it's never stored + # Set GNUPGHOME to an ephemeral location and configure GPG with the + # guide's recommended settings. + environment.interactiveShellInit = '' + unset HISTFILE + export GNUPGHOME="/run/user/$(id -u)/gnupg" + if [ ! -d "$GNUPGHOME" ]; then + echo "Creating \$GNUPGHOME…" + install --verbose -m=0700 --directory="$GNUPGHOME" + fi + [ ! -f "$GNUPGHOME/gpg.conf" ] && cp --verbose ${gpg-conf} "$GNUPGHOME/gpg.conf" + [ ! -f "$GNUPGHOME/gpg-agent.conf" ] && cp --verbose ${gpg-agent-conf} "$GNUPGHOME/gpg-agent.conf" + echo "\$GNUPGHOME is \"$GNUPGHOME\"" + ''; + + # Copy the contents of contrib to the home directory, add a shortcut to + # the guide on the desktop, and link to the whole repo in the documents + # folder. + system.activationScripts.yubikeyGuide = let + homeDir = "/home/nixos/"; + desktopDir = homeDir + "Desktop/"; + documentsDir = homeDir + "Documents/"; + in '' + mkdir -p ${desktopDir} ${documentsDir} + chown nixos ${homeDir} ${desktopDir} ${documentsDir} + + cp -R ${contrib}/* ${homeDir} + ln -sf ${yubikey-guide}/share/applications/yubikey-guide.desktop ${desktopDir} + ln -sfT ${src} ${documentsDir}/YubiKey-Guide + ''; + }; + + nixos = import { + inherit configuration; + supportedSystems = [ "x86_64-linux" ]; + }; + + # Choose the one you like: + #nixos-yubikey = nixos.iso_minimal; # No graphical environment + #nixos-yubikey = nixos.iso_gnome; + nixos-yubikey = nixos.iso_plasma5; + +in { + inherit nixos-yubikey; +} diff --git a/emacs/init.el b/emacs/init.el deleted file mode 100644 index 0d4f33d..0000000 --- a/emacs/init.el +++ /dev/null @@ -1,154 +0,0 @@ -;; do autoload stuff here -(package-initialize) -(require 'package) -(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) - -(defun seq-keep (function sequence) - "Apply FUNCTION to SEQUENCE and return the list of all the non-nil results." - (delq nil (seq-map function sequence))) - -(defvar rc/package-contents-refreshed nil) - -(defun rc/package-refresh-contents-once () - (when (not rc/package-contents-refreshed) - (setq rc/package-contents-refreshed t) - (package-refresh-contents))) - -(defun rc/require-one-package (package) - (when (not (package-installed-p package)) - (rc/package-refresh-contents-once) - (package-install package))) - -(defun rc/require (&rest packages) - (dolist (package packages) - (rc/require-one-package package))) - -(defun rc/require-theme (theme) - (let ((theme-package (->> theme - (symbol-name) - (funcall (-flip #'concat) "-theme") - (intern)))) - (rc/require theme-package) - (load-theme theme t))) - - -(rc/require 'dash) -(require 'dash) -(rc/require 'dash-functional) -(require 'dash-functional) - -(defun rc/get-default-font () - (cond - ((eq system-type 'windows-nt) "Consolas-13"))) -(add-to-list 'default-frame-alist `(font . ,(rc/get-default-font))) -(rc/require 'ansi-color) - -(rc/require 'ido) -(rc/require 'ido-completing-read+) -(rc/require 'smex) -(ido-mode t) -(ido-everywhere t) -(ido-ubiquitous-mode t) - -(global-set-key (kbd "M-x") 'smex) -(global-set-key (kbd "M-X") 'smex-major-mode-commands) -;; This is your old M-x. p -(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command) - -(tool-bar-mode 0) -(menu-bar-mode 0) -(scroll-bar-mode 0) -(column-number-mode 1) -(show-paren-mode 1) - -(setq-default inhibit-splash-screen t - make-backup-files nil - tab-width 4 - indent-tabs-mode nil - compilation-scroll-output t - visible-bell (equal system-type 'windows-nt)) - -(setq-default c-basic-offset 4 - c-default-style '((java-mode . "java") - (awk-mode . "awk") - (other . "bsd"))) -(setq split-width-threshold 9999) - -(defun rc/duplicate-line () - "Duplicate current line" - (interactive) - (let ((column (- (point) (point-at-bol))) - (line (let ((s (thing-at-point 'line t))) - (if s (string-remove-suffix "\n" s) "")))) - (move-end-of-line 1) - (newline) - (insert line) - (move-beginning-of-line 1) - (forward-char column))) - -(global-set-key (kbd "M-J") 'text-scale-decrease) -(global-set-key (kbd "M-K") 'text-scale-increase) - -(global-set-key (kbd "M-c") 'rc/duplicate-line) -(global-set-key (kbd "C-c p") 'find-file-at-point) -(global-display-line-numbers-mode) -(setq next-line-add-newlines t) -(setq display-line-numbers-type 'relative) - -(rc/require 'direnv 'editorconfig 'multiple-cursors) -(editorconfig-mode 1) -(electric-pair-mode) -(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) -(global-set-key (kbd "C->") 'mc/mark-next-like-this) -(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) -(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) -(global-set-key (kbd "C-.") 'mc/mark-all-in-region) - -(rc/require 'cl-lib 'magit) -(setq magit-auto-revert-mode nil) -(global-set-key (kbd "C-c m s") 'magit-status) -(global-set-key (kbd "C-c m l") 'magit-log) - -(require 'dired-x) -(setq dired-omit-files - (concat dired-omit-files "\\|^\\..+$")) -(setq-default dired-dwim-target t) -(setq dired-listing-switches "-alh") - -;; stolen from: https://emacs.stackexchange.com/questions/24698/ansi-escape-sequences-in-compilation-mode -(rc/require 'ansi-color) -(defun endless/colorize-compilation () - "Colorize from `compilation-filter-start' to `point'." - (let ((inhibit-read-only t)) - (ansi-color-apply-on-region - compilation-filter-start (point)))) -(add-hook 'compilation-filter-hook - #'endless/colorize-compilation) - -(setq TeX-auto-save t) -(setq TeX-parse-self t) -(setq-default TeX-master nil) - -(rc/require - 'nix-mode - 'auctex - 'yaml-pro - ) - -(rc/require-theme 'gruber-darker) -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(custom-enabled-themes '(gruber-darker)) - '(custom-safe-themes - '("e13beeb34b932f309fb2c360a04a460821ca99fe58f69e65557d6c1b10ba18c7" default)) - '(package-selected-packages - '(go-mode auctex yaml-pro paredit nix-mode direnv gruber-darker-theme magit multiple-cursors ido-completing-read+ editorconfig smex))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) diff --git a/email/gmail.nix b/email/gmail.nix deleted file mode 100644 index 760532b..0000000 --- a/email/gmail.nix +++ /dev/null @@ -1,118 +0,0 @@ -{ - inputs, - config, - pkgs, - ... -}: { - accounts.email = { - maildirBasePath = "${config.xdg.dataHome}/mail"; - accounts = { - gmail = { - primary = true; - realName = "Mike Vink"; - userName = "mike1994vink@gmail.com"; - address = "mike1994vink@gmail.com"; - passwordCommand = ["${pkgs.pass}/bin/pass" "personal/neomutt"]; - imap = { host = "imap.gmail.com"; port = 993; tls = { enable = true; }; }; - smtp = { host = "smtp.gmail.com"; port = 587; tls = { enable = true; useStartTls = true; }; }; - msmtp = { - enable = true; - }; - neomutt = { - enable = true; - sendMailCommand = "msmtp -a gmail"; - mailboxName = "=== mike1994vink ==="; - extraConfig = '' - set spoolfile='Inbox' - unvirtual-mailboxes * - ''; - }; - mbsync = { - enable = true; - create = "both"; remove = "both"; expunge = "both"; - groups = { - gmail = { - channels = { - Inbox = { farPattern = "INBOX"; nearPattern = "INBOX"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Archive = { farPattern = "[Gmail]/All Mail"; nearPattern = "Archive"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Spam = { farPattern = "[Gmail]/Spam"; nearPattern = "Spam"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Trash = { farPattern = "[Gmail]/Bin"; nearPattern = "Trash"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Important = { farPattern = "[Gmail]/Important"; nearPattern = "Important"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Sent = { farPattern = "[Gmail]/Sent Mail"; nearPattern = "Sent"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - FarDrafts = { farPattern = "[Gmail]/Drafts"; nearPattern = "FarDrafts"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - }; - }; - }; - }; - notmuch = { - enable = true; - neomutt = { - enable = true; - virtualMailboxes = [ - { name = "Inbox"; query = "folder:/gmail/ tag:inbox"; } - { name = "Archive"; query = "folder:/gmail/ tag:archive"; } - { name = "Sent"; query = "folder:/gmail/ tag:sent"; } - { name = "Spam"; query = "folder:/gmail/ tag:spam"; } - { name = "Trash"; query = "folder:/gmail/ tag:trash"; } - { name = "Jobs"; query = "folder:/gmail/ tag:jobs"; } - { name = "Houses"; query = "folder:/gmail/ tag:houses"; } - { name = "Development"; query = "folder:/gmail/ tag:dev"; } - ]; - }; - }; - }; - family = { - primary = false; - realName = "Natalia & Mike Vink"; - userName = "natalia.mike.vink@gmail.com"; - address = "natalia.mike.vink@gmail.com"; - passwordCommand = ["${pkgs.pass}/bin/pass" "personal/neomutt-family"]; - imap = { host = "imap.gmail.com"; port = 993; tls = { enable = true; }; }; - smtp = { host = "smtp.gmail.com"; port = 587; tls = { enable = true; useStartTls = true; }; }; - msmtp = { - enable = true; - }; - neomutt = { - enable = true; - sendMailCommand = "msmtp -a gmail"; - mailboxName = "=== family ==="; - extraConfig = '' - set spoolfile='Inbox' - unvirtual-mailboxes * - ''; - }; - - mbsync = { - enable = true; - create = "both"; remove = "both"; expunge = "both"; - groups = { - gmail = { - channels = { - Inbox = { farPattern = "INBOX"; nearPattern = "INBOX"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Archive = { farPattern = "[Gmail]/All Mail"; nearPattern = "Archive"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Spam = { farPattern = "[Gmail]/Spam"; nearPattern = "Spam"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Trash = { farPattern = "[Gmail]/Bin"; nearPattern = "Trash"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Important = { farPattern = "[Gmail]/Important"; nearPattern = "Important"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - Sent = { farPattern = "[Gmail]/Sent Mail"; nearPattern = "Sent"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - FarDrafts = { farPattern = "[Gmail]/Drafts"; nearPattern = "FarDrafts"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; - }; - }; - }; - }; - notmuch = { - enable = true; - neomutt = { - enable = true; - virtualMailboxes = [ - { name = "Inbox"; query = "folder:/family/ tag:inbox"; } - { name = "Archive"; query = "folder:/family/ tag:archive"; } - { name = "Sent"; query = "folder:/family/ tag:sent"; } - { name = "Spam"; query = "folder:/family/ tag:spam"; } - { name = "Trash"; query = "folder:/family/ tag:trash"; } - ]; - }; - }; - }; - }; - }; -} diff --git a/email/mailsync.nix b/email/mailsync.nix deleted file mode 100644 index 3fcb0c5..0000000 --- a/email/mailsync.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - inputs, - config, - pkgs, - ... -}: { - programs.mbsync = { - enable = true; - }; - systemd.user.timers.mailsync = { - Unit = { - Description = "daemon that syncs mail"; - }; - Timer = { - OnBootSec = "5m"; - OnUnitActiveSec = "5m"; - Unit = "mailsync.service"; - }; - Install = { - WantedBy = [ "timers.target" ]; - }; - }; - systemd.user.services.mailsync = { - Unit = { - Description = "daemon that syncs mail"; - }; - Service = { - Type = "oneshot"; - RemainAfterExit = "no"; - ExecSearchPath = "${config.home.profileDirectory}/bin:/run/current-system/sw/bin"; - ExecStart = "${pkgs.coreutils}/bin/env mailsync"; - }; - }; -} diff --git a/email/neomutt.nix b/email/neomutt.nix deleted file mode 100644 index 384173f..0000000 --- a/email/neomutt.nix +++ /dev/null @@ -1,198 +0,0 @@ -{ - inputs, - config, - pkgs, - ... -}: { - programs.msmtp = { - enable = true; - }; - - xdg.configFile."neomutt/mailcap" = { - text = '' - text/plain; $EDITOR %s ; - text/html; openfile %s ; nametemplate=%s.html - text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput; - image/*; openfile %s ; - video/*; setsid mpv --quiet %s &; copiousoutput - audio/*; mpv %s ; - application/pdf; openfile %s ; - application/pgp-encrypted; gpg -d '%s'; copiousoutput; - application/pgp-keys; gpg --import '%s'; copiousoutput; - application/x-subrip; $EDITOR %s ; - ''; - }; - - programs.neomutt = { - enable = true; - sort = "reverse-date"; - sidebar = { - enable = true; - }; - extraConfig = '' - set use_threads=yes - set send_charset="us-ascii:utf-8" - set mailcap_path = $HOME/.config/neomutt/mailcap - set mime_type_query_command = "file --mime-type -b %s" - set date_format="%y/%m/%d %I:%M%p" - set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" - set smtp_authenticators = 'gssapi:login' - set query_command = "abook --mutt-query '%s'" - set rfc2047_parameters = yes - set sleep_time = 0 # Pause 0 seconds for informational messages - set markers = no # Disables the `+` displayed at line wraps - set mark_old = no # Unread mail stay unread until read - set mime_forward = no # mail body is forwarded as text - set forward_attachments = yes # attachments are forwarded with mail - set wait_key = no # mutt won't ask "press key to continue" - set fast_reply # skip to compose when replying - set fcc_attach # save attachments with the body - set forward_format = "Fwd: %s" # format of subject when forwarding - set forward_quote # include message in forwards - set reverse_name # reply as whomever it was to - set include # include message in replies - set mail_check=0 # to avoid lags using IMAP with some email providers (yahoo for example) - auto_view text/html # automatically show html (mailcap uses lynx) - auto_view application/pgp-encrypted - #set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. - alternative_order text/plain text/enriched text/html - - set sidebar_visible = yes - set sidebar_width = 20 - set sidebar_short_path = yes - set sidebar_next_new_wrap = yes - set mail_check_stats - set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?' - bind index,pager \Ck sidebar-prev - bind index,pager \Cj sidebar-next - bind index,pager \Co sidebar-open - bind index,pager \Cp sidebar-prev-new - bind index,pager \Cn sidebar-next-new - bind index,pager B sidebar-toggle-visible - - # Default index colors: - color index yellow default '.*' - color index_author red default '.*' - color index_number blue default - color index_subject cyan default '.*' - - # New mail is boldened: - color index brightyellow black "~N" - color index_author brightred black "~N" - color index_subject brightcyan black "~N" - - # Tagged mail is highlighted: - color index brightyellow blue "~T" - color index_author brightred blue "~T" - color index_subject brightcyan blue "~T" - - # Flagged mail is highlighted: - color index brightgreen default "~F" - color index_subject brightgreen default "~F" - color index_author brightgreen default "~F" - - # Other colors and aesthetic settings: - mono bold bold - mono underline underline - mono indicator reverse - mono error bold - color normal default default - color indicator brightblack white - color sidebar_highlight red default - color sidebar_divider brightblack black - color sidebar_flagged red black - color sidebar_new green black - color error red default - color tilde black default - color message cyan default - color markers red white - color attachment white default - color search brightmagenta default - color status brightyellow black - color hdrdefault brightgreen default - color quoted green default - color quoted1 blue default - color quoted2 cyan default - color quoted3 yellow default - color quoted4 red default - color quoted5 brightred default - color signature brightgreen default - color bold black default - color underline black default - - # Regex highlighting: - color header brightmagenta default "^From" - color header brightcyan default "^Subject" - color header brightwhite default "^(CC|BCC)" - color header blue default ".*" - color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses - color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL - color body green default "\`[^\`]*\`" # Green text between ` and ` - color body brightblue default "^# \.*" # Headings as bold blue - color body brightcyan default "^## \.*" # Subheadings as bold cyan - color body brightgreen default "^### \.*" # Subsubheadings as bold green - color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow - color body brightcyan default "[;:][-o][)/(|]" # emoticons - color body brightcyan default "[;:][)(|]" # emoticons - color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon? - color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon? - color body red default "(BAD signature)" - color body cyan default "(Good signature)" - color body brightblack default "^gpg: Good signature .*" - color body brightyellow default "^gpg: " - color body brightyellow red "^gpg: BAD signature from.*" - mono body bold "^gpg: Good signature" - mono body bold "^gpg: BAD signature from.*" - color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" - ''; - binds = [ - { map = ["index" "pager"]; key = "x"; action = "modify-labels"; } - { map = ["index" "pager"]; key = "i"; action = "noop"; } - { map = ["index" "pager"]; key = "g"; action = "noop"; } - { map = ["index"]; key = "\\Cf"; action = "noop"; } - { map = ["index" "pager"]; key = "M"; action = "noop"; } - { map = ["index" "pager"]; key = "C"; action = "noop"; } - { map = ["index"]; key = "gg"; action = "first-entry"; } - { map = ["index"]; key = "j"; action = "next-entry"; } - { map = ["index"]; key = "k"; action = "previous-entry"; } - { map = ["attach"]; key = ""; action = "view-mailcap"; } - { map = ["attach"]; key = "l"; action = "view-mailcap"; } - { map = ["editor"]; key = ""; action = "noop"; } - { map = ["index"]; key = "G"; action = "last-entry"; } - { map = ["pager" "attach"]; key = "h"; action = "exit"; } - { map = ["pager"]; key = "j"; action = "next-line"; } - { map = ["pager"]; key = "k"; action = "previous-line"; } - { map = ["pager"]; key = "l"; action = "view-attachments"; } - { map = ["index"]; key = "U"; action = "undelete-message"; } - { map = ["index"]; key = "L"; action = "limit"; } - { map = ["index"]; key = "h"; action = "noop"; } - { map = ["index"]; key = "l"; action = "display-message"; } - { map = ["index" "query"]; key = ""; action = "tag-entry"; } - { map = ["index" "pager"]; key = "H"; action = "view-raw-message"; } - { map = ["browser"]; key = "l"; action = "select-entry"; } - { map = ["browser"]; key = "gg"; action = "top-page"; } - { map = ["browser"]; key = "G"; action = "bottom-page"; } - { map = ["pager"]; key = "gg"; action = "top"; } - { map = ["pager"]; key = "G"; action = "bottom"; } - { map = ["index" "pager" "browser"]; key = "d"; action = "half-down"; } - { map = ["index" "pager" "browser"]; key = "u"; action = "half-up"; } - { map = ["index" "pager"]; key = "\\Cr"; action = "group-reply"; } - { map = ["index" "pager"]; key = "R"; action = "group-chat-reply"; } - { map = ["index"]; key = "\031"; action = "previous-undeleted"; } - { map = ["index"]; key = "\005"; action = "next-undeleted"; } - { map = ["pager"]; key = "\031"; action = "previous-line"; } - { map = ["pager"]; key = "\005"; action = "next-line"; } - { map = ["editor"]; key = ""; action = "complete-query"; } - ]; - macros = [ - { map = ["index"]; key = "X"; action = "=Spamy"; } - { map = ["index"]; key = "A"; action = "+archive -unread -inboxz^'z"; } - { map = ["index"]; key = "h"; action = "z^'z"; } - { map = ["index"]; key = "D"; action = ""; } - { map = ["index" "pager"]; key = "S"; action = "!notmuch-hook &"; } - { map = ["index"]; key = "c"; action = "?"; } - { map = ["index"]; key = "\\\\"; action = ""; } - { map = ["browser"]; key = "h"; action = ".."; } - ]; - }; -} diff --git a/email/notmuch.nix b/email/notmuch.nix deleted file mode 100644 index 3b182c7..0000000 --- a/email/notmuch.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - inputs, - config, - pkgs, - ... -}: { - programs.notmuch = { - enable = true; - new = { - tags = ["new"]; - ignore = [".mbsyncstate" ".uidvalidity"]; - }; - search.excludeTags = ["deleted" "spam"]; - maildir.synchronizeFlags = true; - extraConfig = { - database.path = "${config.xdg.dataHome}/mail"; - user.name = "Mike Vink"; - user.primary_email = "mike1994vink@gmail.com"; - crypto.gpg_path="gpg"; - }; - }; -} diff --git a/flake.lock b/flake.lock index 0b63960..6346544 100644 --- a/flake.lock +++ b/flake.lock @@ -20,22 +20,6 @@ "type": "github" } }, - "mvinkio": { - "locked": { - "lastModified": 1669579238, - "narHash": "sha256-Kk48N1r48jAj6iiCiXgwcv9cXasTDY8hgrsRaPrXicw=", - "owner": "mvinkio", - "repo": "nixpkgs", - "rev": "007f4f91390d742aff1e605d057283e486f12a3b", - "type": "github" - }, - "original": { - "owner": "mvinkio", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1695644571, @@ -53,22 +37,6 @@ } }, "nixpkgs-stable": { - "locked": { - "lastModified": 1685573264, - "narHash": "sha256-Zffu01pONhs/pqH07cjlF10NnMDLok8ix5Uk4rhOnZQ=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "380be19fbd2d9079f677978361792cb25e8a3635", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-22.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-stable_2": { "locked": { "lastModified": 1694908564, "narHash": "sha256-ducA98AuWWJu5oUElIzN24Q22WlO8bOfixGzBgzYdVc=", @@ -103,16 +71,14 @@ "root": { "inputs": { "home-manager": "home-manager", - "mvinkio": "mvinkio", "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable", "sops-nix": "sops-nix" } }, "sops-nix": { "inputs": { "nixpkgs": "nixpkgs_2", - "nixpkgs-stable": "nixpkgs-stable_2" + "nixpkgs-stable": "nixpkgs-stable" }, "locked": { "lastModified": 1695284550, diff --git a/flake.nix b/flake.nix index a304694..d80f804 100644 --- a/flake.nix +++ b/flake.nix @@ -3,8 +3,6 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - mvinkio.url = "github:mvinkio/nixpkgs/nixpkgs-unstable"; - nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-22.05"; sops-nix.url = "github:Mic92/sops-nix"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; @@ -12,51 +10,36 @@ outputs = inputs@{ self, nixpkgs, - mvinkio, - nixpkgs-stable, home-manager, sops-nix, ... }: let - home = builtins.getEnv "HOME"; - username = builtins.getEnv "USER"; - email = builtins.getEnv "EMAIL"; system = "x86_64-linux"; - mvinkioPkgs = mvinkio.legacyPackages.${system}; - overlay = nixpkgs.lib.composeManyExtensions [ (import ./overlays/vimPlugins.nix {inherit pkgs;}) - (import ./overlays/suckless.nix {inherit pkgs home;}) + (import ./overlays/suckless.nix {inherit pkgs;}) ]; - pkgs = import nixpkgs { overlays = [ overlay ]; inherit system; }; - lib = (nixpkgs.lib.extend (_: _: home-manager.lib)).extend (import ./lib); - in with lib; { inherit lib; nixosConfigurations.lemptop = nixpkgs.lib.nixosSystem { inherit system; - modules = [./configuration.nix ./lemptop.nix sops-nix.nixosModules.sops]; - }; - - homeConfigurations.mike = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = - (attrValues - (attrsets.mergeAttrsList [ - (modulesIn ./home) - (modulesIn ./email) - ])) ++ [./home.nix]; - extraSpecialArgs = { - inherit inputs username email; - }; + modules = [ + ./nixos/configuration.nix + ./nixos/lemptop.nix + ] ++ (attrValues + (attrsets.mergeAttrsList [ + (modulesIn ./profiles/core) + (modulesIn ./profiles/station) + (modulesIn ./profiles/email) + ])); }; templates = { diff --git a/home.nix b/home.nix deleted file mode 100644 index 7b3b97c..0000000 --- a/home.nix +++ /dev/null @@ -1,243 +0,0 @@ -{ - flake, - username, - email, - config, - pkgs, - ... -}: { - programs.home-manager.enable = true; - home.homeDirectory = "/home/${username}"; - home.username = username; - home.stateVersion = "23.05"; - fonts.fontconfig.enable = true; - xdg = { - enable = true; - configFile = with config.lib.meta; { - "emacs/init.el".source = mkMutableSymlink ./emacs/init.el; - }; - mimeApps = { - enable = true; - defaultApplications = { - "text/x-shellscript" = ["text.desktop"]; - "x-scheme-handler/magnet" = ["torrent.desktop"]; - "application/x-bittorrent" = ["torrent.desktop"]; - "x-scheme-handler/mailto" = ["mail.desktop"]; - "text/plain" = ["text.desktop"]; - "application/postscript" = ["pdf.desktop"]; - "application/pdf" = ["pdf.desktop"]; - "image/png" = ["img.desktop"]; - "image/jpeg" = ["img.desktop"]; - "image/gif" = ["img.desktop"]; - "application/rss+xml" = ["rss.desktop"]; - "video/x-matroska" = ["video.desktop"]; - "video/mp4" = ["video.desktop"]; - "x-scheme-handler/lbry" = ["lbry.desktop"]; - "inode/directory" = ["file.desktop"]; - }; - }; - mime.enable = true; - desktopEntries = { - text= { type = "Application"; name = "Text editor"; exec = "${pkgs.st}/bin/st -e kak %u"; }; - file = { type = "Application"; name = "File Manager"; exec = "${pkgs.st}/bin/st -e lfub %u"; }; - torrent = { type = "Application"; name = "Torrent"; exec = "${pkgs.coreutils}/bin/env transadd %U"; }; - img = { type = "Application"; name = "Image Viewer"; exec = "${pkgs.sxiv}/bin/sxiv -a %u"; }; - video = { type = "Application"; name = "Video Viewer"; exec = "${pkgs.mpv}/bin/mpv -quiet %f"; }; - mail = { type = "Application"; name = "Mail"; exec = "${pkgs.st}/bin/st -e neomutt %u"; }; - pdf = { type = "Application"; name = "PDF reader"; exec = "${pkgs.zathura}/bin/zathura %u"; }; - rss = { type = "Application"; name = "RSS feed addition"; exec = "${pkgs.coreutils}/bin/env rssadd %u"; }; - }; - }; - - programs.ssh = { - enable = true; - matchBlocks = { - "*" = { - identityFile = "${config.home.homeDirectory}/.ssh/id_ed25519"; - }; - }; - }; - - home.sessionVariables = { - EDITOR = "kak"; - TERMINAL = "st"; - }; - - home.sessionPath = [ - "${config.home.homeDirectory}/.krew/bin" - "${config.home.homeDirectory}/.cargo/bin" - "${pkgs.ncurses}/bin" - ]; - - programs.starship.enable = true; - - programs.direnv = { - enable = true; - nix-direnv.enable = true; - }; - - programs.readline = { - enable = true; - extraConfig = '' - $if mode=vi - - set keymap vi-command - # these are for vi-command mode - Control-l: clear-screen - - set keymap vi-insert - # these are for vi-insert mode - Control-l: clear-screen - $endif - ''; - }; - - programs.emacs = { - enable = true; - }; - - programs.tmux = { - enable = true; - extraConfig = '' - set-option -g default-shell ${pkgs.bashInteractive}/bin/bash - set -s set-clipboard on - setw -g mouse on - set -g default-terminal "st-256color" - set -ga terminal-overrides ",xterm-256color:Tc" - set-option -g focus-events on - set-option -sg escape-time 10 - # unbind C-b - # set -g prefix C-space - # bind C-space send-prefix - - bind-key R source ${config.xdg.configHome}/tmux/tmux.conf; display-message "sourced ${config.xdg.configHome}/tmux/tmux.conf!" - - set-window-option -g mode-keys vi - bind-key -T copy-mode-vi v send -X begin-selection - bind-key -T copy-mode-vi V send -X select-line - bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard' - bind-key -T copy-mode-vi : command-prompt - - bind-key -T window k select-pane -t '{up-of}' - bind-key -T window j select-pane -t '{down-of}' - bind-key -T window l select-pane -t '{right-of}' - bind-key -T window h select-pane -t '{left-of}' - bind-key -T window = select-layout even-vertical - bind-key -T window o kill-pane -a - bind-key -T window _ resize-pane -y 90% - bind-key -T window n run-shell ' - window="$(tmux display -p "#{window_name}")" - if [[ "''${window##kakc@}" != "$window" ]]; then - tmux splitw "kak -c ''${window##kakc@}" - else - tmux splitw "kak -c ''${KAK_SERVER##kaks@}" - fi - ' - bind -n C-space switch-client -T window - - bind -n C-s run-shell tmux-normal-mode - bind -n C-q run-shell 'tmux-normal-mode --quit' - ''; - }; - - programs.bash = { - enable = true; - bashrcExtra = '' - export PATH=$PATH:$HOME/.local/bin - [[ -f ~/.cache/wal/sequences ]] && (cat ~/.cache/wal/sequences &) - unset LD_PRELOAD - if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then - . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' - fi - # include nix.sh if it exists - [[ -f ~/.nix-profile/etc/profile.d/nix.sh ]] && . ~/.nix-profile/etc/profile.d/nix.sh - # source some workspace specific stuff - [[ -f ~/env.sh ]] && . ~/env.sh - export COLORTERM=truecolor - export GPG_TTY="$(tty)" - export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - gpgconf --launch gpg-agent - ''; - shellAliases = { - e = "kakup "; - es = "kakup -f"; - k9s = "k9s"; - k = "kubectl "; - d = "docker "; - ls = "ls --color=auto"; - s = "sudo nixos-rebuild switch --flake ${config.home.homeDirectory}/flake#"; - b = "/run/current-system/bin/switch-to-configuration boot"; - h = "home-manager switch --flake ${config.home.homeDirectory}/flake --impure"; - fa = "azdo-switch-project"; - v = "nvim"; - V = "nvim -S .vimsession.vim"; - M = "xrandr --output HDMI1 --auto --output eDP1 --off"; - m = "xrandr --output eDP1 --auto --output HDMI1 --off"; - mM = "xrandr --output eDP1 --auto --output HDMI1 --off"; - newflake = "nix flake new -t ~/flake "; - ansible-flake = "nix flake new -t ~/flake#ansible "; - go-flake = "nix flake new -t ~/flake#go "; - lock-pass = "gpgconf --kill gpg-agent"; - }; - }; - - programs.nushell.enable = true; - - programs.git = { - enable = true; - userName = "Mike Vink"; - userEmail = email; - extraConfig = { - worktree.guessRemote = true; - mergetool.fugitive.cmd = "vim -f -c \"Gdiff\" \"$MERGED\""; - merge.tool = "fugitive"; - }; - ignores = [ - "/.direnv/" - "/.envrc" - "/.env" - ".vimsession.vim" - ]; - }; - - # https://github.com/drduh/config/blob/master/gpg.conf - # https://www.gnupg.org/documentation/manuals/gnupg/GPG-Configuration-Options.html - # https://www.gnupg.org/documentation/manuals/gnupg/GPG-Esoteric-Options.html - programs.gpg = { - enable = true; - scdaemonSettings = { - disable-ccid = true; - }; - settings = { - personal-cipher-preferences = "AES256 AES192 AES"; - personal-digest-preferences = "SHA512 SHA384 SHA256"; - personal-compress-preferences = "ZLIB BZIP2 ZIP Uncompressed"; - default-preference-list = "SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed"; - cert-digest-algo = "SHA512"; - s2k-digest-algo = "SHA512"; - s2k-cipher-algo = "AES256"; - charset = "utf-8"; - fixed-list-mode = true; - no-comments = true; - no-emit-version = true; - no-greeting = true; - keyid-format = "0xlong"; - list-options = "show-uid-validity"; - verify-options = "show-uid-validity"; - "with-fingerprint" = true; - require-cross-certification = true; - no-symkey-cache = true; - use-agent = true; - throw-keyids = true; - }; - }; - services.gpg-agent = { - enable = true; - enableSshSupport = true; - defaultCacheTtl = 34550000; - maxCacheTtl = 34550000; - }; - programs.password-store = { - enable = true; - }; -} diff --git a/home/codeium.nix b/home/codeium.nix deleted file mode 100644 index f3841b3..0000000 --- a/home/codeium.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - inputs, - config, - pkgs, - ... -}: let - codeium = with pkgs; stdenv.mkDerivation rec { - pname = "codeium"; - version = "1.1.39"; - - ls-sha = "c8fda9657259bb7f3d432c1b558db921db4257aa"; - - src = fetchurl { - url = "https://github.com/Exafunction/codeium/releases/download/language-server-v${version}/language_server_linux_x64.gz"; - sha256 = "sha256-LA1VVW4X30a8UD9aDUCTmBKVXM7G0WE7dSsZ73TaaVo="; - }; - - nativeBuildInputs = [ - autoPatchelfHook - ]; - - sourceRoot = "."; - - unpackPhase = '' - cp $src language_server_linux_x64.gz - gzip -d language_server_linux_x64.gz - ''; - - installPhase = '' - install -m755 -D language_server_linux_x64 $out - ''; - - preFixup = '' - patchelf \ - --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - $out - ''; - - meta = with lib; { - homepage = "https://www.codeium.com/"; - description = "Codeium language server"; - platforms = platforms.linux; - }; - }; -in { - home.activation = { - # links codeium into place - codium-symlink = inputs.home-manager.lib.hm.dag.entryAfter ["writeBoundary"] '' - CODEIUM_TARGET="${config.home.homeDirectory}/.codeium/bin/c8fda9657259bb7f3d432c1b558db921db4257aa" - if [ -L $CODEIUM_TARGET ] && [ -e $CODEIUM_TARGET ]; then - $DRY_RUN_CMD echo "codeium linked" - else - mkdir -p $CODEIUM_TARGET - $DRY_RUN_CMD ln -sf ${codeium} "$CODEIUM_TARGET/language_server_linux_x64" - fi - ''; - }; -} diff --git a/home/dwm b/home/dwm deleted file mode 160000 index 8aba669..0000000 --- a/home/dwm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8aba66977b5f5234e252ce0df0ebc8f205cad20e diff --git a/home/dwmblocks b/home/dwmblocks deleted file mode 160000 index a933ce0..0000000 --- a/home/dwmblocks +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a933ce0d6109524b393feb3e7156cbf0de88b42c diff --git a/home/kak-lsp.toml b/home/kak-lsp.toml deleted file mode 100644 index b0592cf..0000000 --- a/home/kak-lsp.toml +++ /dev/null @@ -1,428 +0,0 @@ -snippet_support = true -verbosity = 2 - -[server] -# exit session if no requests were received during given period in seconds -# set to 0 to disable -timeout = 1800 # seconds = 30 minutes - -[language.bash] -filetypes = ["sh"] -roots = [".git", ".hg"] -command = "bash-language-server" -args = ["start"] - -[language.c_cpp] -filetypes = ["c", "cpp"] -roots = ["compile_commands.json", ".clangd", ".git", ".hg"] -command = "clangd" - -[language.clojure] -filetypes = ["clojure"] -roots = ["project.clj", ".git", ".hg"] -command = "clojure-lsp" -settings_section = "_" -[language.clojure.settings._] -# See https://clojure-lsp.io/settings/#all-settings -# source-paths-ignore-regex = ["resources.*", "target.*"] - -[language.cmake] -filetypes = ["cmake"] -roots = ["CMakeLists.txt", ".git", ".hg"] -command = "cmake-language-server" - -[language.crystal] -filetypes = ["crystal"] -roots = ["shard.yml"] -command = "crystalline" - -[language.css] -filetypes = ["css"] -roots = ["package.json", ".git", ".hg"] -command = "vscode-css-languageserver" -args = ["--stdio"] - -[language.less] -filetypes = ["less"] -roots = ["package.json", ".git", ".hg"] -command = "vscode-css-languageserver" -args = ["--stdio"] - -[language.scss] -filetypes = ["scss"] -roots = ["package.json", ".git", ".hg"] -command = "vscode-css-languageserver" -args = ["--stdio"] - -[language.d] -filetypes = ["d", "di"] -roots = [".git", "dub.sdl", "dub.json"] -command = "dls" - -[language.dart] -# start shell to find path to dart analysis server source -filetypes = ["dart"] -roots = ["pubspec.yaml", ".git", ".hg"] -command = "sh" -args = ["-c", "dart $(dirname $(command -v dart))/snapshots/analysis_server.dart.snapshot --lsp"] - -[language.elixir] -filetypes = ["elixir"] -roots = ["mix.exs"] -command = "elixir-ls" -settings_section = "elixirLS" -[language.elixir.settings.elixirLS] -# See https://github.com/elixir-lsp/elixir-ls/blob/master/apps/language_server/lib/language_server/server.ex -# dialyzerEnable = true - -[language.elm] -filetypes = ["elm"] -roots = ["elm.json"] -command = "elm-language-server" -args = ["--stdio"] -settings_section = "elmLS" -[language.elm.settings.elmLS] -# See https://github.com/elm-tooling/elm-language-server#server-settings -runtime = "node" -elmPath = "elm" -elmFormatPath = "elm-format" -elmTestPath = "elm-test" - -[language.elvish] -filetypes = ["elvish"] -roots = [".git", ".hg"] -command = "elvish" -args = ["-lsp"] - -[language.erlang] -filetypes = ["erlang"] -# See https://github.com/erlang-ls/erlang_ls.git for more information and -# how to configure. This default config should work in most cases though. -roots = ["rebar.config", "erlang.mk", ".git", ".hg"] -command = "erlang_ls" - -[language.go] -filetypes = ["go"] -roots = ["Gopkg.toml", "go.mod", ".git", ".hg"] -command = "gopls" -settings_section = "gopls" -[language.go.settings.gopls] -# See https://github.com/golang/tools/blob/master/gopls/doc/settings.md -# "build.buildFlags" = [] - -[language.haskell] -filetypes = ["haskell"] -roots = ["hie.yaml", "cabal.project", "Setup.hs", "stack.yaml", "*.cabal"] -command = "haskell-language-server-wrapper" -args = ["--lsp"] -settings_section = "_" -[language.haskell.settings._] -# See https://haskell-language-server.readthedocs.io/en/latest/configuration.html -# haskell.formattingProvider = "ormolu" - -[language.html] -filetypes = ["html"] -roots = ["package.json"] -command = "vscode-html-languageserver" -args = ["--stdio"] - -# # Commented out by default because you still need to set the paths in the JDT -# # Language Server arguments below before this can become a valid configuration. -# [language.java] -# filetypes = ["java"] -# roots = [".git", "mvnw", "gradlew"] -# command = "java" -# args = [ -# "-Declipse.application=org.eclipse.jdt.ls.core.id1", -# "-Dosgi.bundles.defaultStartLevel=4", -# "-Declipse.product=org.eclipse.jdt.ls.core.product", -# "-Dlog.level=ALL", -# "-Dfile.encoding=utf-8", -# "--add-modules=ALL-SYSTEM", -# "--add-opens", -# "java.base/java.util=ALL-UNNAMED", -# "--add-opens", -# "java.base/java.lang=ALL-UNNAMED", -# "-noverify", -# "-Xmx1G", -# "-jar", -# "/path/to/eclipse.jdt.ls/repository/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar", -# "-configuration", -# "/path/to/eclipse.jdt.ls/repository/config_linux", -# "-data", -# "/path/to/eclipse-workspace", -# ] -# [language.java.settings] -# # See https://github.dev/eclipse/eclipse.jdt.ls -# # "java.format.insertSpaces" = true - -[language.jsx] # works for javascript as well -filetypes = ["javascript"] -roots = ["package.json", "tsconfig.json", ".git", ".hg"] -command = "typescript-language-server" -args = ["--stdio"] - -[language.json] -filetypes = ["json"] -roots = ["package.json"] -command = "vscode-json-languageserver" -args = ["--stdio"] - -# Requires Julia package "LanguageServer" -# Run: `julia --project=@kak-lsp -e 'import Pkg; Pkg.add("LanguageServer")'` to install it -# Configuration adapted from https://github.com/neovim/nvim-lspconfig/blob/bcebfac7429cd8234960197dca8de1767f3ef5d3/lua/lspconfig/julials.lua -[language.julia] -filetypes = ["julia"] -roots = ["Project.toml", ".git", ".hg"] -command = "julia" -args = [ - "--startup-file=no", - "--history-file=no", - "-e", - """ - ls_install_path = joinpath(get(DEPOT_PATH, 1, joinpath(homedir(), ".julia")), "environments", "kak-lsp"); - pushfirst!(LOAD_PATH, ls_install_path); - using LanguageServer; - popfirst!(LOAD_PATH); - depot_path = get(ENV, "JULIA_DEPOT_PATH", ""); - buffer_file = ENV["kak_buffile"]; - project_path = let - dirname(something( - # 1. Check if there is an explicitly set project - Base.load_path_expand(( - p = get(ENV, "JULIA_PROJECT", nothing); - p === nothing ? nothing : isempty(p) ? nothing : p - )), - # 2. Check for Project.toml in current working directory - Base.current_project(pwd()), - # 3. Check for Project.toml from buffer's full file path excluding the file name - Base.current_project(dirname(buffer_file)), - # 4. Fallback to global environment - Base.active_project() - )) - end - server = LanguageServer.LanguageServerInstance(stdin, stdout, project_path, depot_path); - server.runlinter = true; - run(server); - """, -] -[language.julia.settings] -# See https://github.com/julia-vscode/LanguageServer.jl/blob/master/src/requests/workspace.jl -# Format options. See https://github.com/julia-vscode/DocumentFormat.jl/blob/master/src/DocumentFormat.jl -# "julia.format.indent" = 4 -# Lint options. See https://github.com/julia-vscode/StaticLint.jl/blob/master/src/linting/checks.jl -# "julia.lint.call" = true -# Other options, see https://github.com/julia-vscode/LanguageServer.jl/blob/master/src/requests/workspace.jl -# "julia.lint.run" = "true" - -[language.latex] -filetypes = ["latex"] -roots = [".git", ".hg"] -command = "texlab" -settings_section = "texlab" -[language.latex.settings.texlab] -# See https://github.com/latex-lsp/texlab/wiki/Configuration -# -# Preview configuration for zathura with SyncTeX search. -# For other PDF viewers see https://github.com/latex-lsp/texlab/wiki/Previewing -forwardSearch.executable = "zathura" -forwardSearch.args = [ - "%p", - "--synctex-forward", # Support texlab-forward-search - "%l:1:%f", - "--synctex-editor-command", # Inverse search: use Control+Left-Mouse-Button to jump to source. - """ - sh -c ' - echo " - evaluate-commands -client %opt{texlab_client} %{ - evaluate-commands -try-client %opt{jumpclient} %{ - edit -- %{input} %{line} - } - } - " | kak -p $kak_session - ' - """, -] - -[language.lua] -filetypes = ["lua"] -roots = [".git", ".hg"] -command = "lua-language-server" -[language.lua.settings.Lua] -# See https://github.com/sumneko/vscode-lua/blob/master/setting/schema.json -# diagnostics.enable = true - -[language.nim] -filetypes = ["nim"] -roots = ["*.nimble", ".git", ".hg"] -command = "nimlsp" - -[language.nix] -filetypes = ["nix"] -roots = ["flake.nix", "shell.nix", ".git", ".hg"] -command = "rnix-lsp" - -[language.ocaml] -filetypes = ["ocaml"] -# Often useful to simply do a `touch dune-workspace` in your project root folder if you have problems with root detection -roots = ["dune-workspace", "dune-project", "Makefile", "opam", "*.opam", "esy.json", ".git", ".hg", "dune"] -command = "ocamllsp" - -[language.php] -filetypes = ["php"] -roots = [".htaccess", "composer.json"] -command = "intelephense" -args = ["--stdio"] -settings_section = "intelephense" -[language.php.settings] -intelephense.storagePath = "/tmp/intelephense" - -[language.proto] -filetypes = ["protobuf"] -roots = [".git", ".hg"] -command = "pls" # https://github.com/lasorda/protobuf-language-server - -[language.python] -filetypes = ["python"] -roots = ["requirements.txt", "setup.py", ".git", ".hg"] -command = "pyright-langserver" -args = ["--stdio"] -settings_section = "_" -[language.python.settings.python.analysis] -autoSearchPaths = true -diagnosticMode = "workspace" -useLibraryCodeForTypes = true - - -[language.r] -filetypes = ["r"] -roots = ["DESCRIPTION", ".git", ".hg"] -command = "R" -args = ["--slave", "-e", "languageserver::run()"] - -[language.racket] -filetypes = ["racket"] -roots = ["info.rkt"] -command = "racket" -args = ["-l", "racket-langserver"] - -[language.reason] -filetypes = ["reason"] -roots = ["package.json", "Makefile", ".git", ".hg"] -command = "ocamllsp" - -[language.ruby] -filetypes = ["ruby"] -roots = ["Gemfile"] -command = "solargraph" -args = ["stdio"] -settings_section = "_" -[language.ruby.settings._] -# See https://github.com/castwide/solargraph/blob/master/lib/solargraph/language_server/host.rb -# diagnostics = false - -# [language.rust] -# filetypes = ["rust"] -# roots = ["Cargo.toml"] -# command = "sh" -# args = [ -# "-c", -# """ -# if path=$(rustup which rls 2>/dev/null); then -# "$path" -# else -# rls -# fi -# """, -# ] -# [language.rust.settings.rust] -# # See https://github.com/rust-lang/rls#configuration -# # features = [] - -[language.rust] -filetypes = ["rust"] -roots = ["Cargo.toml"] -command = "sh" -args = [ - "-c", - """ - if path=$(rustup which rust-analyzer 2>/dev/null); then - "$path" - else - rust-analyzer - fi - """, -] -settings_section = "rust-analyzer" -[language.rust.settings.rust-analyzer] -# See https://rust-analyzer.github.io/manual.html#configuration -hoverActions.enable = false # kak-lsp doesn't support this at the moment -# cargo.features = [] - -[language.terraform] -filetypes = ["terraform"] -roots = ["*.tf"] -command = "terraform-ls" -args = ["serve"] -[language.terraform.settings.terraform-ls] -# See https://github.com/hashicorp/terraform-ls/blob/main/docs/SETTINGS.md -# rootModulePaths = [] - -[language.tsx] # works for typescript as well -filetypes = ["typescript"] -roots = ["package.json", "tsconfig.json", ".git", ".hg"] -command = "typescript-language-server" -args = ["--stdio"] - -# [language.typescript] -# filetypes = ["typescript"] -# roots = ["package.json", "tsconfig.json", ".git", ".hg"] -# command = "deno" -# args = ["lsp"] -# [language.typescript.settings.deno] -# enable = true -# lint = true - -[language.yaml] -filetypes = ["yaml"] -roots = [".git", ".hg"] -command = "yaml-language-server" -args = ["--stdio"] -[language.yaml.settings] -# See https://github.com/redhat-developer/yaml-language-server#language-server-settings -# Defaults are at https://github.com/redhat-developer/yaml-language-server/blob/master/src/yamlSettings.ts -# yaml.format.enable = true - -[language.zig] -filetypes = ["zig"] -roots = ["build.zig"] -command = "zls" - -[language.cs] -filetypes = ["cs"] -roots = [".git"] -command = "OmniSharp" -args = ["--encoding", "utf-8", "-z", "--languageserver", "DotNet:enablePackageRestore=false", "FormattingOptions:EnableEditorConfigSupport=true", "Sdk:IncludePrereleases=true"] - -# Semantic tokens support -# See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens -# for the default list of tokens and modifiers. -# However, many language servers implement their own values. -# Make sure to check the output of `lsp-capabilities` and each server's documentation and source code as well. -# Examples: -# - TypeScript: https://github.com/microsoft/vscode-languageserver-node/blob/main/client/src/common/semanticTokens.ts -# - Rust Analyzer: https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/syntax_highlighting.rs -[semantic_tokens] -faces = [ - {face="documentation", token="comment", modifiers=["documentation"]}, - {face="comment", token="comment"}, - {face="function", token="function"}, - {face="keyword", token="keyword"}, - {face="module", token="namespace"}, - {face="operator", token="operator"}, - {face="string", token="string"}, - {face="type", token="type"}, - {face="default+d", token="variable", modifiers=["readonly"]}, - {face="default+d", token="variable", modifiers=["constant"]}, - {face="variable", token="variable"}, -] diff --git a/home/kakoune.nix b/home/kakoune.nix deleted file mode 100644 index 41caf9f..0000000 --- a/home/kakoune.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - inputs, - flake, - config, - pkgs, - ... -}: - let - kakouneWithPlugins = pkgs.wrapKakoune pkgs.kakoune-unwrapped { configure = { plugins = with pkgs.kakounePlugins; [kak-lsp parinfer-rust]; }; }; - in { - home.packages = [kakouneWithPlugins]; - home.activation = { - kakoune-symlink = inputs.home-manager.lib.hm.dag.entryAfter ["writeBoundary"] '' - KAK_CONFIG="${config.home.homeDirectory}/kakoune" - XDG_CONFIG_HOME_KAK="${config.xdg.configHome}/kak" - if [ -L $XDG_CONFIG_HOME_KAK ] && [ -e $XDG_CONFIG_HOME_KAK ]; then - $DRY_RUN_CMD echo "kakoune linked" - else - $DRY_RUN_CMD ln -s $KAK_CONFIG $XDG_CONFIG_HOME_KAK - fi - rm -rf $XDG_CONFIG_HOME_KAK/autoload/default - ln -sf ${kakouneWithPlugins}/share/kak/autoload $XDG_CONFIG_HOME_KAK/autoload/default - ''; - }; - home.file."${config.xdg.configHome}/kak-lsp/kak-lsp.toml" = { - source = ./kak-lsp.toml; - }; - - #set global windowing_modules "" - #require-module tmux - #require-module tmux-repl - #alias global terminal tmux-terminal-vertical - #alias global sp new - -} diff --git a/home/meta.nix b/home/meta.nix deleted file mode 100644 index e6f3a78..0000000 --- a/home/meta.nix +++ /dev/null @@ -1,8 +0,0 @@ -{inputs,lib,config, ...}: with lib; { - lib.meta = { - configPath = "${config.home.homeDirectory}/flake"; - mkMutableSymlink = path: - config.lib.file.mkOutOfStoreSymlink - (config.lib.meta.configPath + removePrefix (toString inputs.self) (toString path)); - }; -} diff --git a/home/mpv.nix b/home/mpv.nix deleted file mode 100644 index 1b673ab..0000000 --- a/home/mpv.nix +++ /dev/null @@ -1,47 +0,0 @@ - -{ - flake, - config, - pkgs, - ... -}: { - programs.mpv = { - enable = true; - scripts = [ - (with pkgs; stdenv.mkDerivation rec { - pname = "mpv-sockets"; - version = "1.0"; - - src = fetchFromGitHub { - owner = "wis"; - repo = "mpvSockets"; - rev = "be9b7ca84456466e54331bab59441ac207659c1c"; - sha256 = "sha256-tcY+cHvkQpVNohZ9yHpVlq0bU7iiKMxeUsO/BRwGzAs="; - }; - - # installFlags = [ "SCRIPTS_DIR=$(out)/share/mpv/scripts" ]; - passthru.scriptName = "mpvSockets.lua"; - installPhase = '' - install -m755 -D mpvSockets.lua $out/share/mpv/scripts/mpvSockets.lua - ''; - - meta = with lib; { - description = "mpvSockets lua module for mpv"; - homepage = "https://github.com/wis/mpvSockets"; - license = licenses.mit; - platforms = platforms.linux; - }; - }) - ]; - config = { - gpu-context = "drm"; - }; - bindings = { - l="seek 5"; - h="seek -5"; - j="seek -60"; - k="seek 60"; - S="cycle sub"; - }; - }; -} diff --git a/home/neovim.nix b/home/neovim.nix deleted file mode 100644 index 8957c89..0000000 --- a/home/neovim.nix +++ /dev/null @@ -1,104 +0,0 @@ -{ - inputs, - config, - pkgs, - ... -}: { - home.activation = { - # fixes hotpot cannot be found error after updates - clearHotpotCache = inputs.home-manager.lib.hm.dag.entryAfter ["writeBoundary"] '' - HOTPOT_CACHE="${config.xdg.cacheHome}/nvim/hotpot" - if [[ -d "$HOTPOT_CACHE" ]]; then - $DRY_RUN_CMD rm -rf "$VERBOSE_ARG" "$HOTPOT_CACHE" - fi - ''; - }; - - xdg = { - configFile = with config.lib.meta; { - "nvim".source = mkMutableSymlink ../neovim; - }; - }; - - editorconfig = { - enable = true; - settings = { - "*" = { - trim_trailing_whitespace = true; - insert_final_newline = true; - }; - "*.yaml" = { - indent_style = "space"; - indent_size = 2; - }; - }; - }; - - programs.neovim = { - enable = true; - package = pkgs.neovim-unwrapped; - viAlias = true; - vimAlias = true; - extraPackages = with pkgs; [ - bashInteractive - sumneko-lua-language-server - pyright - gopls - fennel - fnlfmt - alejandra - statix - ]; - plugins = with pkgs.vimPlugins; [ - # highlighting - nvim-treesitter.withAllGrammars - nvim-treesitter-context - playground - gruvbox-material - kanagawa-nvim - lsp_lines-nvim - heirline-nvim - gitsigns-nvim - noice-nvim - nui-nvim - vim-helm - - # external - git-worktree-nvim - vim-dirvish - vim-fugitive - vim-dispatch - vim-oscyank - venn-nvim - gv-vim - - # Coding - plenary-nvim - telescope-nvim - nvim-lspconfig - null-ls-nvim - lsp_signature-nvim - omnisharp-extended-lsp-nvim - nvim-dap - nvim-dap-ui - luasnip - vim-test - vim-rest-console - harpoon - - # cmp - nvim-cmp - cmp-cmdline - cmp-nvim-lsp - cmp-buffer - cmp-path - cmp_luasnip - - # trying out lisp - conjure - vim-racket - nvim-parinfer - hotpot-nvim - ]; - }; -} diff --git a/home/newsboat.nix b/home/newsboat.nix deleted file mode 100644 index fc47060..0000000 --- a/home/newsboat.nix +++ /dev/null @@ -1,83 +0,0 @@ -{...}: { - programs.newsboat = { - enable = true; - autoReload = true; - urls = [ - {url = "https://github.com/neovim/neovim/releases.atom";} - {url = "https://github.com/rancher/rancher/releases.atom";} - {url = "https://github.com/istio/istio/releases.atom";} - {url = "https://github.com/argoproj/argo-cd/releases.atom";} - {url = "https://github.com/argoproj/argo-cd/releases.atom";} - {url = "https://github.com/kyverno/kyverno/releases.atom";} - {url = "https://github.com/hashicorp/terraform/releases.atom";} - {url = "https://github.com/ansible/ansible/releases.atom";} - {url = "https://github.com/ansible/awx/releases.atom";} - {url = "https://kubeshark.co/rss.xml";} - {url = "https://azurecomcdn.azureedge.net/en-us/updates/feed/?product=azure-devops";} - {url = "https://www.hashicorp.com/blog/categories/products-technology/feed.xml";} - {url = "https://kubernetes.io/feed.xml";} - {url = "https://www.cncf.io/rss";} - {url = "https://blog.alexellis.io/rss/";} - {url = "https://www.openfaas.com/feed";} - {url = "https://istio.io/latest/blog/feed.xml";} - {url = "https://www.youtube.com/feeds/videos.xml?channel_id=UCUyeluBRhGPCW4rPe_UvBZQ";} - ]; - extraConfig = '' - #show-read-feeds no - auto-reload yes - - external-url-viewer "urlscan -dc -r 'linkhandler {}'" - - bind-key j down - bind-key k up - bind-key j next articlelist - bind-key k prev articlelist - bind-key J next-feed articlelist - bind-key K prev-feed articlelist - bind-key G end - bind-key g home - bind-key d pagedown - bind-key u pageup - bind-key l open - bind-key h quit - bind-key a toggle-article-read - bind-key n next-unread - bind-key N prev-unread - bind-key D pb-download - bind-key U show-urls - bind-key x pb-delete - - color listnormal cyan default - color listfocus black yellow standout bold - color listnormal_unread blue default - color listfocus_unread yellow default bold - color info red black bold - color article white default bold - - browser linkhandler - macro , open-in-browser - macro t set browser "qndl" ; open-in-browser ; set browser linkhandler - macro a set browser "tsp yt-dlp --embed-metadata -xic -f bestaudio/best --restrict-filenames" ; open-in-browser ; set browser linkhandler - macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler - macro w set browser "lynx" ; open-in-browser ; set browser linkhandler - macro d set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler - macro c set browser "echo %u | xclip -r -sel c" ; open-in-browser ; set browser linkhandler - macro C set browser "youtube-viewer --comments=%u" ; open-in-browser ; set browser linkhandler - macro p set browser "peertubetorrent %u 480" ; open-in-browser ; set browser linkhandler - macro P set browser "peertubetorrent %u 1080" ; open-in-browser ; set browser linkhandler - - highlight all "---.*---" yellow - highlight feedlist ".*(0/0))" black - highlight article "(^Feed:.*|^Title:.*|^Author:.*)" cyan default bold - highlight article "(^Link:.*|^Date:.*)" default default - highlight article "https?://[^ ]+" green default - highlight article "^(Title):.*$" blue default - highlight article "\\[[0-9][0-9]*\\]" magenta default bold - highlight article "\\[image\\ [0-9]+\\]" green default bold - highlight article "\\[embedded flash: [0-9][0-9]*\\]" green default bold - highlight article ":.*\\(link\\)$" cyan default - highlight article ":.*\\(image\\)$" blue default - highlight article ":.*\\(embedded flash\\)$" magenta default - ''; - }; -} diff --git a/home/packages.nix b/home/packages.nix deleted file mode 100644 index 02c5b8e..0000000 --- a/home/packages.nix +++ /dev/null @@ -1,90 +0,0 @@ -{ - flake, - config, - pkgs, - username, - ... -}: let - core-packages = with pkgs; - [ - # nixopsnixops - age - sops - # k8s and friends - kubernetes-helm - kubectl - kind - krew - jq - yq-go - dasel - initool - python311Packages.editorconfig - gnutls - # other stuff - coreutils - dnsutils - iputils - inetutils - usbutils - gcc - pkgsi686Linux.glibc - gnumake - raylib - gdb - maim - calcurse - profanity - file - lf - ueberzug - mypaint - lynx - pstree - pywal - bashInteractive - k9s - powershell - azure-cli - htop - subversion - ripgrep - gnused - gnugrep - curl - inotify-tools - alejandra - statix - fzf - github-cli - lazygit - fd - argocd - parallel - bc - sxiv - nushell - sent - ] - ++ (import ../shell-scripts.nix {inherit pkgs config;}); - mike-extra-packages = with pkgs; [ - (nerdfonts.override {fonts = ["FiraCode"];}) - noto-fonts - noto-fonts-emoji - docker - k9s - dmenu - librewolf - firefox-wayland - xclip - libreoffice - ]; -in { - home.packages = - core-packages - ++ ( - if (username == "mike") - then mike-extra-packages - else [] - ); -} diff --git a/home/st b/home/st deleted file mode 160000 index e03a7d3..0000000 --- a/home/st +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e03a7d3f0b6bf4028389a82d372d0f89a922b9da diff --git a/home/suckless.nix b/home/suckless.nix deleted file mode 100644 index d10414d..0000000 --- a/home/suckless.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ - flake, - config, - pkgs, - suckless, - ... -}: let -in { - xsession = { - enable = true; - initExtra = '' - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "remove mod1 = Alt_R" - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "add mod3 = Alt_R" - wal -R - dwm - dwmblocks & - ''; - }; - services.picom = { - enable = true; - activeOpacity = 0.99; - inactiveOpacity = 0.7; - opacityRules = [ - "100:class_g = 'dwm'" - "100:name *= 'Firefox'" - "100:name *= 'mpv'" - "100:name *= 'LibreWolf'" - ]; - settings = { - inactive-opacity-override = false; - frame-opacity = 1; - }; - }; - services.dunst = { - enable = true; - settings = { - global = { - monitor = 0; - follow = "keyboard"; - width = 370; - height = 350; - offset = "0x19"; - padding = 2; - horizontal_padding = 2; - transparency = 25; - font = "Monospace 12"; - format = "%s\\n%b"; - }; - urgency_low = { - background = "#1d2021"; - foreground = "#928374"; - timeout = 3; - }; - urgency_normal = { - foreground = "#ebdbb2"; - background = "#458588"; - timeout = 5; - }; - urgency_critical = { - background = "#1cc24d"; - foreground = "#ebdbb2"; - frame_color = "#fabd2f"; - timeout = 10; - }; - }; - }; - home.packages = with pkgs; [ - st - dwm - dwmblocks - libnotify - ]; -} diff --git a/home/zathura.nix b/home/zathura.nix deleted file mode 100644 index 198f039..0000000 --- a/home/zathura.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - flake, - config, - pkgs, - ... -}: { - programs.zathura = { - enable = true; - extraConfig = '' - set sandbox none - set statusbar-h-padding 0 - set statusbar-v-padding 0 - set page-padding 1 - set selection-clipboard clipboard - map u scroll half-up - map d scroll half-down - map D toggle_page_mode - map r reload - map R rotate - map K zoom in - map J zoom out - map i recolor - map p print - map g goto top - ''; - }; -} diff --git a/installer b/installer deleted file mode 120000 index 5743a7f..0000000 --- a/installer +++ /dev/null @@ -1 +0,0 @@ -/nix/store/bc1gji3lg1yqs4c8yazdfdgwj2aqb676-nixos-yubikey-22.11beta-297654.gfedcba-x86_64-linux.iso \ No newline at end of file diff --git a/lemptop.nix b/lemptop.nix deleted file mode 100644 index 83bc2c9..0000000 --- a/lemptop.nix +++ /dev/null @@ -1,39 +0,0 @@ -# Do not modify this file! It was generated by β€˜nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - hardware.system76.enableAll = true; - services.xserver.videoDrivers = [ "intel" ]; - - boot.kernelPackages = pkgs.linuxPackages_latest; - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.kernelParams = [ "i915.force_probe=46a8" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/08ed8d2d-38be-4019-9a84-dbded2cd0649"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/655D-8467"; - fsType = "vfat"; - }; - - swapDevices = [ ]; - - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/lib/default.nix b/lib/default.nix index 56348bb..196b76b 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -12,4 +12,8 @@ lib: prev: with lib; { concatLists listToAttrs ]; + + # Collects the inputs of a flake recursively (with possible duplicates). + collectFlakeInputs = input: + [ input ] ++ concatMap collectFlakeInputs (builtins.attrValues (input.inputs or {})); } diff --git a/machines/lemptop.nix b/machines/lemptop.nix new file mode 100644 index 0000000..83bc2c9 --- /dev/null +++ b/machines/lemptop.nix @@ -0,0 +1,39 @@ +# Do not modify this file! It was generated by β€˜nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + hardware.system76.enableAll = true; + services.xserver.videoDrivers = [ "intel" ]; + + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.kernelParams = [ "i915.force_probe=46a8" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/08ed8d2d-38be-4019-9a84-dbded2cd0649"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/655D-8467"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/nix.nix b/modules/nix.nix deleted file mode 100644 index 0967ef4..0000000 --- a/modules/nix.nix +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/mut/bin/checkout b/mut/bin/checkout new file mode 100644 index 0000000..95f28c8 --- /dev/null +++ b/mut/bin/checkout @@ -0,0 +1,69 @@ +#!@bash@/bin/bash +error () { + echo "$1" + exit 1 +} + +. <(pass show work/env) +DEST_DIR="" +case "${@}" in + az|"az "*) + shift + LIST_PROJECTS="/_apis/projects?api-version=7.1-preview.4" + AUTH_HEADER="Authorization: Basic $(echo -n ":$GIT_PASS" | base64)" + LIST_REPOSITORIES="/_apis/git/repositories?api-version=7.1-preview.1" + GIT_DIR="$HOME/projects/" + if [ ! -d $GIT_DIR ]; then + mkdir -p $GIT_DIR + fi + MAX_REPOS=20 + + echo "curl -s -H \"$AUTH_HEADER\" $WORK_AZDO_GIT_ORG_URL$LIST_PROJECTS" + PROJECT=$(curl -s -H "$AUTH_HEADER" $WORK_AZDO_GIT_ORG_URL$LIST_PROJECTS \ + | jq ' + .value[].name + ' \ + | xargs -I{} bash -c " + curl -s -H '$AUTH_HEADER' $WORK_AZDO_GIT_ORG_URL/{}$LIST_REPOSITORIES \ + | jq ' + .value[].name + ' \ + | awk '{ gsub(/\"/, \"\", \$1); printf \"{}/_git/%s\\n\", \$1 }' + " \ + | fzf) + + DEST_DIR="$GIT_DIR/$(echo $PROJECT | cut -d '/' -f3)" + if [ ! -d $DEST_DIR ] + then + git clone --bare $WORK_AZDO_GIT_ORG_URL/$PROJECT $DEST_DIR + fi + ;; + gh|"gh "*) + shift + repo=$(gh repo list --json owner,name -q '.[] | "\(.owner.login)/\(.name)"' | fzf --print-query -1) + GIT_DIR="$HOME/projects" + if [ ! -d $GIT_DIR ]; then + mkdir -p $GIT_DIR + fi + + if [[ "$(echo "$repo" | wc -l)" -ne 1 ]]; then + echo "Fetching my repo" + repo="$(echo "$repo" | tail -n1)" + fi + + DEST_DIR="$GIT_DIR/$(echo $repo | cut -d '/' -f2)" + if [ ! -d $DEST_DIR ] + then + gh repo clone $repo $DEST_DIR -- --bare + fi + ;; + *) + error "Don't know how to fetch this" + ;; +esac + +if ! [[ -z "$DEST_DIR" ]]; then + cd $DEST_DIR + git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" + $EDITOR "$DEST_DIR" +fi diff --git a/mut/bin/compile b/mut/bin/compile new file mode 100755 index 0000000..04c0586 --- /dev/null +++ b/mut/bin/compile @@ -0,0 +1,40 @@ +#!@bash@/bin/bash +echo " Compiliiing ${@}" + +error () { + echo "$1" + exit 1 +} + +case "${@}" in + racket*) + shift + echo " \-> racket -l errortrace -t ${@}" + racket -l errortrace -t ${@} + ;; + ansible-lint*) + shift + echo " \-> ansible-lint --profile production --write=all -qq --nocolor" + ansible-lint --profile production --write=all -qq --nocolor ${@} + ;; + ansible-playbook*) + shift + echo " \-> ansible-playbook -e@<(pass)" + ansible-playbook -b -e "{\"ansible_become_pass\":\"$PASSWORD\"}" ${@} + ;; + awx*) + echo " \-> awx" + shift + awx "$@" | filter-ansi + ;; + helm\ lint*) + shift + shift + echo " \-> helm lint --set cluster=debug-cluster --strict --quiet --with-subcharts ${@}" + helm lint --set cluster=debug-cluster --strict --quiet --with-subcharts ${@} | sed -u -E -e "s@$(basename ${PWD})/|error during tpl function execution for \".*\"@@g" + ;; + *) + echo " \-> ${@}" + ${@} + ;; +esac diff --git a/mut/bin/filter-ansi b/mut/bin/filter-ansi new file mode 100755 index 0000000..369f9fd --- /dev/null +++ b/mut/bin/filter-ansi @@ -0,0 +1,2 @@ +# #!@bash@/bin/bash +cat -u - | sed -u -E -e 's/\x1b\[[0-9;]*[mGKHF]|\r//g' diff --git a/mut/bin/get-sshables b/mut/bin/get-sshables new file mode 100755 index 0000000..f67c23c --- /dev/null +++ b/mut/bin/get-sshables @@ -0,0 +1,7 @@ +#!/bin/bash +set -euxo pipefail +[[ -d ~/sshables ]] || mkdir -p ~/sshables + +for cluster in $(kubectl config get-clusters | tail -n +2); do + [[ -f ~/sshables/$cluster ]] || { echo $cluster; kubectl --context $cluster get nodes -oname > ~/sshables/$cluster; } +done diff --git a/mut/bin/kakup b/mut/bin/kakup new file mode 100755 index 0000000..af1a520 --- /dev/null +++ b/mut/bin/kakup @@ -0,0 +1,100 @@ +#!@bash@/bin/bash +session-or-client() { + { + project="$(cat -)" + if [[ -z $project ]]; then + return + fi + pushd $project + name=${PWD#$HOME/} + name=${name//\//-} + name=${name#-} + server=kaks@$name + client=kakc@$name + TMUX_ENV="-e KAK_SERVER=$server -e KAK_CLIENT=$client" + + tmux has-session -t $server || { + tmux new $TMUX_ENV -d -s $server -n $server bash -c '[[ -f .envrc ]] && eval "$(direnv export bash)"; { kak -s '$name' -d & }; tmux wait -S '$name'; wait' + tmux wait "$name" + } + if [[ -z $TMUX ]] || [ $SWITCH_TO_SESSION -eq 1 ]; then + tmux has-session -t $client || tmux new $TMUX_ENV -d -s $client -n $client kak -c $name + fi + popd + } debug 2>&1 + echo $client +} + +search() { + if tty -s + then + project="$(fd -d1 "." -t d $HOME $HOME/projects | fzf -1)" + else + output=$(mktemp -d /tmp/kakup.XXXXXXXX)/fifo + mkfifo ${output} + st -e bash -c "fd -d1 '.' -t d $HOME $HOME/projects | fzf -1 | tee ${output} >/dev/null 2>&1" & + project="$(cat ${output})" + rm -r $(dirname ${output}) + fi + + pushd $project >/dev/null 2>&1 + if grep 'bare = true' config >/dev/null 2>&1 ; then + if tty -s + then + branch="$(git branch -a --format '%(refname)' | fzf -1)" + else + output=$(mktemp -d /tmp/kakup.XXXXXXXX)/fifo + mkfifo ${output} + st -e bash -c "git branch -a --format '%(refname)' | fzf -1 >${output}" & + branch="$(cat ${output})" + rm -r $(dirname ${output}) + fi + echo "$branch" >debug 2>&1 + if [[ "$branch" == "refs/remotes/"* ]]; then + git branch ${branch#refs/remotes/*/} -t $branch >debug 2>&1 + git worktree add ${branch#refs/remotes/*/} ${branch#refs/remotes/*/} >debug 2>&1 + branch="${branch#refs/remotes/*/}" + elif [[ "$branch" == "refs/heads/"* ]]; then + branch="${branch#refs/heads/}" + git worktree add $branch $branch >debug 2>&1 + fi + echo "$project/$branch" + else + echo "$project" + fi + popd >/dev/null 2>&1 +} + +NEW_TERM=0 +SWITCH_TO_SESSION=0 +while getopts "tfF" opt; do + case "$opt" in + h|\?) exit 0 ;; + t) NEW_TERM=1 ;; + f) client="$(search | session-or-client)" ;; + F) SWITCH_TO_SESSION=1; client="$(search | session-or-client)" ;; + esac +done + +shift $((OPTIND - 1)) + +[ -z "$client" ] && { + case "${@}" in + "") client="$(pwd | session-or-client)" ;; + *) client="$(echo "${@}" | session-or-client)" ;; + esac +} + +[[ ! -z "$client" ]] && { + if [ $NEW_TERM -eq 1 ]; then + st -e tmux attach -t "$client" + elif [[ -z $TMUX ]]; then + tmux attach -t "$client" + else + if [ $SWITCH_TO_SESSION -eq 0 ]; then + tmux new-window -n $client kak -c ${client##kakc@} + else + tmux switch -t $client + fi + fi +} diff --git a/mut/bin/kubeconfig-merge b/mut/bin/kubeconfig-merge new file mode 100644 index 0000000..73d3ac1 --- /dev/null +++ b/mut/bin/kubeconfig-merge @@ -0,0 +1,3 @@ +#!@bash@/bin/bash +cp $HOME/.kube/config /tmp/.kube_config +KUBECONFIG=$1:/tmp/.kube_config kubectl config view --flatten > $HOME/.kube/config diff --git a/mut/bin/lfub b/mut/bin/lfub new file mode 100644 index 0000000..9012f50 --- /dev/null +++ b/mut/bin/lfub @@ -0,0 +1,24 @@ +#!/bin/sh + +# This is a wrapper script for lb that allows it to create image previews with +# ueberzug. This works in concert with the lf configuration file and the +# lf-cleaner script. + +set -e + +cleanup() { + exec 3>&- + rm "$FIFO_UEBERZUG" +} + +if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$@" +else + [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf" + export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanup HUP INT QUIT TERM PWR EXIT + lf "$@" 3>&- +fi diff --git a/mut/bin/linkhandler b/mut/bin/linkhandler new file mode 100755 index 0000000..f62b581 --- /dev/null +++ b/mut/bin/linkhandler @@ -0,0 +1,26 @@ +#!/bin/sh + +# Feed script a url or file location. +# If an image, it will view in sxiv, +# if a video or gif, it will view in mpv +# if a music file or pdf, it will download, +# otherwise it opens link in browser. + +if [ -z "$1" ]; then + url="$(xclip -o)" +else + url="$1" +fi + +case "$url" in + *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) + setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;; + *png|*jpg|*jpe|*jpeg|*gif) + curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; + *pdf|*cbz|*cbr) + curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; + *mp3|*flac|*opus|*mp3?source*) + qndl "$url" 'curl -LO' >/dev/null 2>&1 ;; + *) + [ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1 +esac diff --git a/mut/bin/mailsync b/mut/bin/mailsync new file mode 100644 index 0000000..426e5b7 --- /dev/null +++ b/mut/bin/mailsync @@ -0,0 +1,112 @@ +#!/bin/sh + +# - Syncs mail for all accounts, or a single account given as an argument. +# - Displays a notification showing the number of new mails. +# - Displays a notification for each new mail with its subject displayed. +# - Runs notmuch to index new mail. +# - This script can be set up as a cron job for automated mail syncing. + +# There are many arbitrary and ugly features in this script because it is +# inherently difficult to pass environmental variables to cronjobs and other +# issues. It also should at least be compatible with Linux (and maybe BSD) with +# Xorg and MacOS as well. + +# Run only if not already running in other instance +pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;} + +# First, we have to get the right variables for the mbsync file, the pass +# archive, notmuch and the GPG home. This is done by searching common profile +# files for variable assignments. This is ugly, but there are few options that +# will work on the maximum number of machines. +eval "$(grep -h -- \ + "^\s*\(export \)\?\(MBSYNCRC\|MPOPRC\|PASSWORD_STORE_DIR\|PASSWORD_STORE_GPG_OPTS\|NOTMUCH_CONFIG\|GNUPGHOME\|MAILSYNC_MUTE\|XDG_CONFIG_HOME\|XDG_DATA_HOME\)=" \ + "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ + "$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ + "$HOME/.pam_environment" 2>/dev/null)" + +export GPG_TTY="$(tty)" + +[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" +[ -n "$MPOPRC" ] || MPOPRC="$HOME/.config/mpop/config" + +lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/neomutt/.mailsynclastrun" + +# Settings are different for MacOS (Darwin) systems. +case "$(uname)" in + Darwin) notify() { osascript -e "display notification \"$2\" with title \"$1\"" ;} ;; + *) + case "$(readlink -f /sbin/init)" in + *systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; + esac + # remember if a display server is running since `ps` doesn't always contain a display + pgrepoutput="$(pgrep -ax X\(\|org\|wayland\))" + displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" + [ -z "$displays" ] && [ -d /tmp/.X11-unix ] && displays=$(cd /tmp/.X11-unix && for x in X*; do echo ":${x#X}"; done) + + notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do + export DISPLAY="$x" + notify-send --app-name="mutt-wizard" "$1" "$2" + done ;} + ;; +esac + +# Check account for new mail. Notify if there is new content. +syncandnotify() { + case "$1" in + imap) mbsync -q "$2" ;; + pop) mpop -q "$2" ;; + esac + new=$(find\ + "$HOME/.local/share/mail/${2%%-*}/"[Ii][Nn][Bb][Oo][Xx]/new/ \ + "$HOME/.local/share/mail/${2%%-*}/"[Ii][Nn][Bb][Oo][Xx]/cur/ \ + -type f -newer "$lastrun" 2> /dev/null) + newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) + case 1 in + $((newcount > 5)) ) + echo "$newcount new mail for $2." + [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "πŸ“¬ $newcount new mail(s) in \`$2\` account." + ;; + $((newcount > 0)) ) + echo "$newcount new mail for $2." + [ -z "$MAILSYNC_MUTE" ] && + for file in $new; do + # Extract and decode subject and sender from mail. + subject="$(sed -n "/^Subject:/ s|Subject: *|| p" "$file" | + perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" + from="$(sed -n "/^From:/ s|From: *|| p" "$file" | + perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" + from="${from% *}" ; from="${from%\"}" ; from="${from#\"}" + notify "πŸ“§$from:" "$subject" + done + ;; + *) echo "No new mail for $2." ;; +esac +} + +allgroups="$(grep -hs "Group" "$MBSYNCRC" "$MPOPRC" | sort -u)" + +# Get accounts to sync. All if no argument. Prefix with `error` if non-existent. +IFS=' +' +if [ -z "$1" ]; then + tosync="$allgroups" +else + tosync="$(for arg in "$@"; do for grp in $allgroups; do + [ "$arg" = "${grp##* }" ] && echo "$grp" && break + done || echo "error $arg"; done)" +fi + +for grp in $tosync; do + case $grp in + Group*) syncandnotify imap "${grp##* }" & ;; + account*) syncandnotify pop "${grp##* }" & ;; + error*) echo "ERROR: Account ${channelt##* } not found." ;; + esac +done + +wait + +notmuch-hook + +#Create a touch file that indicates the time of the last run of mailsync +touch "$lastrun" diff --git a/mut/bin/maimpick b/mut/bin/maimpick new file mode 100644 index 0000000..5de26c1 --- /dev/null +++ b/mut/bin/maimpick @@ -0,0 +1,18 @@ +#!/bin/sh + +# This is bound to Shift+PrintScreen by default, requires maim. It lets you +# choose the kind of screenshot to take, including copying the image or even +# highlighting an area to copy. scrotcucks on suicidewatch right now. + +# variables +output="$(date '+%y%m%d-%H%M-%S').png" +xclip_cmd="xclip -sel clip -t image/png" + +case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in + "a selected area") maim -u -s pic-selected-"${output}" ;; + "current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;; + "full screen") maim -q -d 0.2 pic-full-"${output}" ;; + "a selected area (copy)") maim -u -s | ${xclip_cmd} ;; + "current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;; + "full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;; +esac diff --git a/mut/bin/news b/mut/bin/news new file mode 100755 index 0000000..097582b --- /dev/null +++ b/mut/bin/news @@ -0,0 +1,5 @@ +#!@bash@/bin/bash +cat <(cat ~/.config/newsboat/urls) <(for url in $(env | grep NEWSBOAT_URL_); do + printf '%s\n' ${url#NEWSBOAT_URL_*=} +done) > ~/.newsboat-urls +newsboat -u ~/.newsboat-urls diff --git a/mut/bin/nixup b/mut/bin/nixup new file mode 100755 index 0000000..afbe4b1 --- /dev/null +++ b/mut/bin/nixup @@ -0,0 +1,94 @@ +#!@bash@/bin/bash +case "${@}" in + bootstrap-store) + [[ -d ${HOME}/nix ]] || { + docker create --name nix-data-${USER} nixos/nix sh >/dev/null 2>&1 + sudo docker cp nix-data-${USER}:/nix ~ + docker rm nix-data-${USER} + } + docker create -v ${HOME}/nix:/nix --name nix-data-${USER} nixos/nix sh + ;; + nuke) + docker rm nix-data-${USER} + docker rm nixos-${USER} + ;; + "") + if ! docker image ls | grep nixos-${USER}; then + cat > /tmp/docker-build-${USER} < /etc/nsswitch.conf + +# Download Nix and install it into the system. +ARG NIX_VERSION=2.3.14 +RUN wget https://nixos.org/releases/nix/nix-\${NIX_VERSION}/nix-\${NIX_VERSION}-\$(uname -m)-linux.tar.xz \ + && tar xf nix-\${NIX_VERSION}-\$(uname -m)-linux.tar.xz \ + && addgroup -g 30000 -S nixbld \ + && for i in \$(seq 1 30); do adduser -S -D -h /var/empty -g "Nix build user \$i" -u \$((30000 + i)) -G nixbld nixbld\$i ; done \ + && mkdir -m 0755 /etc/nix \ + && echo 'sandbox = false' > /etc/nix/nix.conf \ + && mkdir -m 0755 /nix && USER=root sh nix-\${NIX_VERSION}-\$(uname -m)-linux/install \ + && ln -s /nix/var/nix/profiles/default/etc/profile.d/nix.sh /etc/profile.d/ \ + && rm -r /nix-\${NIX_VERSION}-\$(uname -m)-linux* \ + && /nix/var/nix/profiles/default/bin/nix-collect-garbage --delete-old \ + && /nix/var/nix/profiles/default/bin/nix-store --optimise \ + && /nix/var/nix/profiles/default/bin/nix-store --verify --check-contents + +# Somehow this file is missing? +RUN mkdir -p /etc/bash && touch /etc/bash/bashrc + +ONBUILD ENV \ + ENV=/etc/profile \ + USER=root \ + PATH=/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin \ + GIT_SSL_CAINFO=/etc/ssl/certs/ca-certificates.crt \ + NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt + +ENV \ + ENV=/etc/profile \ + USER=root \ + PATH=/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin \ + GIT_SSL_CAINFO=/etc/ssl/certs/ca-certificates.crt \ + NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \ + NIX_PATH=/nix/var/nix/profiles/per-user/root/channels + +# Add your user the alpine way +RUN apk add --no-cache --update shadow \ + && groupadd -g $(getent group docker | cut -d: -f3) docker \ + && groupadd -g $(id -g) ${USER} \ + && useradd -g $(id -g) --groups wheel,docker -u $(id -u) ${USER} \ + && rm -rf /var/cache/apk/* +EOF + docker build . -t nixos-${USER} -f /tmp/docker-build-${USER} + fi + docker run --volumes-from=nix-data-${USER} --rm -it \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /etc/kube:/etc/kube \ + -v /etc/ssl/certs/ca-bundle.crt:/etc/ssl/certs/ca-bundle.crt \ + -v /etc/ssl/certs/ca-bundle.crt:/etc/ssl/certs/ca-certificates.crt \ + -e GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt \ + -e NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt \ + -e SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt \ + -e no_proxy=$no_proxy \ + -e http_proxy=$http_proxy \ + -e https_proxy=$http_proxy \ + -e SHELL=bash \ + -e USER=${USER} \ + -u $(id -u):$(id -g) \ + --group-add wheel \ + --group-add docker \ + -v ${HOME}:${HOME} \ + -w ${HOME} \ + --name nixos-${USER} \ + --network host \ + nixos-${USER} bash --login + ;; + clear) + docker run --rm --volumes-from=nix-data-${USER} nixos/nix nix-collect-garbage -d + ;; + list) + docker run --rm --volumes-from nix-data-${USER} nixos/nix ls -la /nix + ;; +esac diff --git a/mut/bin/notmuch-hook b/mut/bin/notmuch-hook new file mode 100644 index 0000000..da376b6 --- /dev/null +++ b/mut/bin/notmuch-hook @@ -0,0 +1,17 @@ +. <(pass show personal/notmuch) +notmuch new --quiet +notmuch tag -new +unread +jobs -- 'tag:new and (from:jobs-listings* or from:jobs-noreply*)' +notmuch tag -new +unread +houses -- 'tag:new and (from:"'$MAKELAAR'" or thread:{'$MAKELAAR'})' +notmuch tag -new -inbox +unread +dev -- 'tag:new and (from:/.*github.com/ or thread:{from:/.*github.com/})' + +notmuch tag -new +inbox +unread -- tag:new + +# Gmail + mbsync = a lot of duplicates due to the archive +notmuch tag -new -inbox +archive -- 'folder:/Archive/ -folder:/Inbox/ -folder:/\[Gmail\]/ -folder:/FarDrafts/ -folder:/Important/ -folder:/Sent/' + +# Tag messages with files that were moved to trash in neomutt +notmuch tag --remove-all +trash -- folder:/Trash/ +# Same but with messages with files that were moved to spam +notmuch tag --remove-all +spam -- folder:/Spam/ +# Remove files of messages that were tagged but still have files left behind in the mailbox, should be fine since gmail already keeps a duplicate in the Archive so the message will not be deleted only one file of the message +notmuch search --output=files -- 'folder:/Inbox/ -tag:inbox' | grep Inbox | xargs >/dev/null 2>&1 rm diff --git a/mut/bin/openfile b/mut/bin/openfile new file mode 100644 index 0000000..0f60b10 --- /dev/null +++ b/mut/bin/openfile @@ -0,0 +1,10 @@ +#!/bin/sh + +# Helps open a file with xdg-open from mutt in a external program without weird side effects. +tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" +file="$tempdir/${1##*/}" +[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" +mkdir -p "$tempdir" +cp -f "$1" "$file" +$opener "$file" >/dev/null 2>&1 +find "${tempdir:?}" -mtime +1 -type f -delete diff --git a/mut/bin/pass-ansible-vault-client b/mut/bin/pass-ansible-vault-client new file mode 100755 index 0000000..8b8d026 --- /dev/null +++ b/mut/bin/pass-ansible-vault-client @@ -0,0 +1,17 @@ +#!@bash@/bin/bash +VAULT_ID="" +while [[ $# -gt 0 ]]; do + case $1 in + --vault-id) + VAULT_ID=$2 + shift + shift + ;; + --vault-id=*) + VAULT_ID="${1#*=}" + shift + ;; + esac +done + +pass show work/ansible-vault/$VAULT_ID diff --git a/mut/bin/sb-battery b/mut/bin/sb-battery new file mode 100644 index 0000000..aeb7413 --- /dev/null +++ b/mut/bin/sb-battery @@ -0,0 +1,37 @@ +#!/bin/sh + +# Prints all batteries, their percentage remaining and an emoji corresponding +# to charge status (πŸ”Œ for plugged up, πŸ”‹ for discharging on battery, etc.). + +case $BUTTON in + 3) notify-send "πŸ”‹ Battery module" "πŸ”‹: discharging +πŸ›‘: not charging +β™»: stagnant charge +πŸ”Œ: charging +⚑: charged +❗: battery very low! +- Scroll to change adjust xbacklight." ;; + 4) xbacklight -inc 10 ;; + 5) xbacklight -dec 10 ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +# Loop through all attached batteries and format the info +for battery in /sys/class/power_supply/BAT?*; do + # If non-first battery, print a space separator. + [ -n "${capacity+x}" ] && printf " " + # Sets up the status and capacity + case "$(cat "$battery/status" 2>&1)" in + "Full") status="⚑" ;; + "Discharging") status="πŸ”‹" ;; + "Charging") status="πŸ”Œ" ;; + "Not charging") status="πŸ›‘" ;; + "Unknown") status="♻️" ;; + *) exit 1 ;; + esac + capacity="$(cat "$battery/capacity" 2>&1)" + # Will make a warn variable if discharging and low + [ "$status" = "πŸ”‹" ] && [ "$capacity" -le 25 ] && warn="❗" + # Prints the info + printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn +done && printf "\\n" diff --git a/mut/bin/sb-clock b/mut/bin/sb-clock new file mode 100644 index 0000000..ba9e43d --- /dev/null +++ b/mut/bin/sb-clock @@ -0,0 +1,29 @@ +#!/bin/sh + +clock=$(date '+%I') + +case "$clock" in + "00") icon="πŸ•›" ;; + "01") icon="πŸ•" ;; + "02") icon="πŸ•‘" ;; + "03") icon="πŸ•’" ;; + "04") icon="πŸ•“" ;; + "05") icon="πŸ•”" ;; + "06") icon="πŸ••" ;; + "07") icon="πŸ•–" ;; + "08") icon="πŸ•—" ;; + "09") icon="πŸ•˜" ;; + "10") icon="πŸ•™" ;; + "11") icon="πŸ•š" ;; + "12") icon="πŸ•›" ;; +esac + +case $BUTTON in + 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s|..0m||")" && notify-send "Appointments" "$(calcurse -d3)" ;; + 2) setsid -f "$TERMINAL" -e calcurse ;; + 3) notify-send "πŸ“… Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` +- Middle click opens calcurse if installed" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +date "+%Y %b %d (%a) $icon%I:%M%p" diff --git a/mut/bin/sb-internet b/mut/bin/sb-internet new file mode 100644 index 0000000..225d376 --- /dev/null +++ b/mut/bin/sb-internet @@ -0,0 +1,26 @@ +#!/bin/sh + +# Show wifi πŸ“Ά and percent strength or πŸ“‘ if none. +# Show 🌐 if connected to ethernet or ❎ if none. +# Show πŸ”’ if a vpn connection is active + +case $BUTTON in + 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; + 3) notify-send "🌐 Internet module" "\- Click to connect +❌: wifi disabled +πŸ“‘: no wifi connection +πŸ“Ά: wifi connection with quality +❎: no ethernet +🌐: ethernet working +πŸ”’: vpn is active +" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then + wifiicon="$(awk '/^\s*w/ { print "πŸ“Ά", int($3 * 100 / 70) "% " }' /proc/net/wireless)" +elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then + grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="πŸ“‘ " || wifiicon="❌ " +fi + +printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/πŸ”’/" /sys/class/net/tun*/operstate 2>/dev/null)" diff --git a/mut/bin/sb-mailbox b/mut/bin/sb-mailbox new file mode 100644 index 0000000..ab1669e --- /dev/null +++ b/mut/bin/sb-mailbox @@ -0,0 +1,20 @@ +#!/bin/sh + +# Displays number of unread mail and an loading icon if updating. +# When clicked, brings up `neomutt`. + +case $BUTTON in + 1) setsid -f "$TERMINAL" -e neomutt ;; + 2) setsid -f mailsync >/dev/null ;; + 3) notify-send "πŸ“¬ Mail module" "\- Shows unread mail +- Shows πŸ”ƒ if syncing mail +- Left click opens neomutt +- Middle click syncs mail" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" + +pidof mbsync >/dev/null 2>&1 && icon="πŸ”ƒ" + +[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "πŸ“¬$unread$icon" diff --git a/mut/bin/sb-nettraf b/mut/bin/sb-nettraf new file mode 100644 index 0000000..06b3c49 --- /dev/null +++ b/mut/bin/sb-nettraf @@ -0,0 +1,29 @@ +#!/bin/sh + +# Module showing network traffic. Shows how much data has been received (RX) or +# transmitted (TX) since the previous time this script ran. So if run every +# second, gives network traffic per second. + +case $BUTTON in + 1) setsid -f "$TERMINAL" -e bmon ;; + 3) notify-send "🌐 Network traffic module" "πŸ”»: Traffic received +πŸ”Ί: Traffic transmitted" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +update() { + sum=0 + for arg; do + read -r i < "$arg" + sum=$(( sum + i )) + done + cache=/tmp/${1##*/} + [ -f "$cache" ] && read -r old < "$cache" || old=0 + printf %d\\n "$sum" > "$cache" + printf %d\\n $(( sum - old )) +} + +rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) +tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) + +printf "πŸ”»%4sB πŸ”Ί%4sB\\n" $(numfmt --to=iec $rx $tx) diff --git a/mut/bin/sb-news b/mut/bin/sb-news new file mode 100644 index 0000000..a155c0a --- /dev/null +++ b/mut/bin/sb-news @@ -0,0 +1,17 @@ +#!/bin/sh + +# Displays number of unread news items and an loading icon if updating. +# When clicked, brings up `newsboat`. + +case $BUTTON in + 1) setsid "$TERMINAL" -e newsboat ;; + 2) setsid -f newsup >/dev/null exit ;; + 3) notify-send "πŸ“° News module" "\- Shows unread news items +- Shows πŸ”ƒ if updating with \`newsup\` +- Left click opens newsboat +- Middle click syncs RSS feeds +Note: Only one instance of newsboat (including updates) may be running at a time." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + + cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "πŸ“°" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)" diff --git a/mut/bin/set-bg b/mut/bin/set-bg new file mode 100644 index 0000000..bede726 --- /dev/null +++ b/mut/bin/set-bg @@ -0,0 +1,15 @@ +#!@bash@/bin/bash +reload=0 +while getopts "r" opt; do + case "$opt" in + h|\?) exit 0 ;; + r) reload=1 ;; + esac +done +if [ $reload -eq 1 ]; then + # (cat ~/.cache/wal/sequences &) + wal -R +else + sxiv -tob ~/bg | parallel wal -i +fi +kak -l | parallel '<<< "colorscheme wal" kak -p {}' diff --git a/mut/bin/spectrwmbar b/mut/bin/spectrwmbar new file mode 100644 index 0000000..a106b01 --- /dev/null +++ b/mut/bin/spectrwmbar @@ -0,0 +1,59 @@ +#!/usr/bin/env sh +# script for spectrwm status bar + +trap 'update' 5 + +fgcolors=("+@fg=1;" "+@fg=2;" "+@fg=3;" "+@fg=4;" "+@fg=5;" "+@fg=6;" "+@fg=7;" "+@fg=8;") +nfgcolors=${#fgcolors[@]} + +SLEEP_SEC=5m + +repeat() { + i=0; while [ $i -lt $1 ] + do + echo -ne "$TOKEN" + i=$(( i + 1 )) + done +} + +cpu() { + read cpu a b c previdle rest < /proc/stat + prevtotal=$((a+b+c+previdle)) + sleep 0.5 + read cpu a b c idle rest < /proc/stat + total=$((a+b+c+idle)) + cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) )) + echo -e "CPU: $cpu%" +} + +battery() { + BATTERY="$(cat /sys/class/power_supply/BAT0/capacity)" + + BAR_LEFT=$BATTERY + BATTERY_BAR="" + BLOCK=$(( 100 / nfgcolors )) + TOKEN=$(printf '\u2588') + + BAT_COL=$(( $nfgcolors -1 )) + #loops forever outputting a line every SLEEP_SEC secs + while [ $(( BAR_LEFT - BLOCK )) -gt 0 ] + do + BATTERY_BAR="${fgcolors[$BAT_COL]}$(repeat $BLOCK)${BATTERY_BAR}" + BAR_LEFT=$(( BAR_LEFT - BLOCK )) + BAT_COL=$(( BAT_COL - 1)) + done + + BATTERY_BAR="BATTERY: ${fgcolors[$BAT_COL]}$(repeat $BAR_LEFT)${BATTERY_BAR}" + echo $BATTERY_BAR +} + +update() { + echo "$(cpu) $(battery)" + wait +} + +while :; do + update + sleep $SLEEP_SEC & + wait +done diff --git a/mut/bin/sysact b/mut/bin/sysact new file mode 100755 index 0000000..4bb92dc --- /dev/null +++ b/mut/bin/sysact @@ -0,0 +1,21 @@ +#!/bin/sh + +# A dmenu wrapper script for system functions. +export WM="dwm" +ctl='systemctl' + +wmpid(){ # This function is needed if there are multiple instances of the window manager. + echo "$(pidof dwm)" +} + +case "$(printf "πŸ”’ lock\nπŸšͺ leave $WM\n♻️ renew $WM\n🐻 hibernate\nπŸ”ƒ reboot\nπŸ–₯️shutdown\nπŸ’€ sleep\nπŸ“Ί display off" | dmenu -i -p 'Action: ')" in + 'πŸ”’ lock') slock ;; + "πŸšͺ leave $WM") kill -TERM "$(wmpid)" ;; + "♻️ renew $WM") kill -HUP "$(wmpid)" ;; + '🐻 hibernate') slock $ctl hibernate -i ;; + 'πŸ’€ sleep') slock $ctl suspend -i ;; + 'πŸ”ƒ reboot') $ctl reboot -i ;; + 'πŸ–₯️shutdown') $ctl poweroff -i ;; + 'πŸ“Ί display off') xset dpms force off ;; + *) exit 1 ;; +esac diff --git a/mut/bin/terragrunt b/mut/bin/terragrunt new file mode 100755 index 0000000..38918e8 --- /dev/null +++ b/mut/bin/terragrunt @@ -0,0 +1,94 @@ +#!@bash@/bin/bash +TERRAGRUNT_ARGS=() +CONTEXT="" +ENV="" +MODULE="" +FULL=0 +while [[ $# -gt 0 ]]; do + case $1 in + -full) + FULL=1 + shift + ;; + -m|--module-path) + MODULE="$2" + shift + shift + ;; + -m=*|--module-path=*) + MODULE="${1#*=}" + shift + ;; + -e|--env) + ABS_ENV="$2" + CONTEXT=${ABS_ENV%/*} + ENV=${ABS_ENV#*/} + shift + shift + ;; + -e=*|--env=*) + ABS_ENV="${1#*=}" + CONTEXT=${ABS_ENV%/*} + ENV=${ABS_ENV#*/} + shift + ;; + *|-*) + TERRAGRUNT_ARGS+=("$1") + shift + esac +done + +TTY="" +case ${TERRAGRUNT_ARGS[0]} in + plan) + TERRAGRUNT_ARGS+=(-no-color -compact-warnings) + ;; + apply|destroy) + TTY="-t" + for arg in $TERRAGRUNT_ARGS; do + if [[ $arg -eq "gruntplan" ]]; then + TTY="" + fi + done + TERRAGRUNT_ARGS+=(-no-color -compact-warnings) + ;; + init) + TERRAGRUNT_ARGS+=(-no-color -compact-warnings) + ;; +esac + +VARIABLES="" +REPO="${PWD}" +TERRAGRUNT_EXTRA_MOUNTS="" +for var in $(pass show work/env) +do + case $var in + TERRAGRUNT_EXTRA_MOUNTS*) + TERRAGRUNT_EXTRA_MOUNTS="$TERRAGRUNT_EXTRA_MOUNTS ${var#*=}" + ;; + *) + VARIABLES="$VARIABLES$(printf ' -e %s' "$var")" + ;; + esac +done + +for var in $(printenv) +do + case $var in + TF_*) + VARIABLES="$VARIABLES$(printf ' -e %s' $var)" + ;; + esac +done + +ENVIRONMENTS="$REPO/environments" +WORKDIR="$ENVIRONMENTS/$ENV/$MODULE" + +# TODO(mike): how to do concise mode | grep -E '(^.*[#~+-] .*|^[[:punct:]]|Plan)' +# TODO(mike): check expiry of azure directory +echo "docker run --rm -i $TTY $VARIABLES -v $HOME/.terragrunt-cache:/tmp -v $HOME/.azure:/root/.azure -v $HOME/.netrc:/root/.netrc $TERRAGRUNT_EXTRA_MOUNTS -v ${REPO}:${REPO} -w ${WORKDIR} $TERRAGRUNT_CONTAINER terragrunt ${TERRAGRUNT_ARGS[@]} | filter-ansi | grep --line-buffered -E '(^ .*[#~+-] .*|^[[:punct:]]|^Plan.*|^\S.*)'" +if [[ $FULL -eq 0 ]]; then + docker run --rm -i $TTY $VARIABLES -v $HOME/.terragrunt-cache:/tmp -v $HOME/.azure:/root/.azure -v $HOME/.netrc:/root/.netrc $TERRAGRUNT_EXTRA_MOUNTS -v ${REPO}:${REPO} -w ${WORKDIR} $TERRAGRUNT_CONTAINER terragrunt ${TERRAGRUNT_ARGS[@]} | filter-ansi | grep --line-buffered -E '(^ .*[#~+-] .*|^[[:punct:]]|^Plan.*|^\S.*)' +else + docker run --rm -i $TTY $VARIABLES -v $HOME/.terragrunt-cache:/tmp -v $HOME/.azure:/root/.azure -v $HOME/.netrc:/root/.netrc $TERRAGRUNT_EXTRA_MOUNTS -v ${REPO}:${REPO} -w ${WORKDIR} $TERRAGRUNT_CONTAINER terragrunt ${TERRAGRUNT_ARGS[@]} | filter-ansi +fi diff --git a/mut/bin/tmux-normal-mode b/mut/bin/tmux-normal-mode new file mode 100644 index 0000000..5730017 --- /dev/null +++ b/mut/bin/tmux-normal-mode @@ -0,0 +1,28 @@ + # Make our own copy-mode with Kakoune! + # cursor_y=$(tmux display-message -t "''${pane_id}" -p "#{cursor_y}") ;\ + # cursor_x=$(tmux display-message -t "''${pane_id}" -p "#{cursor_x}") ;\ + # pane_height=$(tmux display-message -t "''${pane_id}" -p "#{pane_height}") ;\ + # line_count="$(wc -l "$file" |awk "{print \$1}")" ;\ + # sel_line=$(( line_count - ( pane_height - cursor_y ) + 1 )) ;\ + # printf "sel = %s\n" "$line_count" >>/tmp/debug.log ;\ + # cursor="''${sel_line}.''${cursor_x},''${sel_line}.''${cursor_x}" ;\ + # printf "cursor = %s\n" "$cursor" >>/tmp/debug.log + +kakoune_session="$(tmux display-message -p "#{window_name}" | sed "s/kakc@//")" +dispatch_name="dispatch://$(tmux display-message -p "#{pane_start_command}")" +case "${@}" in + '') + output=$(mktemp -d /tmp/kak-tmux.XXXXXXXX)/fifo + mkfifo ${output} + ( tmux capture-pane -S '-' -E '-' -J -e -p -t $TMUX_PANE | filter-ansi >${output} & ) + tmux new-window -t kaks@$kakoune_session -n "$dispatch_name" -d " + kak -c '$kakoune_session' -e \"edit -fifo ${output} '${dispatch_name}';\ + set-option buffer readonly true ;\ + set-option window filetype dispatch ;\ + hook -always -once buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } }\"" + tmux swap-pane -s kaks@$kakoune_session:"$dispatch_name".0 -t : + ;; + --quit) + tmux break-pane -t kaks@$kakoune_session -a -d -n "$dispatch_name" + ;; +esac diff --git a/mut/bin/transadd b/mut/bin/transadd new file mode 100644 index 0000000..a598fad --- /dev/null +++ b/mut/bin/transadd @@ -0,0 +1,9 @@ +#!/bin/sh + +# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running. + +# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep. + +pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}") + +transmission-remote -a "$@" && notify-send "πŸ”½ Torrent added." diff --git a/mut/emacs/init.el b/mut/emacs/init.el new file mode 100644 index 0000000..b31b0f0 --- /dev/null +++ b/mut/emacs/init.el @@ -0,0 +1,181 @@ +;; do autoload stuff here +(package-initialize) +(require 'package) +(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) + +(defun seq-keep (function sequence) + "Apply FUNCTION to SEQUENCE and return the list of all the non-nil results." + (delq nil (seq-map function sequence))) + +(defvar rc/package-contents-refreshed nil) + +(defun rc/package-refresh-contents-once () + (when (not rc/package-contents-refreshed) + (setq rc/package-contents-refreshed t) + (package-refresh-contents))) + +(defun rc/require-one-package (package) + (when (not (package-installed-p package)) + (rc/package-refresh-contents-once) + (package-install package))) + +(defun rc/require (&rest packages) + (dolist (package packages) + (rc/require-one-package package))) + +(defun rc/require-theme (theme) + (let ((theme-package (->> theme + (symbol-name) + (funcall (-flip #'concat) "-theme") + (intern)))) + (rc/require theme-package) + (load-theme theme t))) + + +(rc/require 'dash) +(require 'dash) +(rc/require 'dash-functional) +(require 'dash-functional) + +(defun rc/get-default-font () + (cond + ((eq system-type 'windows-nt) "Consolas-13") + (t "mono-13"))) +(add-to-list 'default-frame-alist `(font . ,(rc/get-default-font))) +(rc/require 'ansi-color) + +(rc/require 'ido 'ido-completing-read+ 'smex 'corfu) +(ido-mode t) +(ido-everywhere t) +(ido-ubiquitous-mode t) +(global-corfu-mode) + +(global-set-key (kbd "M-x") 'smex) +(global-set-key (kbd "M-X") 'smex-major-mode-commands) +;; This is your old M-x. p +(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command) + +(tool-bar-mode 0) +(menu-bar-mode 0) +(scroll-bar-mode 0) +(column-number-mode 1) +(show-paren-mode 1) + +(setq-default inhibit-splash-screen t + make-backup-files nil + tab-width 4 + indent-tabs-mode nil + compilation-scroll-output t + visible-bell (equal system-type 'windows-nt)) + +(setq-default c-basic-offset 4 + c-default-style '((java-mode . "java") + (awk-mode . "awk") + (other . "bsd"))) +(setq split-width-threshold 9999) + +(defun rc/duplicate-line () + "Duplicate current line" + (interactive) + (let ((column (- (point) (point-at-bol))) + (line (let ((s (thing-at-point 'line t))) + (if s (string-remove-suffix "\n" s) "")))) + (move-end-of-line 1) + (newline) + (insert line) + (move-beginning-of-line 1) + (forward-char column))) + +(global-set-key (kbd "M-J") 'text-scale-decrease) +(global-set-key (kbd "M-K") 'text-scale-increase) + +(global-set-key (kbd "M-c") 'rc/duplicate-line) +(global-set-key (kbd "C-c p") 'find-file-at-point) +(global-display-line-numbers-mode) +(setq next-line-add-newlines t) +(setq display-line-numbers-type 'relative) + +(rc/require 'direnv 'editorconfig 'multiple-cursors) +(editorconfig-mode 1) +(electric-pair-mode) +(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) +(global-set-key (kbd "C->") 'mc/mark-next-like-this) +(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) +(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) +(global-set-key (kbd "C-.") 'mc/mark-all-in-region) + +(rc/require 'cl-lib 'magit) +(setq magit-auto-revert-mode nil) +(global-set-key (kbd "C-c m s") 'magit-status) +(global-set-key (kbd "C-c m l") 'magit-log) + +(require 'dired-x) +(setq dired-omit-files + (concat dired-omit-files "\\|^\\..+$")) +(setq-default dired-dwim-target t) +(setq dired-listing-switches "-alh") + +;; stolen from: https://emacs.stackexchange.com/questions/24698/ansi-escape-sequences-in-compilation-mode +(rc/require 'ansi-color) +(defun endless/colorize-compilation () + "Colorize from `compilation-filter-start' to `point'." + (let ((inhibit-read-only t)) + (ansi-color-apply-on-region + compilation-filter-start (point)))) +(add-hook 'compilation-filter-hook + #'endless/colorize-compilation) + +(setq TeX-auto-save t) +(setq TeX-parse-self t) +(setq-default TeX-master nil) + +(setq completion-auto-select 'second-tab) +(setq completions-format 'one-column) +(setq completions-max-height 20) +(define-key completion-in-region-mode-map (kbd "M-p") #'minibuffer-previous-completion) +(define-key completion-in-region-mode-map (kbd "M-n") #'minibuffer-next-completion) +;; (rc/require 'consult 'vertico 'orderless) +;; (setq completion-in-region-function #'completion--) + + +(rc/require + 'nix-mode + 'go-mode + 'auctex + 'yaml-pro + 'rust-mode + ) + +(require 'lsp-mode) +(add-hook 'rust-mode-hook #'lsp-deferred) +(add-hook 'go-mode-hook #'lsp-deferred) +(defun lsp-go-install-save-hooks () + (add-hook 'before-save-hook #'lsp-format-buffer t t) + (add-hook 'before-save-hook #'lsp-organize-imports t t)) +(add-hook 'go-mode-hook #'lsp-go-install-save-hooks) +(lsp-register-custom-settings + '(("gopls.hints.assignVariableTypes" t t) + ("gopls.hints.compositeLiteralFields" t t) + ("gopls.hints.compositeLiteralTypes" t t) + ("gopls.hints.constantValues" t t) + ("gopls.hints.functionTypeParameters" t t) + ("gopls.hints.parameterNames" t t) + ("gopls.hints.rangeVariableTypes" t t))) + +(rc/require-theme 'gruber-darker) +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(custom-enabled-themes '(gruber-darker)) + '(custom-safe-themes + '("ba4ab079778624e2eadbdc5d9345e6ada531dc3febeb24d257e6d31d5ed02577" "a9dc7790550dcdb88a23d9f81cc0333490529a20e160a8599a6ceaf1104192b5" "5f128efd37c6a87cd4ad8e8b7f2afaba425425524a68133ac0efd87291d05874" "5b9a45080feaedc7820894ebbfe4f8251e13b66654ac4394cb416fef9fdca789" "9013233028d9798f901e5e8efb31841c24c12444d3b6e92580080505d56fd392" "6adeb971e4d5fe32bee0d5b1302bc0dfd70d4b42bad61e1c346599a6dc9569b5" "8d3ef5ff6273f2a552152c7febc40eabca26bae05bd12bc85062e2dc224cde9a" "75b2a02e1e0313742f548d43003fcdc45106553af7283fb5fad74359e07fe0e2" "b9761a2e568bee658e0ff723dd620d844172943eb5ec4053e2b199c59e0bcc22" "9d29a302302cce971d988eb51bd17c1d2be6cd68305710446f658958c0640f68" "f053f92735d6d238461da8512b9c071a5ce3b9d972501f7a5e6682a90bf29725" "dc8285f7f4d86c0aebf1ea4b448842a6868553eded6f71d1de52f3dcbc960039" "38c0c668d8ac3841cb9608522ca116067177c92feeabc6f002a27249976d7434" "162201cf5b5899938cfaec99c8cb35a2f1bf0775fc9ccbf5e63130a1ea217213" "ff24d14f5f7d355f47d53fd016565ed128bf3af30eb7ce8cae307ee4fe7f3fd0" "da75eceab6bea9298e04ce5b4b07349f8c02da305734f7c0c8c6af7b5eaa9738" "e3daa8f18440301f3e54f2093fe15f4fe951986a8628e98dcd781efbec7a46f2" "631c52620e2953e744f2b56d102eae503017047fb43d65ce028e88ef5846ea3b" "88f7ee5594021c60a4a6a1c275614103de8c1435d6d08cc58882f920e0cec65e" "dfb1c8b5bfa040b042b4ef660d0aab48ef2e89ee719a1f24a4629a0c5ed769e8" "e13beeb34b932f309fb2c360a04a460821ca99fe58f69e65557d6c1b10ba18c7" default)) + '(package-selected-packages + '(doom-themes corfu yaml-pro smex rust-mode nix-mode multiple-cursors magit lsp-ui ido-completing-read+ gruber-darker-theme go-mode editorconfig direnv dash-functional auctex))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/mut/neovim/README.md b/mut/neovim/README.md new file mode 100644 index 0000000..3a441bd --- /dev/null +++ b/mut/neovim/README.md @@ -0,0 +1,2 @@ +# mike_neovim +installs my neovim config on mac or linux diff --git a/mut/neovim/compiler/ansible-lint.vim b/mut/neovim/compiler/ansible-lint.vim new file mode 100644 index 0000000..9427092 --- /dev/null +++ b/mut/neovim/compiler/ansible-lint.vim @@ -0,0 +1,11 @@ +if exists('current_compiler') + finish +endif +let current_compiler = 'go-test' + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +CompilerSet makeprg=compile\ ansible-lint +CompilerSet errorformat=%Z%f:%l\ %m,%Z%f:%l,%E%\\%%(%\\S%\\)%\\@=%m,%C%\\%%(%\\S%\\)%\\@=%m,%-G diff --git a/mut/neovim/compiler/go-test.vim b/mut/neovim/compiler/go-test.vim new file mode 100644 index 0000000..61442e5 --- /dev/null +++ b/mut/neovim/compiler/go-test.vim @@ -0,0 +1,14 @@ +if exists('current_compiler') + finish +endif +let current_compiler = 'go-test' + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +" %f>%l:%c:%t:%n:%m +CompilerSet makeprg=go\ test +CompilerSet errorformat=%.%#:\ %m\ %f:%l,%.%#:\ %m\ at\ %f:%l%.%#, + +" vim: sw=2 sts=2 et diff --git a/mut/neovim/compiler/helm.vim b/mut/neovim/compiler/helm.vim new file mode 100644 index 0000000..7e4b21d --- /dev/null +++ b/mut/neovim/compiler/helm.vim @@ -0,0 +1,14 @@ +if exists('current_compiler') + finish +endif +let current_compiler = 'go-test' + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +CompilerSet makeprg=compile\ helm\ lint +CompilerSet errorformat=\[%t%.%#\]%.%#\ template:\ %f:%l:%c:\ %m, + \\[%t%.%#\]\ %f:\ %m, + +" vim: sw=2 sts=2 et diff --git a/mut/neovim/compiler/racket.vim b/mut/neovim/compiler/racket.vim new file mode 100644 index 0000000..1f98a41 --- /dev/null +++ b/mut/neovim/compiler/racket.vim @@ -0,0 +1,26 @@ +if exists('current_compiler') + finish +endif +let current_compiler = 'go-test' + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +" The errorformat can also use vim's regular expression syntax (albeit in a rather awkward way) which gives us a solution to the problem. We can use a non-capturing group and a zero-width assertion to require the presence of these signaling phrases without consuming them. This then allows the %m to pick them up. As plain regular expression syntax this zero-width assertion looks like: +" +" \%(undefined reference\|multiple definition\)\@= +" +" But in order to use it in efm we need to replace \ by %\ and % by %% + + +CompilerSet makeprg=compile\ racket +CompilerSet errorformat=\%Z%*\\S%.%#, + \%C\ \ \ %f:%l:%c, + \%C\ \ \ %f:%l:%c:\ %m, + \%C\ \ %.%#%\\%%(module%\\spath:%\\\|at\:%\\\|in\:%\\\|expected\:%\\\|given\:%\\)%\\@=%m, + \%C\ %.%#, + \%E%\\%%(%\\w%\\)%\\@=%f:%*\\d:%*\\d:\ %m, + \%E%*\\f:%*\\d:%*\\d:\ %m, + \%E%\\%%(%\\S%\\+:%\\\|%\.%\\+--%\\)%\\@=%m, +" vim: sw=2 sts=2 et diff --git a/mut/neovim/compiler/terragrunt.vim b/mut/neovim/compiler/terragrunt.vim new file mode 100644 index 0000000..54f94ef --- /dev/null +++ b/mut/neovim/compiler/terragrunt.vim @@ -0,0 +1,21 @@ +if exists('current_compiler') + finish +endif +let current_compiler = 'go-test' + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +" The errorformat can also use vim's regular expression syntax (albeit in a rather awkward way) which gives us a solution to the problem. We can use a non-capturing group and a zero-width assertion to require the presence of these signaling phrases without consuming them. This then allows the %m to pick them up. As plain regular expression syntax this zero-width assertion looks like: +" +" \%(undefined reference\|multiple definition\)\@= +" +" But in order to use it in efm we need to replace \ by %\ and % by %% + + +CompilerSet makeprg=terragrunt +CompilerSet errorformat=%.%#level=%t%.%#msg=%f:%l%\\,%c-%*\\d:\ %m, + \%Z%m, + \%E-\ %m\ (at\ %f:%l\\,%c-%*\\d), +" vim: sw=2 sts=2 et diff --git a/mut/neovim/debug b/mut/neovim/debug new file mode 100644 index 0000000..6319340 --- /dev/null +++ b/mut/neovim/debug @@ -0,0 +1,8 @@ +~/projects/k8s ~/neovim +can't find session: kaks@projects-k8s +direnv: loading ~/projects/k8s/.envrc +direnv: using flake +direnv: nix-direnv: using cached dev shell +make: *** No rule to make target 'envtest'. Stop. +direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +ENVTEST +ENVTEST_K8S_VERSION +GOTOOLDIR +HOST_PATH +IN_NIX_SHELL +KUBEBUILDER_ASSETS +LD +LOCALBIN +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +OBJCOPY +OBJDUMP +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +dontAddDisableDepTrack +mesonFlags +nativeBuildInputs +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS ~name +~/neovim diff --git a/mut/neovim/fnl/conf/diagnostic.fnl b/mut/neovim/fnl/conf/diagnostic.fnl new file mode 100644 index 0000000..7ef1dd3 --- /dev/null +++ b/mut/neovim/fnl/conf/diagnostic.fnl @@ -0,0 +1,16 @@ +(fn m [mode key cb] + (vim.keymap.set mode key cb {:silent true :noremap true})) + +(m :n :ge (fn [] + (vim.diagnostic.open_float))) + +(vim.diagnostic.config {:virtual_text false}) + +(vim.keymap.set :n :l (let [l (require :lsp_lines)] + l.toggle) + {:desc "Toggle lsp_lines"}) + +(vim.api.nvim_set_hl 0 :VirtualTextWarning {:link :Grey}) +(vim.api.nvim_set_hl 0 :VirtualTextError {:link :DiffDelete}) +(vim.api.nvim_set_hl 0 :VirtualTextInfo {:link :DiffChange}) +(vim.api.nvim_set_hl 0 :VirtualTextHint {:link :DiffAdd}) diff --git a/mut/neovim/fnl/conf/events.fnl b/mut/neovim/fnl/conf/events.fnl new file mode 100644 index 0000000..00d75d4 --- /dev/null +++ b/mut/neovim/fnl/conf/events.fnl @@ -0,0 +1,32 @@ +(vim.api.nvim_create_augroup "conf#events" {:clear true}) +(local event vim.api.nvim_create_autocmd) + +(event [:BufReadPost] {:pattern ["*"] + :callback (fn [] + (local pattern "'\\s\\+$'") + (vim.cmd (.. "syn match TrailingWhitespace " + pattern)) + (vim.cmd "hi link TrailingWhitespace IncSearch")) + :group "conf#events"}) + +(local vimenter-cwd (vim.fn.getcwd)) +(event [:VimLeave] {:pattern ["*"] + :callback (fn [] + (vim.cmd (.. "mksession! " vimenter-cwd + :/.vimsession.vim))) + :group "conf#events"}) + +(event [:BufWinEnter :WinEnter] + {:pattern ["term://*"] + :callback (fn [] + (vim.cmd :startinsert)) + :group "conf#events"}) + +(event [:BufLeave] {:pattern ["term://*"] + :callback (fn [] + (vim.cmd :stopinsert)) + :group "conf#events"}) + +(event [:FileType] {:pattern [:dirvish] + :callback #(vim.cmd "silent! unmap ") + :group "conf#events"}) diff --git a/mut/neovim/fnl/conf/filetype.fnl b/mut/neovim/fnl/conf/filetype.fnl new file mode 100644 index 0000000..29f64b0 --- /dev/null +++ b/mut/neovim/fnl/conf/filetype.fnl @@ -0,0 +1,44 @@ +(fn playbook? [filename] + (P filename) + (local pattern (vim.regex :^playbook.*)) + (pattern:match_str filename)) + +(fn group-vars? [relative-dir] + (local pattern (vim.regex :group_vars$)) + (pattern:match_str relative-dir)) + +(fn roles? [relative-dir] + (local pattern (vim.regex :roles$)) + (pattern:match_str relative-dir)) + +(fn task? [relative-file] + (local pattern (vim.regex :.*tasks.*)) + (pattern:match_str relative-file)) + +(fn ansible-files? [items] + (local [item & rest] items) + (if (not item) :yaml + (task? item) :yaml.ansible + (roles? item) :yaml.ansible + (group-vars? item) :yaml.ansible + (ansible-files? rest))) + +(fn yaml-filetype [path buf] + (local [repo?] + (vim.fs.find :.git + {:upward true + :path (vim.fs.dirname path) + :stop (vim.fs.dirname (vim.loop.cwd))})) + (local files (or (not repo?) (icollect [path file-or-dir (vim.fs.dir (vim.fs.dirname repo?) + {:skip #(not= "." + ($1:sub 1 + 1)) + :depth 2})] + (do + path)))) + (if (and repo? (playbook? (vim.fn.fnamemodify path ":t"))) :yaml.ansible + (and repo? (task? (vim.fn.fnamemodify path ":."))) :yaml.ansible + repo? (ansible-files? files) + :yaml)) + +(vim.filetype.add {:extension {:yml yaml-filetype :yaml yaml-filetype}}) diff --git a/mut/neovim/fnl/conf/init.fnl b/mut/neovim/fnl/conf/init.fnl new file mode 100644 index 0000000..90bc20c --- /dev/null +++ b/mut/neovim/fnl/conf/init.fnl @@ -0,0 +1,172 @@ +(vim.cmd "colorscheme kanagawa-wave") +(vim.cmd "filetype plugin on") +(vim.cmd "filetype indent on") +(vim.cmd "highlight WinSeparator guibg=None") +(vim.cmd "packadd cfilter") + +(require :conf.settings) +;; (require :conf.pkgs) +;; (require :conf.lsp) +;; (require :conf.events) +;; (require :conf.filetype) +;; (require :conf.newtab) +;; (require :conf.nix-develop) + +;; (require :conf.diagnostic) + +;; TODO: make a function that sets this autocommand: au BufWritePost currentfile :!curl -X POST -d "{\"previewRun\": true, \"yamlOverride\": \"$(cat % | yq -P)\", \"resources\": {\"repositories\": {\"self\": {\"refName\": \"refs/heads/branch\"}}}}" -s -H "Content-Type: application/json" -H "Authorization: Basic $WORK_AZDO_GIT_AUTH" "$WORK_AZDO_GIT_ORG_URL/Stater/_apis/pipelines/pipelineid/preview?api-version=7.1-preview.1" | jq -r '.finalYaml // .' > scratch.yaml + +(let [map vim.keymap.set] + (map :t : "") + ;; pausing and continueing printing output is not necessary inside neovim terminal right? + (map :t : ":q") + (map :n :qo ":copen") + (map :n :qc ":cclose") + (map :n :lo ":lopen") + (map :n :lc ":lclose") + (map :n "[q" ":cprevious") + (map :n "]q" ":cnext") + (map :n "[x" ":lprevious") + (map :n "]x" ":lnext") + (map :n : ":Telescope find_files" {:noremap true}) + (map :n "`" ":FocusDispatch ") + (map :n "`k" ":K9s ") + (map :n "`s" ":Ssh ") + (map :n :p ":NewTab") + (map :n :cf ":tabedit ~/flake|tc ~/flake|Go") + (map :n :cn ":tabedit ~/neovim|tc ~/neovim|Go")) + +(tset _G :P (lambda [...] + (let [inspected (icollect [_ v (ipairs [...])] + (vim.inspect v))] + (each [_ printer (ipairs inspected)] + (print printer))))) + +(local git-worktree (require :git-worktree)) +(git-worktree.setup {:change_directory_command :tcd + :update_on_change true + :autopush true}) + +(fn append [tbl item] + (table.insert tbl item) + tbl) + +(fn by-newline [lines] + (fn iter [items by result] + (local [item & rest] items) + (if (= item nil) result + (= "" item) (iter rest [] (append result by)) + (iter rest (append by item) result))) + + (ipairs (iter lines [] []))) + +(vim.keymap.set [:n] :w + (fn [] + (vim.fn.feedkeys ":Worktree switch ") + (local cmp (require :cmp)) + (vim.schedule (fn [] + (cmp.close) + (cmp.complete))))) + +(vim.keymap.set [:n] :W ":Worktree ") +(fn list-worktrees [] + (local pworktree (io.popen "git worktree list --porcelain")) + (icollect [_ worktree (by-newline (icollect [line (pworktree:lines)] + line))] + (match (icollect [_ line (ipairs worktree)] + (vim.split line " ")) + [[:worktree path] [:HEAD commit] [:branch branch]] (branch:gsub :refs/heads/ + "")))) + +(fn list-branches [] + (local pbranch (io.popen "git branch --list -r --format \"%(refname)\"")) + (icollect [_ ref (ipairs (icollect [line (pbranch:lines)] + (line:gsub :refs/remotes/.+/ "")))] + (if (not (= ref :HEAD)) + ref))) + +(vim.api.nvim_create_user_command :Worktree + (fn [ctx] + (match ctx.fargs + [:create tree branch upstream] (git-worktree.create_worktree tree + branch + upstream) + [:create tree upstream] (git-worktree.create_worktree tree + tree + upstream) + [:create tree] (git-worktree.create_worktree tree + tree + :origin) + [:switch tree] (git-worktree.switch_worktree tree) + [:delete tree] (git-worktree.delete_worktree tree) + _ (vim.notify "not recognized"))) + {:nargs "*" + :complete (fn [lead cmdline cursor] + (local cmdline-tokens + (vim.split cmdline " ")) + (match cmdline-tokens + [:Worktree :create & rest] (list-branches) + [:Worktree :switch & rest] (list-worktrees) + [:Worktree :delete & rest] (list-worktrees) + [:Worktree & rest] [:create + :switch + :delete]))}) + +(vim.api.nvim_create_user_command :HomeManager + (fn [ctx] + (vim.cmd (.. ":Dispatch home-manager switch --impure " + (os.getenv :HOME) "/flake#" + (. ctx.fargs 1)))) + {:nargs 1}) + +(vim.api.nvim_create_user_command :Gpush + (fn [ctx] + (vim.cmd ":Dispatch git push")) + {}) + +(vim.api.nvim_create_user_command :Grunt + (fn [ctx] + (match (. ctx.fargs 1) + :plan (vim.cmd (.. ":Dispatch " + (if ctx.bang + "TF_LOG=DEBUG " + "") + "terragrunt " + (table.concat ctx.fargs + " ") + " " :-out=gruntplan)) + :apply (vim.cmd (.. ":Dispatch " + (if ctx.bang + "TF_LOG=DEBUG " + "") + "terragrunt " + (table.concat ctx.fargs + " ") + " " :gruntplan)) + _ (vim.cmd (.. ":Start " + (if ctx.bang + "TF_LOG=DEBUG " + "") + "terragrunt " + (table.concat ctx.fargs + " "))))) + {:nargs "*" :bang true}) + +(vim.api.nvim_create_user_command :K9s + (fn [ctx] + (vim.cmd (.. ":Start k9s --context " + (. ctx.fargs 1)))) + {:nargs 1}) + +(vim.api.nvim_create_user_command :Ssh + (fn [ctx] + (vim.cmd (.. ":Start ssh " (. ctx.fargs 1)))) + {:nargs 1 + :complete (fn [lead cmdline cursor] + (local p + (io.popen :get-sshables)) + (local lines + (icollect [line (p:lines)] + line)) + (p:close) + lines)}) diff --git a/mut/neovim/fnl/conf/lsp.fnl b/mut/neovim/fnl/conf/lsp.fnl new file mode 100644 index 0000000..35fa34f --- /dev/null +++ b/mut/neovim/fnl/conf/lsp.fnl @@ -0,0 +1,75 @@ +(fn map-to-capabilities [{: client : buf} format] + (fn bo [name value] + (vim.api.nvim_buf_set_option buf name value)) + + (fn bm [mode key cb] + (vim.keymap.set mode key cb {:silent true :noremap true :buffer buf})) + + (fn lspdo [action] + (. vim.lsp.buf action)) + + (fn use [cpb] + (match cpb + :completionProvider (bo :omnifunc "v:lua.vim.lsp.omnifunc") + :renameProvider (bm :n :gr (lspdo :rename)) + :signatureHelpProvider (bm :n :gs (lspdo :signature_help)) + :definitionProvider (bm :n :gd (lspdo :definition)) + :declaration (bm :n :gD (lspdo :declaration)) + :implementationProvider (bm :n :gi (lspdo :implementation)) + :referencesProvider (bm :n :gg (lspdo :references)) + :documentSymbolProvider (bm :n :gds (lspdo :workspace_symbol)) + :codeActionProvider (bm :n :ga (lspdo :code_action)) + :codeLensProvider (bm :n :gl + (lambda [] + (vim.lsp.codelens.run))) + :hoverProvider (bo :keywordprg ":LspHover") + :documentFormattingProvider (if format + ((fn [] + (bo :formatexpr + "v:lua.vim.lsp.format()") + (bm :n :gq + #(vim.lsp.buf.format {:async true}))))))) + + (each [cpb enabled? (pairs client.server_capabilities)] + (if enabled? + (use cpb))) + {: client : buf}) + +(fn register-handlers [{: client : buf}] + (tset (. client :handlers) :textDocument/publishDiagnostics + (vim.lsp.with (fn [_ result ctx config] + (vim.lsp.diagnostic.on_publish_diagnostics _ result ctx + config) + (vim.diagnostic.setloclist {:open false})) + {:virtual_text true + :underline true + :update_in_insert false + :severity_sort true})) + {: client : buf}) + +(var format-on-save true) +(fn toggle-format-on-save [] + (set format-on-save (not format-on-save))) + +(vim.api.nvim_create_user_command :LspToggleOnSave toggle-format-on-save + {:nargs 1 :complete (fn [] [:format])}) + +(fn events [{: client : buf}] + (match client.server_capabilities + {:documentFormattingProvider true} + (let [format-events-group (vim.api.nvim_create_augroup :format-events + {:clear true})] + (vim.api.nvim_create_autocmd [:BufWritePre] + {:group format-events-group + :callback (lambda [] + (if format-on-save + (vim.lsp.buf.format))) + :buffer buf})))) + +(fn attach [client buf format] + (-> {: client : buf} + (register-handlers) + (map-to-capabilities format) + (events))) + +{: attach} diff --git a/mut/neovim/fnl/conf/macros.fnl b/mut/neovim/fnl/conf/macros.fnl new file mode 100644 index 0000000..9ce8b26 --- /dev/null +++ b/mut/neovim/fnl/conf/macros.fnl @@ -0,0 +1,45 @@ +(fn by-two [l] + (fn iter [t i] + (let [k (. l (- i 1)) + v (. l i)] + (when (and (not= k nil) (not= v nil)) + (values (+ i 2) [k v])))) + + (values iter l 2)) + +(fn decode-opt-value [v] + (fn symbol-luatype [s] + (let [t (tostring s)] + (match t + :on true + :off false + _ t))) + + (if (sym? v) (symbol-luatype v) v)) + +(fn opt-template [o] + (fn remove/append [target value mode] + `(let [target# (. vim :opt ,target) + value# ,value] + ,(match mode + :append `(target#:append value#) + :remove `(target#:remove value#)))) + + (fn [v] + (match (string.sub o 1 1) + "-" (remove/append (string.sub o 2) v :remove) + "+" (remove/append (string.sub o 2) v :append) + _ `(tset (. vim :opt) ,o ,v)))) + +(fn settings [...] + `,(icollect [_ [o v] (by-two [...])] + ((opt-template (tostring o)) (decode-opt-value v)))) + +(fn globals [...] + (local globa (icollect [_ [k v] (by-two [...])] + [(tostring k) v])) + `(let [l# ,globa] + (each [a# b# (ipairs l#)] + (tset (. vim :g) (. b# 1) (. b# 2))))) + +{: settings : globals} diff --git a/mut/neovim/fnl/conf/newtab/init.fnl b/mut/neovim/fnl/conf/newtab/init.fnl new file mode 100644 index 0000000..fbf8e18 --- /dev/null +++ b/mut/neovim/fnl/conf/newtab/init.fnl @@ -0,0 +1,36 @@ +(local pickers (require :telescope.pickers)) +(local finders (require :telescope.finders)) +(local conf (. (require :telescope.config) :values)) +(local themes (require :telescope.themes)) +(local actions (require :telescope.actions)) +(local action_state (require :telescope.actions.state)) + +(fn colors [opts] + (local opts (if opts opts {})) + (local finder + (pickers.new opts + {:prompt_title :colors + :finder (finders.new_oneshot_job [:fd + :-d1 + "." + (os.getenv :HOME) + (.. (os.getenv :HOME) + :/projects)] + {}) + :attach_mappings (fn [prompt_buf map] + (actions.select_default:replace (fn [] + (actions.close prompt_buf) + (local selection + (action_state.get_selected_entry)) + (vim.cmd (.. :tabnew + (. selection + 1))) + (vim.cmd (.. :tc + (. selection + 1)))))) + :sorter (conf.generic_sorter opts)})) + (finder:find)) + +(vim.api.nvim_create_user_command :NewTab (fn [] (colors (themes.get_ivy))) {}) + +(vim.api.nvim_create_user_command :Colors colors {}) diff --git a/mut/neovim/fnl/conf/nix-develop/init.fnl b/mut/neovim/fnl/conf/nix-develop/init.fnl new file mode 100644 index 0000000..0983e06 --- /dev/null +++ b/mut/neovim/fnl/conf/nix-develop/init.fnl @@ -0,0 +1,122 @@ +(local loop vim.loop) + +(var original-env {}) +(local ignored-variables {:SHELL true + :BASHOPTS true + :HOME true + :NIX_BUILD_TOP true + :NIX_ENFORCE_PURITY true + :NIX_LOG_FD true + :NIX_REMOTE true + :PPID true + :SHELL true + :SHELLOPTS true + :SSL_CERT_FILE true + :TEMP true + :TEMPDIR true + :TERM true + :TMP true + :TMPDIR true + :TZ true + :UID true}) + +(local separated-dirs {:PATH ":" :XDG_DATA_DIRS ":"}) + +(fn set-env [key value] + (if (not (. original-env key)) + (tset original-env key (or (. vim.env key) :nix-develop-nil))) + (local sep (. separated-dirs key)) + (if sep + (do + (local suffix (or (. vim.env key) "")) + (tset vim.env key (.. value sep suffix))) + (tset vim.env key value))) + +(fn unload-env [] + (each [k v (pairs original-env)] + (if (= v :nix-develop-nil) + (tset vim.env k nil) + (tset vim.env k v)))) + +(fn ignored? [key] + (. ignored-variables (string.upper key))) + +(fn exported? [Type] + (= Type :exported)) + +(fn handle-shellhook [shellhook] ; (P :handle-shellhook shellhook) + (var shellhook-env "") + (local stdin (loop.new_pipe)) + (local stdout (loop.new_pipe)) + (local p + (loop.spawn :bash {:stdio [stdin stdout nil]} + (fn [code signal] + (vim.schedule #(vim.notify (.. "shellhook: exit code " + code " " signal)))))) + (loop.read_start stdout + (fn [err data] + (assert (not err) err) + (if data + (set shellhook-env (.. shellhook-env data)) + (do + (if (not= shellhook-env "") + (vim.schedule (fn [] + (local json + (vim.fn.json_decode shellhook-env)) + ; (P json) + (each [key value (pairs json)] + (set-env key value))))))))) + (stdin:write (.. shellhook "jq -n 'env'\n\n")) + (stdin:close)) + +(fn handle-nix-print-dev-env [str] + (vim.schedule (fn [] + (local json (. (vim.fn.json_decode str) :variables)) + (-> (icollect [key {: type : value} (pairs json)] + (do + (if (and (exported? type) (not (ignored? key))) + (set-env key value)) + (if (= key :shellHook) + value))) + (#(each [_ shellhook (ipairs $1)] + (handle-shellhook shellhook))))))) + +(fn nix-develop [fargs unload] + (if unload + (unload-env)) + (local cmd :nix) + (local fargs (or fargs [])) + (local args [:print-dev-env :--json (unpack fargs)]) + (local stdout (loop.new_pipe)) + (local stdio [nil stdout nil]) + (var nix-print-dev-env "") + (local p + (loop.spawn cmd {: args : stdio} + (fn [code signal] + (if (not= code 0) + (vim.schedule #(vim.notify (.. "nix-develop: exit code " + code " " signal))))))) + (loop.read_start stdout + (fn [err data] + (assert (not err) err) + (if data + (set nix-print-dev-env (.. nix-print-dev-env data)) + (do + (vim.schedule #(vim.notify "nix-develop: stdout end")) + (if (not= nix-print-dev-env "") + (handle-nix-print-dev-env nix-print-dev-env))))))) + +(vim.api.nvim_create_user_command :NixDevelop + (fn [ctx] + (nix-develop ctx.fargs true)) + {:nargs "*"}) + +(vim.api.nvim_create_augroup :nix-develop {:clear true}) +(vim.api.nvim_create_autocmd [:DirChanged :VimEnter] + {:pattern ["*"] + :callback (fn [ctx] + (unload-env) + (if (= 1 + (vim.fn.filereadable (.. ctx.file + :/flake.nix))) + (nix-develop false)))}) diff --git a/mut/neovim/fnl/conf/pkgs.fnl b/mut/neovim/fnl/conf/pkgs.fnl new file mode 100644 index 0000000..1445454 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs.fnl @@ -0,0 +1,15 @@ +;; (require :conf.pkgs.cmp) + +;; (require :conf.pkgs.null-ls) +;; (require :conf.pkgs.lspconfig) +;; (require :conf.pkgs.treesitter) +;; (require :conf.pkgs.tree-sitter-context) +;; (require :conf.pkgs.conjure) +;; (require :conf.pkgs.test) +;; (require :conf.pkgs.lsp_lines) +;; (require :conf.pkgs.noice) +;; (require :conf.pkgs.dap) +;; (require :conf.pkgs.heirline) +;; (require :conf.pkgs.gitsigns) +;; (require :conf.pkgs.harpoon) +;; (require :conf.pkgs.venn) diff --git a/mut/neovim/fnl/conf/pkgs/cmp.fnl b/mut/neovim/fnl/conf/pkgs/cmp.fnl new file mode 100644 index 0000000..76319f4 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/cmp.fnl @@ -0,0 +1,114 @@ +(local cmp (require :cmp)) +(local compare (require :cmp.config.compare)) +(local always-first [:write :edit :split :quit :cfirst]) + +(fn string-startswith? [str start] + (= start (string.sub str 1 (string.len start)))) + +(fn string-startswith-anyof? [str start-list] + (fn iter [[item & rest]] + (if (not item) false + (string-startswith? str item) true + (iter rest))) + + (iter start-list)) + +(fn string-startswith-upper? [str] + (local first-char (string.sub str 1 1)) + (= first-char (string.upper first-char))) + +(fn has-words-before? [] + (local [line col] (vim.api.nvim_win_get_cursor 0)) + (local [word & rest] (vim.api.nvim_buf_get_lines 0 (- line 1) line true)) + (local before (word:sub col col)) + (local is_string (before:match "%s")) + (and (not= col 0) (= is_string nil))) + +(fn enum [types key] + (. (. cmp types) key)) + +(fn cmp-setup [cmp autocomplete] + (let [luasnip (require :luasnip) + snip (fn [args] + (luasnip.lsp_expand (. args :body)))] + (local cfg + {:experimental {:ghost_text true} + :snippet {:expand snip} + :preselect cmp.PreselectMode.None + :mapping {: (cmp.mapping (fn [fallback] + (if (cmp.visible) + (cmp.select_next_item) + (luasnip.expand_or_jumpable) + (luasnip.expand_or_jump) + (has-words-before?) + (cmp.complete) + (fallback)) + [:i :s])) + : (cmp.mapping (fn [fallback] + (if (cmp.visible) + (cmp.select_prev_item) + (luasnip.jumpable -1) + (luasnip.jump -1) + (fallback)) + [:i :s])) + : (cmp.mapping.scroll_docs -4) + : (cmp.mapping.scroll_docs 4) + : (cmp.mapping.complete) + : (cmp.mapping.confirm {:behavior (enum :ConfirmBehavior + :Replace) + :select true})} + :sources (cmp.config.sources [{:name :nvim_lsp} + {:name :path} + {:name :luasnip}])}) + (if (not autocomplete) (tset cfg :completion {:autocomplete false})) + ;; (print (vim.inspect cfg)) + (cmp.setup cfg) + (cmp.setup.cmdline ["/" "?"] + {:sources (cmp.config.sources [{:name :buffer}]) + :experimental {:ghost_text true} + :mapping (cmp.mapping.preset.cmdline)}) + (cmp.setup.cmdline ":" + {:matching {:disallow_partial_fuzzy_matching true + :disallow_prefix_unmatching true} + :sources (cmp.config.sources [{:name :path}] + [{:name :cmdline + :keyword_length 1}]) + :preselect cmp.PreselectMode.Item + :sorting {:priority_weight 2 + :comparators [(fn [e1 e2] + (fn iter [[item & rest]] + (if (or (not rest) + (not item)) + false + (= e1.completion_item.label + item) + true + (iter rest))) + + (iter always-first)) + compare.offset + compare.exact + compare.score + compare.locality + compare.kind + compare.length + compare.order]} + :mapping (cmp.mapping.preset.cmdline {: {:c (fn [fallback] + (if (not (cmp.confirm {:behavior (enum :ConfirmBehavior + :Replace) + :select true})) + (fallback) + (vim.schedule fallback)))}})}))) + +; {:name :cmdline_history +; :keyword_pattern "^[ABCDEFHIJKLMNOPQRSTUVWXYZ].*" +; :entry_filter (fn [entry +; ctx] +; (if (string-startswith-upper entry.completion_item.label) +; true +; false)) +; :max_item_count 1)}))) +; disallow_fuzzy_matching = false, +; disallow_partial_matching = false, +; disallow_prefix_unmatching = false,))) +(cmp-setup cmp true) diff --git a/mut/neovim/fnl/conf/pkgs/conjure.fnl b/mut/neovim/fnl/conf/pkgs/conjure.fnl new file mode 100644 index 0000000..c07a6f4 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/conjure.fnl @@ -0,0 +1,17 @@ +(tset vim.g "conjure#log#wrap" true) + +(tset vim.g "conjure#client#python#stdio#command" "python -iq") + +(vim.api.nvim_create_user_command :ConjurePythonCommand + (fn [opts] + (tset vim.g + "conjure#client#python#stdio#command" + opts.args)) + {:nargs 1}) + +(let [group (vim.api.nvim_create_augroup "conf#pkgs#conjure" {:clear true})] + (vim.api.nvim_create_autocmd [:BufEnter] + {: group + :callback (fn [opts] + (vim.diagnostic.disable opts.buf)) + :pattern [:conjure-log*]})) diff --git a/mut/neovim/fnl/conf/pkgs/dap.fnl b/mut/neovim/fnl/conf/pkgs/dap.fnl new file mode 100644 index 0000000..6476d3e --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/dap.fnl @@ -0,0 +1,78 @@ +(local dap (require :dap)) +(local adapters (. dap :adapters)) +(local configurations (. dap :configurations)) + +(local dapui (require :dapui)) + +(tset adapters :delve + {:type :server + :port "${port}" + :executable {:command :dlv :args [:dap :-l "127.0.0.1:${port}"]}}) + +(tset configurations :go + [{:type :delve + :name :Debug + :request :launch + :env {:CGO_CFLAGS :-Wno-error=cpp} + :program "${file}"} + {:type :delve + :name :DebugTest + :request :launch + :mode :test + :env {:CGO_CFLAGS :-Wno-error=cpp} + :program "${file}"} + {:type :delve + :name :DebugTerraform + :request :launch + :program "${file}" + :env {:CGO_CFLAGS :-Wno-error=cpp} + :args [:-debug]} + {:type :delve + :name :DebugTerraformAcc + :request :launch + :program "${file}" + :mode :test + :env {:CGO_CFLAGS :-Wno-error=cpp :TF_ACC :1}} + {:type :delve + :name :DebugTestSuite + :request :launch + :mode :test + :env {:CGO_CFLAGS :-Wno-error=cpp} + :program "${fileDirname}"}]) + +(dapui.setup {:expand_lines false}) + +(vim.keymap.set :n :si (lambda [] + (dapui.toggle {:reset true})) {:silent true}) +;; "breakpoints", +;; "repl", +;; "scopes", +;; "stacks", +;; "watches", +;; "hover", +;; "console",) +(vim.keymap.set :n :sfw + (lambda [] + (dapui.float_element :watches + {:width (vim.api.nvim_win_get_width 0) :height 30 :enter true}))) +(vim.keymap.set :n :sfs + (lambda [] + (dapui.float_element :scopes + {:width (vim.api.nvim_win_get_width 0) :height 30 :enter true}))) + +(vim.keymap.set :n :sq dap.terminate {:silent true}) +(vim.keymap.set :n :sc dap.continue {:silent true}) +(vim.keymap.set :n :sr dap.run_to_cursor {:silent true}) +(vim.keymap.set :n :sn dap.step_over {:silent true}) +(vim.keymap.set :n :ss dap.step_into {:silent true}) +(vim.keymap.set :n :so dap.step_out {:silent true}) +(vim.keymap.set :n :sb dap.toggle_breakpoint {:silent true}) +(vim.keymap.set :n :sB dap.set_breakpoint {:silent true}) +(vim.keymap.set :n :slp + (fn [] + (dap.set_breakpoint nil nil + (vim.fn.input "Log point message: "))) + {:silent true}) + +(vim.keymap.set :n :st dap.repl.toggle {:silent true}) +(vim.keymap.set :n :sl dap.run_last {:silent true}) diff --git a/mut/neovim/fnl/conf/pkgs/gitsigns.fnl b/mut/neovim/fnl/conf/pkgs/gitsigns.fnl new file mode 100644 index 0000000..813d410 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/gitsigns.fnl @@ -0,0 +1,2 @@ +(local gitsigns (require :gitsigns)) +(gitsigns.setup) diff --git a/mut/neovim/fnl/conf/pkgs/harpoon.fnl b/mut/neovim/fnl/conf/pkgs/harpoon.fnl new file mode 100644 index 0000000..3f5fc48 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/harpoon.fnl @@ -0,0 +1,39 @@ +(local harpoon-mark (require :harpoon.mark)) +(local harpoon-ui (require :harpoon.ui)) +(fn make-harpoon [func] + (fn [] + (func) + (vim.cmd :redrawtabline))) + +(vim.keymap.set :n "[]" (make-harpoon (fn [] (harpoon-mark.add_file)))) +(vim.keymap.set :n "][" (make-harpoon (fn [] (harpoon-ui.toggle_quick_menu)))) +(vim.keymap.set :n "]]" (make-harpoon (fn [] (harpoon-ui.nav_next)))) +(vim.keymap.set :n "[[" (make-harpoon (fn [] (harpoon-ui.nav_prev)))) + +(var use-numbers false) +(local num [1 2 3 4 5]) +(local shortcuts ["+" "-" "<" ">" "\""]) +(fn print-use-numbers [] + (print (vim.inspect use-numbers))) + +(fn toggle-harpoon-mappings [] + (if (not use-numbers) + (do + ; (each [_ i (ipairs shortcuts)] ; (vim.keymap.del :n i)) + (vim.keymap.set :n "[+" (make-harpoon (fn [] (harpoon-ui.nav_file 1)))) + (vim.keymap.set :n "[-" (make-harpoon (fn [] (harpoon-ui.nav_file 2)))) + (vim.keymap.set :n "[<" (make-harpoon (fn [] (harpoon-ui.nav_file 3)))) + (vim.keymap.set :n "[>" (make-harpoon (fn [] (harpoon-ui.nav_file 4)))) + (vim.keymap.set :n "[\"" (make-harpoon (fn [] (harpoon-ui.nav_file 5)))) + (set use-numbers true)) + (do + ; (each [_ s (ipairs shortcuts)] ; (vim.keymap.del :n s) + (vim.keymap.set :n "[1" (make-harpoon (fn [] (harpoon-ui.nav_file 1)))) + (vim.keymap.set :n "[2" (make-harpoon (fn [] (harpoon-ui.nav_file 2)))) + (vim.keymap.set :n "[3" (make-harpoon (fn [] (harpoon-ui.nav_file 3)))) + (vim.keymap.set :n "[4" (make-harpoon (fn [] (harpoon-ui.nav_file 4)))) + (vim.keymap.set :n "[5" (make-harpoon (fn [] (harpoon-ui.nav_file 5)))) + (set use-numbers false)))) + +(vim.api.nvim_create_user_command :H toggle-harpoon-mappings {}) +(toggle-harpoon-mappings) diff --git a/mut/neovim/fnl/conf/pkgs/heirline.fnl b/mut/neovim/fnl/conf/pkgs/heirline.fnl new file mode 100644 index 0000000..c8d9c52 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/heirline.fnl @@ -0,0 +1,241 @@ +(local heirline (require :heirline)) +(local conditions (require :heirline.conditions)) +(local utils (require :heirline.utils)) +(local colors (let [kanagawa-colors (require :kanagawa.colors)] + (kanagawa-colors.setup))) + +(local Align {:provider "%="}) +(local Space {:provider " "}) +(fn with [tbl with-kv] + (local w {}) + (each [k v (pairs tbl)] + (tset w k v)) + (each [k v (pairs with-kv)] + (tset w k v)) + w) + +(heirline.load_colors colors) +(fn palette [name] + (. colors :palette name)) + +(fn theme [theme name] + (. colors :theme theme name)) + +(var FileNameBlock + {;; let's first set up some attributes needed by this component and it's children + :init (lambda [self] + (tset self :filename (vim.api.nvim_buf_get_name 0)))}) + +(local FileName + {:provider (lambda [self] + ;; first, trim the pattern relative to the current directory. For other + ;;- options, see :h filename-modifers + (var filename (vim.fn.fnamemodify (. self :filename) ":.")) + (if (= filename "") + (set filename "[No Name]") + ;;- now, if the filename would occupy more than 1/4th of the available + ;;-- space, we trim the file path to its initials + ;;-- See Flexible Components section below for dynamic truncation + (if (not (conditions.width_percent_below (length filename) + 0.25)) + (set filename (vim.fn.pathshorten filename)))) + filename) + :hl {:fg (. (utils.get_highlight :Directory) :fg)}}) + +(local FileNameModifier {:hl (lambda [] + (when vim.bo.modified + {:fg (theme :diag :warning) + :bold true + :force true}))}) + +(local FileFlags [{:condition (lambda [] vim.bo.modified) + :provider "[+]" + :hl {:fg (theme :diag :warning)}}]) + +(set FileNameBlock (utils.insert FileNameBlock + (utils.insert FileNameModifier FileName) + FileFlags {:provider "%<"})) + +(local DAPMessages {:condition (lambda [] + (local dap (require :dap)) + (local session (dap.session)) + (not (= session nil))) + :provider (lambda [] + (local dap (require :dap)) + (.. "ο†ˆ " (dap.status))) + :hl :Debug}) + +(local Ruler {;; %l = current line number + ;; %L = number of lines in the buffer + ;; %c = column number + ;; %P = percentage through file of displayed window + :provider "%7(%l/%3L%):%2c %P"}) + +(local ScrollBar + {:static {:sbar ["▁" "β–‚" "β–ƒ" "β–„" "β–…" "β–†" "β–‡" "β–ˆ"]} + ;; Another variant, because the more choice the better. + ;; sbar { '🭢', '🭷', '🭸', '🭹', '🭺', '🭻'}} + :provider (lambda [self] + (local curr_line (. (vim.api.nvim_win_get_cursor 0) 1)) + (local lines (vim.api.nvim_buf_line_count 0)) + (local i + (- (length self.sbar) + (math.floor (* (/ (- curr_line 1) lines) + (length (. self :sbar)))))) + (string.rep (. self :sbar i) 2)) + :hl {:fg (theme :syn :fun) :bg (theme :ui :bg)}}) + +(local Nix + {:condition (fn [] vim.env.IN_NIX_SHELL) + :provider (fn [self] + (local purity vim.env.IN_NIX_SHELL) + (local name vim.env.name) + (.. "οŒ“" purity "(" name ")")) + :hl {:fg (theme :syn :fun) :bold true :bg (theme :ui :bg_m3)}}) + +(local RecordingMacro {:condition #(not= "" (vim.fn.reg_recording)) + :provider (fn [self] + (.. "Recording... " (vim.fn.reg_recording))) + :hl {:fg (theme :syn :fun) + :bold true + :bg (theme :ui :bg_m3)}}) + +(local harpoon (require :harpoon)) +(local harpoon-mark (require :harpoon.mark)) +(local harpoon-colors [(theme :syn :identifier) + (theme :syn :identifier) + (theme :syn :identifier)]) + +(fn mark-component [i mark] + (utils.insert {} {:hl {:bg (if (= mark.filename + (vim.fn.fnamemodify (vim.api.nvim_buf_get_name 0) + ":.")) + (theme :ui :bg_p1) + (theme :ui :bg_m1)) + :bold true + :fg (. harpoon-colors i)} + :provider (fn [self] + (.. " M" i " "))})) + +;{:hl {:fg (theme :syn :fun)} :provider (vim.fn.pathshorten mark.filename)})) +; {:hl {:bold true :fg (. harpoon-colors i)} :provider ")"} Space)) + +(local HarpoonMarks + (utils.insert {:hl :TabLineSel + :condition #(< 0 + (length (. (harpoon.get_mark_config) + :marks)))} + {:init (lambda [self] + (local mark-list + (. (harpoon.get_mark_config) :marks)) + (each [i mark (ipairs mark-list)] + (tset self i + (self:new (mark-component i mark) i))) + (while (> (length self) (length mark-list)) + (table.remove self (length self))))})) + +(local Tabpage + {:provider (lambda [self] + (fn fnamemod [name mod] + (vim.fn.fnamemodify name mod)) + + (fn format-name [name] + (if (= name "") "[No Name]" + (fnamemod name ":t"))) + + (.. "%" self.tabnr "T " self.tabnr " ")) + :hl (lambda [self] + (if (not self.is_active) :TabLine :TabLineSel))}) + +(fn active-tab-hrpn [self] + (local hl {}) + (if (. self :is_active) + (do + (tset hl :fg (theme :syn :identifier)) + (tset hl :bold true))) + hl) + +(fn active-hl [hl] + (lambda [self] + (if self.is_active + hl + {}))) + +(fn tab-visible-buffers [tab] + (local visible (vim.fn.tabpagebuflist tab)) + (if (= visible 0) + [] + visible)) + +(fn tab-harpoon-marks [tab] + (local visible (tab-visible-buffers tab)) + (local tab-buffers (accumulate [buffers [] _ buf (ipairs visible)] + (do + (if (not (vim.tbl_contains buffers buf)) + (table.insert buffers buf)) + buffers))) + (icollect [_ buf (ipairs tab-buffers)] + (do + (local status (harpoon-mark.status buf)) + (if (not= status "") + status)))) + +(local Tabpage + (utils.insert Tabpage {:hl active-tab-hrpn :provider "🌊 [ "} + {:hl (active-hl {:fg (theme :syn :fun)}) + :provider (lambda [self] + (local harpoon_marks + (tab-harpoon-marks self.tabnr)) + (table.concat harpoon_marks " "))} + {:hl active-tab-hrpn :provider " ] %T"})) + +(local TabpageClose {:provider "%999X ο™• %X" :hl :TabLine}) + +(local TabPages + {;; only show this component if there's 2 or more tabpages + :condition (lambda [] + (>= (length (vim.api.nvim_list_tabpages)) 1))}) + +(local TabPages (utils.insert TabPages (utils.make_tablist Tabpage) + TabpageClose)) + +(local dispatch-get-request (. vim.fn "dispatch#request")) +(local Dispatch (utils.insert {:init (fn [self] + (set self.req (dispatch-get-request))) + :condition (fn [] + (not (vim.tbl_isempty (dispatch-get-request))))} + {:provider "dispatch(" + :hl (fn [self] + {:fg (if (= 1 self.req.completed) + (theme :syn :fun) + (theme :diag :warning)) + :bold true})} + {:provider (fn [self] + self.req.command) + :hl {:fg (theme :syn :string) :bold false}} + {:provider ")" + :hl (fn [self] + {:fg (if (= 1 self.req.completed) + (theme :syn :fun) + (theme :diag :warning)) + :bold true})})) + +(local StatusLine [FileNameBlock + Space + HarpoonMarks + Space + TabPages + DAPMessages + Space + RecordingMacro + Dispatch + Align + Space + Nix + Space + Ruler + Space + ScrollBar + Space]) + +(heirline.setup {:statusline StatusLine}) diff --git a/mut/neovim/fnl/conf/pkgs/lsp_lines.fnl b/mut/neovim/fnl/conf/pkgs/lsp_lines.fnl new file mode 100644 index 0000000..7194bd9 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/lsp_lines.fnl @@ -0,0 +1,2 @@ +(let [l (require :lsp_lines)] + (l.setup)) diff --git a/mut/neovim/fnl/conf/pkgs/lsp_signature.fnl b/mut/neovim/fnl/conf/pkgs/lsp_signature.fnl new file mode 100644 index 0000000..7fecc9e --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/lsp_signature.fnl @@ -0,0 +1,3 @@ +(local lsp_signature (require :lsp_signature)) + +(lsp_signature.setup) diff --git a/mut/neovim/fnl/conf/pkgs/lspconfig.fnl b/mut/neovim/fnl/conf/pkgs/lspconfig.fnl new file mode 100644 index 0000000..accd001 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/lspconfig.fnl @@ -0,0 +1,51 @@ +(local lspconfig (require :lspconfig)) +(local configs (require :lspconfig.configs)) +(local {: attach} (require :conf.lsp)) + +(lspconfig.pyright.setup {:root_dir (lspconfig.util.root_pattern :.git + (vim.fn.getcwd)) + :on_attach attach}) + +(lspconfig.tsserver.setup {:root_dir (lspconfig.util.root_pattern :.git + (vim.fn.getcwd)) + :on_attach attach}) + +(local pid (vim.fn.getpid)) +(lspconfig.omnisharp.setup {:cmd [:OmniSharp + :--languageserver + :--hostPID + (tostring pid)] + :handlers {[:textDocument/definition] (. (require :omnisharp_extended) + :handler)} + :root_dir (lspconfig.util.root_pattern :.git + (vim.fn.getcwd)) + :on_attach attach}) + +(lspconfig.gopls.setup {:root_dir (lspconfig.util.root_pattern :.git + (vim.fn.getcwd)) + :on_attach attach + :settings {:gopls {:codelenses {:test true :bench true} + ;; Show a code lens toggling the display of gc's choices.} + :buildFlags [:-tags=all]}}}) + +(lspconfig.ansiblels.setup {:ansible {:ansible {:path :ansible} + :executionEnvironment {:enabled false} + :python {:interpreterPath :python} + :validation {:enabled true + :lint {:enabled false + :arguments " --profile=production --write=all " + :path :ansible-lint}}}}) + +;; (tset configs :fennel_language_server +;; {:default_config {;; replace it with true path +;; :cmd [:fennel-language-server] +;; :filetypes [:fennel] +;; :single_file_support true +;; ;; source code resides in directory `fnl/` +;; :root_dir (lspconfig.util.root_pattern :fnl) +;; :settings {:fennel {:workspace {;; If you are using hotpot.nvim or aniseed, +;; ;; make the server aware of neovim runtime files. +;; :library (vim.api.nvim_list_runtime_paths)} +;; :diagnostics {:globals [:vim]}}}}}) +;; +;; (lspconfig.fennel_language_server.setup {:on_attach attach}) diff --git a/mut/neovim/fnl/conf/pkgs/neotest.fnl b/mut/neovim/fnl/conf/pkgs/neotest.fnl new file mode 100644 index 0000000..251cdcb --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/neotest.fnl @@ -0,0 +1,4 @@ +(let [nt (require :neotest) + python (require :neotest-python)] + (nt.setup {:adapters [(python {:dap {:justMyCode false}})]})) + diff --git a/mut/neovim/fnl/conf/pkgs/noice.fnl b/mut/neovim/fnl/conf/pkgs/noice.fnl new file mode 100644 index 0000000..58ac761 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/noice.fnl @@ -0,0 +1,34 @@ +(local noice (require :noice)) +(noice.setup {:views {:cmdline_popup {:border {:style :none :padding [1 3]} + :win_options {:winhighlight "NormalFloat:NormalFloat,FloatBorder:FloatBorder"}}} + :lsp {;; override markdown rendering so that **cmp** and other plugins use **Treesitter** + :override {[:vim.lsp.util.convert_input_to_markdown_lines] true + [:vim.lsp.util.stylize_markdown] true + [:cmp.entry.get_documentation] true}} + :popupmenu {:enabled false} + :messages {; NOTE: If you enable messages then the cmdline is enabled automatically. + ; This is a current Neovim limitation. + :enabled true + ; enables the Noice messages UI + :view :mini + ; default view for messages + :view_error :mini + ; view for errors + :view_warn :mini + ; view for warnings + :view_history :mini + ; view for :messages + :view_search :virtualtext} + ; view for search count messages. Set to `false` to disable} + ;; you can enable a preset for easier configuration + :presets {:bottom_search true + ; use a classic bottom cmdline for search + :command_palette true + ; position the cmdline and popupmenu together + :long_message_to_split true + ; long messages will be sent to a split + :inc_rename false + ; enables an input dialog for inc-rename.nvim + :lsp_doc_border false}}) + +; add a border to hover docs and signature help}}) diff --git a/mut/neovim/fnl/conf/pkgs/null-ls.fnl b/mut/neovim/fnl/conf/pkgs/null-ls.fnl new file mode 100644 index 0000000..9908823 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/null-ls.fnl @@ -0,0 +1,21 @@ +(local lsp-conf (require :conf.lsp)) +(local null-ls (require :null-ls)) + +(local fmt null-ls.builtins.formatting) +(local diag null-ls.builtins.diagnostics) + +(fn executable? [program] + (fn [] + (= 1 (vim.fn.executable program)))) + +(null-ls.setup {:update_in_insert false + :debug true + :on_attach (fn [client buf] + (lsp-conf.attach client buf true)) + :sources [fmt.alejandra + fmt.fnlfmt + (fmt.black.with {:condition (executable? :black)}) + (fmt.goimports.with {:condition (executable? :goimports)}) + (fmt.gofumpt.with {:condition (executable? :gofumpt)}) + (fmt.raco_fmt.with {:condition (executable? :raco)}) + (fmt.terraform_fmt.with {:condition (executable? :terraform)})]}) diff --git a/mut/neovim/fnl/conf/pkgs/test.fnl b/mut/neovim/fnl/conf/pkgs/test.fnl new file mode 100644 index 0000000..4f0bcc4 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/test.fnl @@ -0,0 +1,9 @@ +(tset vim.g "test#strategy" :neovim) +(tset vim.g "test#neovim#term_position" :botright) + +(vim.keymap.set :n :t ":TestNearest" {:silent true}) +(vim.keymap.set :n :C ":TestClass" {:silent true}) +(vim.keymap.set :n :T ":TestFile" {:silent true}) +(vim.keymap.set :n :a ":TestSuite" {:silent true}) +(vim.keymap.set :n :l ":TestLast" {:silent true}) +(vim.keymap.set :n :g ":TestVisit" {:silent true}) diff --git a/mut/neovim/fnl/conf/pkgs/tree-sitter-context.fnl b/mut/neovim/fnl/conf/pkgs/tree-sitter-context.fnl new file mode 100644 index 0000000..12fedc6 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/tree-sitter-context.fnl @@ -0,0 +1,2 @@ +(local context (require :treesitter-context)) +(context.setup {:enable true}) diff --git a/mut/neovim/fnl/conf/pkgs/treesitter.fnl b/mut/neovim/fnl/conf/pkgs/treesitter.fnl new file mode 100644 index 0000000..c613be0 --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/treesitter.fnl @@ -0,0 +1,2 @@ +(let [ts (require :nvim-treesitter.configs)] + (ts.setup {:highlight {:enable true}})) diff --git a/mut/neovim/fnl/conf/pkgs/venn.fnl b/mut/neovim/fnl/conf/pkgs/venn.fnl new file mode 100644 index 0000000..064e84e --- /dev/null +++ b/mut/neovim/fnl/conf/pkgs/venn.fnl @@ -0,0 +1,18 @@ +;; venn.nvim: enable or disable keymappings +(fn toggle-venn [] + (if (not vim.b.venn_enabled) + (do + (set vim.b.venn_enabled true) + (vim.cmd "setlocal ve=all") ; draw a line on HJKL keystokes + (vim.keymap.set [:n] :J "j:VBox" {:noremap true :buffer 0}) + (vim.keymap.set [:n] :K "k:VBox" {:noremap true :buffer 0}) + (vim.keymap.set [:n] :L "l:VBox" {:noremap true :buffer 0}) + (vim.keymap.set [:n] :H "h:VBox" {:noremap true :buffer 0}) ; draw a box by pres]sing "f" with visual selection) + (vim.keymap.set [:v] :f ":VBox" {:noremap true :buffer 0})) + (do + (vim.cmd "setlocal ve=") + (vim.cmd "mapclear ") + (set vim.b.venn_enabled nil)))) + +; toggle keymappings for venn using v) +(vim.keymap.set [:n] :v toggle-venn {:noremap true}) diff --git a/mut/neovim/fnl/conf/settings.fnl b/mut/neovim/fnl/conf/settings.fnl new file mode 100644 index 0000000..ec68e6c --- /dev/null +++ b/mut/neovim/fnl/conf/settings.fnl @@ -0,0 +1,69 @@ +(import-macros {: settings : globals} :conf.macros) + +(globals + codeium_enabled false + loaded_2html_plugin true + loaded_fzf false + loaded_man false + loaded_gzip false + loaded_health false + loaded_matchit false + loaded_matchparen false + loaded_netrwPlugin false + loaded_rplugin false + loaded_shada false + loaded_spellfile false + loaded_tarPlugin false + loaded_tohtml false + loaded_tutor false + loaded_zipPlugin false + + mapleader " " + maplocalleader " " + dirvish_mode ":sort | sort ,^.*[^/]$, r") + +(settings + +shortmess "c" + +diffopt vertical + +isfname "@-@" + wmw 10 + inccommand split + signcolumn yes + smd off + scrolloff 8 + termguicolors on + incsearch on + undofile on + undodir (.. (os.getenv :HOME) :/.local/share/nvim/undo) + backup off + backupcopy yes + swapfile off + wrap off + splitbelow on + magic on + showbreak "+++" + listchars {:eol "󰁂"} + list on + autoread on + autoindent on + smartindent on + expandtab on + tabstop 4 + softtabstop 4 + shiftwidth 4 + hidden on + number on + relativenumber on + exrc on + secure on + completeopt "menuone,noselect" + wildmode "lastused" + complete ".,w,k,kspell,b" + foldopen "block,hor,jump,mark,percent,quickfix,search,tag" + laststatus 3 + ; winbar "%=%m %f" + winbar "" + hlsearch off + clipboard "" + showtabline 0 + cmdheight 0) diff --git a/mut/neovim/fnl/conf/wict-nvim/builder.fnl b/mut/neovim/fnl/conf/wict-nvim/builder.fnl new file mode 100644 index 0000000..177b773 --- /dev/null +++ b/mut/neovim/fnl/conf/wict-nvim/builder.fnl @@ -0,0 +1,99 @@ +(tset package.loaded :conf.wict-nvim.frames.frame nil) +(local vec (require :conf.wict-nvim.frames.vec)) +(local frame (require :conf.wict-nvim.frames.frame)) +(local m {}) + +;; Creates a new painter that wraps the paint and close methods of a painter +(local transform-painter (fn [painter ori width height] + (fn [frm] + (local coord (frame.frame->coord frm)) + (local new-ori (coord ori)) + (local new-frame + (frame new-ori + (vec.sub (coord width) new-ori) + (vec.sub (coord height) new-ori))) + (painter new-frame)))) + +(local pad (fn [painter pad-size] + (fn [frm] + (local pad-width (/ pad-size (frame.width frm))) + (local pad-height (/ pad-size (frame.height frm))) + (local transformed + (transform-painter painter (vec.vec pad-width pad-height) + (vec.vec (- 1 pad-width) pad-height) + (vec.vec pad-width (- 1 pad-height)))) + (transformed frm)))) + +(local beside (fn [p1 p2 size] + (local size (or size 0.5)) + (local left + (transform-painter p1 (vec.vec 0 0) (vec.vec size 0) + (vec.vec 0 1))) + (local right + (transform-painter p2 (vec.vec size 0) (vec.vec 1 0) + (vec.vec size 1))) + (fn [frm] + (left frm) + (right frm)))) + +(local builder {}) + +(fn builder.Padding [self size] + (table.insert self.partial-painters {:op :pad : size}) + self) + +(fn builder.Beside [self partial-builder size] + (table.insert self.partial-painters {:op :beside : partial-builder : size}) + self) + +(fn builder.LeftOf [self partial-builder size] + (table.insert self.partial-painters {:op :left : partial-builder : size}) + self) + +(fn builder.RightOf [self partial-builder size] + (table.insert self.partial-painters {:op :right : partial-builder : size}) + self) + +(fn builder.build-painter [self effects] + (accumulate [painter (fn [frame] (print :leaf-painter)) _ partial-painter (ipairs self.partial-painters)] + (do + (match partial-painter + {:op :pad : size} (do + (pad painter size)) + {:op :left : partial-builder} (do + (beside painter + (partial-builder:build-painter effects) + partial-painter.size)) + {:op :right : partial-builder} (do + (beside (partial-builder:build-painter effects) + painter partial-painter.size)) + {:op :beside : partial-builder} (do + (beside painter + (partial-builder:build-painter effects) + partial-painter.size)) + {: maps : buffer} (do + (local window (effects:new-window maps)) + (local painter-ptr painter) + (fn [frm] + (local frame-opts + (frame.frame->open-win-options frm)) + (local buf (buffer)) + (if (not (window:open?)) + (window:open buf frame-opts) + (window:repaint buf frame-opts)) + (painter-ptr frm))) + _ painter)))) + +(fn builder.Build [self effects] + (local painter (self:build-painter effects)) + (fn [frm] + (effects:attach) + (painter frm))) + +(fn builder.For [partial-painter] + (local bldr {:partial-painters [partial-painter]}) + (setmetatable bldr builder) + (set builder.__index builder) + bldr) + +builder diff --git a/mut/neovim/fnl/conf/wict-nvim/effects.fnl b/mut/neovim/fnl/conf/wict-nvim/effects.fnl new file mode 100644 index 0000000..e4321da --- /dev/null +++ b/mut/neovim/fnl/conf/wict-nvim/effects.fnl @@ -0,0 +1,81 @@ +(local m {}) +(local window {}) + +(local aug vim.api.nvim_create_augroup) +(local del-aug (fn [] (vim.api.nvim_create_augroup :EffectsMgr {:clear true}))) +(local au vim.api.nvim_create_autocmd) +(local winvar (fn [...] (pcall vim.api.nvim_win_get_var ...))) +(local unmap (fn [{: mode : lhs : opts}] (pcall vim.keymap.del mode lhs opts))) +(local map (fn [mode lhs rhs opts] (vim.keymap.set mode lhs rhs opts))) + +(fn window.close [self] + (if (self:open?) + (set self.handle (vim.api.nvim_win_close self.handle true)))) + +(fn window.open [self buf frame] + (set frame.style :minimal) + (set self.handle (vim.api.nvim_open_win buf false frame)) + (P self.handle :before-setvar) + (vim.api.nvim_buf_set_var buf :effect-window self) + (vim.api.nvim_win_set_var self.handle :effect-window self) + (if self.enter + (vim.api.nvim_set_current_win self.handle))) + +(fn window.id [self] + self.handle) + +(fn window.open? [self] + (if self.handle + (vim.api.nvim_win_is_valid self.handle) false)) + +(fn window.new [self i enter maps] + (local w (setmetatable {: i : enter : maps} window)) + (set self.__index self) + w) + +(fn m.new-window [self maps] + (local w (window:new (+ (length self.windows) 1) (= (length self.windows) 0) + maps)) + (table.insert self.windows w) + w) + +(fn m.close [self] + (each [_ w (ipairs self.windows)] + (w:close)) + (if self.augroup + (set self.augroup (del-aug self.augroup))) + (if self.unmap + (set self.unmap (self.unmap)))) + +(fn m.attach [self] + (set self.augroup (aug :EffectsMgr {:clear true})) + (au [:WinEnter] + {:group self.augroup + :pattern "*" + :callback (fn [cb-info] + (P :effectEnter) + (local (ok? win) (winvar 0 :effect-window)) + (P ok? win) + (if (not ok?) + (self:close) + (do + (if win.maps + (self:win-maps win)))))})) + +(fn m.win-maps [self win] + (P win) + (if self.unmap + (self.unmap)) + (set self.unmap (fn [] + (each [_ m (ipairs win.maps)] + (unmap m)))) + (each [_ {: mode : lhs : rhs : opts} (ipairs win.maps)] + (map mode lhs (rhs self win) opts))) + +(fn m.new [self opts] + (local effects {:windows []}) + (setmetatable effects self) + (set self.__index self) + effects) + +m diff --git a/mut/neovim/fnl/conf/wict-nvim/frames/frame.fnl b/mut/neovim/fnl/conf/wict-nvim/frames/frame.fnl new file mode 100644 index 0000000..d32c9b5 --- /dev/null +++ b/mut/neovim/fnl/conf/wict-nvim/frames/frame.fnl @@ -0,0 +1,61 @@ +(local vec (require :conf.wict-nvim.frames.vec)) +(local m {}) +(local frame {}) + +;; frame is interpreted as matrix coords +;; origin ------------------> ne-edge +;; | +;; | +;; | +;; | +;; | +;; | +;;\ / +;; . +;; sw-edge +(fn frame.make [self ori width height] + (local f {: ori : width : height}) + (setmetatable f self) + (set self.__index self) + f) + +(fn frame.origin [f] + f.ori) + +(fn frame.width-edge [f] + f.width) + +(fn frame.height-edge [f] + f.height) + +(fn m.frame->coord [f] + (fn [v] + (vec.add (f:origin) + (vec.add (vec.scale (v:x-coord) (f:width-edge)) + (vec.scale (v:y-coord) (f:height-edge)))))) + +(fn m.width [f] + (let [width-edge (f:width-edge)] + (width-edge:x-coord))) + +(fn m.height [f] + (let [height-edge (f:height-edge)] + (height-edge:y-coord))) + +(fn m.frame->open-win-options [f anchor] + (local coord (m.frame->coord f)) + (local ori (f:origin)) + (local width-edge (f:width-edge)) + (local height-edge (f:height-edge)) + (local anchor (or anchor :NW)) + {:width (width-edge:x-coord) + :height (height-edge:y-coord) + :col (ori:x-coord) + :row (ori:y-coord) + : anchor + :relative :editor}) + +(setmetatable m {:__call (fn [self ...] + (frame:make ...))}) + +m diff --git a/mut/neovim/fnl/conf/wict-nvim/frames/vec.fnl b/mut/neovim/fnl/conf/wict-nvim/frames/vec.fnl new file mode 100644 index 0000000..4a9515d --- /dev/null +++ b/mut/neovim/fnl/conf/wict-nvim/frames/vec.fnl @@ -0,0 +1,28 @@ +(local m {}) +(local vec {}) + +(fn vec.make [self x y] + (local v {: x : y}) + (setmetatable v self) + (set self.__index self) + v) + +(fn vec.x-coord [v] + v.x) + +(fn vec.y-coord [v] + v.y) + +(fn m.add [v1 v2] + (vec:make (+ (v1:x-coord) (v2:x-coord)) (+ (v1:y-coord) (v2:y-coord)))) + +(fn m.sub [v1 v2] + (vec:make (- (v1:x-coord) (v2:x-coord)) (- (v1:y-coord) (v2:y-coord)))) + +(fn m.scale [a v] + (vec:make (math.floor (* a (v:x-coord))) (math.floor (* a (v:y-coord))))) + +(fn m.vec [...] + (vec:make ...)) + +m diff --git a/mut/neovim/fnl/conf/wict-nvim/init.fnl b/mut/neovim/fnl/conf/wict-nvim/init.fnl new file mode 100644 index 0000000..9e40fad --- /dev/null +++ b/mut/neovim/fnl/conf/wict-nvim/init.fnl @@ -0,0 +1,31 @@ +(tset package.loaded :conf.wict-nvim.frames.vec nil) +(local vec (require :conf.wict-nvim.frames.vec)) + +(tset package.loaded :conf.wict-nvim.frames.frame nil) +(local frame (require :conf.wict-nvim.frames.frame)) + +(tset package.loaded :conf.wict-nvim.builder nil) +(local builder (require :conf.wict-nvim.builder)) + +(tset package.loaded :conf.wict-nvim.effects nil) +(local effects (require :conf.wict-nvim.effects)) + +(local m {}) + +(local root-frame (frame (vec.vec 0 0) (vec.vec vim.o.columns 0) + (vec.vec 0 vim.o.lines))) + +(local painter (-> (builder.For {:buffer (fn [] 0) + :maps [{:mode [:n :v :o] + :lhs :q + :rhs (fn [effects window] + (fn [] + (effects:close)))}]}) + (builder.Beside (-> (builder.For {:buffer (fn [] 0) + :maps []})) + 0.5) + (builder.Padding 5) + (builder.Build (effects:new)))) + +; (painter root-frame) +{: root-frame : builder : effects} diff --git a/mut/neovim/fnl/conf/wictl-nvim/init.fnl b/mut/neovim/fnl/conf/wictl-nvim/init.fnl new file mode 100644 index 0000000..bd04182 --- /dev/null +++ b/mut/neovim/fnl/conf/wictl-nvim/init.fnl @@ -0,0 +1,58 @@ +(local Path (require :plenary.path)) +(tset package.loaded :conf.wict-nvim nil) +(local wict (require :conf.wict-nvim)) +(tset package.loaded :conf.wictl-nvim.resolvers nil) +(local Resolver (require :conf.wictl-nvim.resolvers)) + +(local bld wict.builder) +(local eff wict.effects) + +(local config_path (vim.fn.stdpath :config)) +(local data_path (vim.fn.stdpath :data)) +(local user_config (string.format "%s/wictl.json" config_path)) +(local cache_config (string.format "%s/wictl.json" data_path)) + +(local m {}) + +(local WictlConfig {}) +;; { +;; ["/path/to/project"] = { +;; terms = [{cmd = "k9s"}] +;; } + +(fn m.Edit [project]) + +(fn m.Read [path] + (local p (Path:new path)) + (vim.fn.json_decode (p:read))) + +(fn m.Save [] + (local cache-path (Path:new cache_config)) + (cache-path:write (vim.fn.json_encode WictlConfig) :w)) + +(local ensure-complete-project (fn [config] + (var config (or config {:terms []})) + (if (not config.terms) + (set config.terms + [{:name :k9s :cmd :bash}])) + config)) + +(local get-project (fn [] + (local proj (. WictlConfig (Resolver.project_key))) + (ensure-complete-project (or proj + (do + (local cfg {}) + (tset WictlConfig + (Resolver.project_key) + cfg) + cfg))))) + +(fn m.Get-Terms-Config [] + (local proj (get-project)) + proj.terms) + +(m.Save) +(m.Read cache_config) +(m.Get-Terms-Config) + +m diff --git a/mut/neovim/fnl/conf/wictl-nvim/resolvers.fnl b/mut/neovim/fnl/conf/wictl-nvim/resolvers.fnl new file mode 100644 index 0000000..df5f2ac --- /dev/null +++ b/mut/neovim/fnl/conf/wictl-nvim/resolvers.fnl @@ -0,0 +1,5 @@ +(local m {}) +(fn m.project_key [] + (vim.loop.cwd)) + +m diff --git a/mut/neovim/fnl/conf/wictl-nvim/term.fnl b/mut/neovim/fnl/conf/wictl-nvim/term.fnl new file mode 100644 index 0000000..51e263a --- /dev/null +++ b/mut/neovim/fnl/conf/wictl-nvim/term.fnl @@ -0,0 +1,54 @@ +(tset package.loaded :conf.wict-nvim nil) +(local ui (require :conf.wict-nvim)) +(tset package.loaded :conf.wict-nvim.effects nil) +(local ui-eff (require :conf.wict-nvim.effects)) + +(tset package.loaded :conf.wictl-nvim nil) +(local wictl (require :conf.wictl-nvim)) + +(local Resolver (require :conf.wictl-nvim.resolvers)) +(local ui-bld ui.builder) +(local M {}) + +(local ProjectBufs {}) +(var selected nil) +(local term-ui (-> (ui-bld.For {:buffer (fn [] selected) + :maps [{:mode [:n :v :o] + :lhs :q + :rhs (fn [effects window] + (fn [] + (P :quitting!) + (effects:close)))}]}) + (ui-bld.Padding 2) + (ui-bld.Build (ui-eff:new)))) + +(fn M.open [idx] + (local new-term-buf (fn [] + (local (buf_handle term_handle) (M.start idx)) + (tset ProjectBufs (Resolver.project_key) idx + {: buf_handle : term_handle}) + {: buf_handle : term_handle})) + (local proj (or (. ProjectBufs (Resolver.project_key)) + (do + (local p []) + (tset ProjectBufs (Resolver.project_key) p) + p))) + (var term (or (. proj idx) (new-term-buf))) + (if (or (not (vim.api.nvim_buf_is_valid term.buf_handle)) + (not (vim.api.nvim_buf_get_var term.buf_handle :terminal_job_id))) + (set term (new-term-buf))) + (set selected term.buf_handle) + (term-ui ui.root-frame)) + +(fn M.start [idx] + (P :starting) + (local term (. (wictl.Get-Terms-Config) idx)) + (local prestart-buf (vim.api.nvim_get_current_buf)) + (vim.cmd (.. "edit term://" term.cmd)) + (local buf_handle (vim.api.nvim_get_current_buf)) + (local term_handle vim.b.terminal_job_id) + (vim.api.nvim_buf_set_option buf_handle :bufhidden :hide) + (vim.api.nvim_set_current_buf prestart-buf) + (values buf_handle term_handle)) + +M diff --git a/mut/neovim/init.fnl b/mut/neovim/init.fnl new file mode 100644 index 0000000..7e82675 --- /dev/null +++ b/mut/neovim/init.fnl @@ -0,0 +1,36 @@ +;; fixes nixpkgs hotpot not adding package path correctly + +(tset _G.package :path + (.. (vim.fn.stdpath :cache) "/hotpot/hotpot.nvim/lua/?/init.lua;" + package.path)) + +(fn build-init [] + (let [{: build} (require :hotpot.api.make) + allowed-globals (icollect [n _ (pairs _G)] + n) + opts {:verbosity 0 + :compiler {:modules {:allowedGlobals allowed-globals}}} + here #(values $1) + config-path (vim.fn.stdpath :config)] + (build config-path opts (.. config-path :/init.fnl) here + (.. config-path :/after/ftdetect/.+) here + (.. config-path :/ftplugin/.+) here + (.. config-path :/after/ftplugin/.+) here))) + +;; Call hotpot.setup and compile again after fs event + +(let [hotpot (require :hotpot) + setup hotpot.setup + build hotpot.api.make.build + uv vim.loop + config-path (vim.fn.stdpath :config)] + (setup {:provide_require_fennel true + :compiler {:modules {:correlate true} + :macros {:env :_COMPILER + :compilerEnv _G + :allowedGlobals false}}}) + (let [handle (uv.new_fs_event) + path (vim.fn.expand (.. config-path :/init.fnl))] + (uv.fs_event_start handle path {} #(vim.schedule build-init)) + (vim.api.nvim_create_autocmd :VimLeavePre {:callback #(uv.close handle)}))) +(require :conf) diff --git a/mut/neovim/init.lua b/mut/neovim/init.lua new file mode 100644 index 0000000..3de4446 --- /dev/null +++ b/mut/neovim/init.lua @@ -0,0 +1,46 @@ +_G.package["path"] = (vim.fn.stdpath("cache") .. "/hotpot/hotpot.nvim/lua/?/init.lua;" .. package.path) +local function build_init() + local _let_1_ = require("hotpot.api.make") + local build = _let_1_["build"] + local allowed_globals + do + local tbl_17_auto = {} + local i_18_auto = #tbl_17_auto + for n, _ in pairs(_G) do + local val_19_auto = n + if (nil ~= val_19_auto) then + i_18_auto = (i_18_auto + 1) + do end (tbl_17_auto)[i_18_auto] = val_19_auto + else + end + end + allowed_globals = tbl_17_auto + end + local opts = {verbosity = 0, compiler = {modules = {allowedGlobals = allowed_globals}}} + local here + local function _3_(_241) + return _241 + end + here = _3_ + local config_path = vim.fn.stdpath("config") + return build(config_path, opts, (config_path .. "/init.fnl"), here, (config_path .. "/after/ftdetect/.+"), here, (config_path .. "/ftplugin/.+"), here, (config_path .. "/after/ftplugin/.+"), here) +end +do + local hotpot = require("hotpot") + local setup = hotpot.setup + local build = hotpot.api.make.build + local uv = vim.loop + local config_path = vim.fn.stdpath("config") + setup({provide_require_fennel = true, compiler = {modules = {correlate = true}, macros = {env = "_COMPILER", compilerEnv = _G, allowedGlobals = false}}}) + local handle = uv.new_fs_event() + local path = vim.fn.expand((config_path .. "/init.fnl")) + local function _4_() + return vim.schedule(build_init) + end + uv.fs_event_start(handle, path, {}, _4_) + local function _5_() + return uv.close(handle) + end + vim.api.nvim_create_autocmd("VimLeavePre", {callback = _5_}) +end +return require("conf") \ No newline at end of file diff --git a/mut/neovim/test.py b/mut/neovim/test.py new file mode 100644 index 0000000..e69de29 diff --git a/neovim/README.md b/neovim/README.md deleted file mode 100644 index 3a441bd..0000000 --- a/neovim/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# mike_neovim -installs my neovim config on mac or linux diff --git a/neovim/compiler/ansible-lint.vim b/neovim/compiler/ansible-lint.vim deleted file mode 100644 index 9427092..0000000 --- a/neovim/compiler/ansible-lint.vim +++ /dev/null @@ -1,11 +0,0 @@ -if exists('current_compiler') - finish -endif -let current_compiler = 'go-test' - -if exists(':CompilerSet') != 2 - command -nargs=* CompilerSet setlocal -endif - -CompilerSet makeprg=compile\ ansible-lint -CompilerSet errorformat=%Z%f:%l\ %m,%Z%f:%l,%E%\\%%(%\\S%\\)%\\@=%m,%C%\\%%(%\\S%\\)%\\@=%m,%-G diff --git a/neovim/compiler/go-test.vim b/neovim/compiler/go-test.vim deleted file mode 100644 index 61442e5..0000000 --- a/neovim/compiler/go-test.vim +++ /dev/null @@ -1,14 +0,0 @@ -if exists('current_compiler') - finish -endif -let current_compiler = 'go-test' - -if exists(':CompilerSet') != 2 - command -nargs=* CompilerSet setlocal -endif - -" %f>%l:%c:%t:%n:%m -CompilerSet makeprg=go\ test -CompilerSet errorformat=%.%#:\ %m\ %f:%l,%.%#:\ %m\ at\ %f:%l%.%#, - -" vim: sw=2 sts=2 et diff --git a/neovim/compiler/helm.vim b/neovim/compiler/helm.vim deleted file mode 100644 index 7e4b21d..0000000 --- a/neovim/compiler/helm.vim +++ /dev/null @@ -1,14 +0,0 @@ -if exists('current_compiler') - finish -endif -let current_compiler = 'go-test' - -if exists(':CompilerSet') != 2 - command -nargs=* CompilerSet setlocal -endif - -CompilerSet makeprg=compile\ helm\ lint -CompilerSet errorformat=\[%t%.%#\]%.%#\ template:\ %f:%l:%c:\ %m, - \\[%t%.%#\]\ %f:\ %m, - -" vim: sw=2 sts=2 et diff --git a/neovim/compiler/racket.vim b/neovim/compiler/racket.vim deleted file mode 100644 index 1f98a41..0000000 --- a/neovim/compiler/racket.vim +++ /dev/null @@ -1,26 +0,0 @@ -if exists('current_compiler') - finish -endif -let current_compiler = 'go-test' - -if exists(':CompilerSet') != 2 - command -nargs=* CompilerSet setlocal -endif - -" The errorformat can also use vim's regular expression syntax (albeit in a rather awkward way) which gives us a solution to the problem. We can use a non-capturing group and a zero-width assertion to require the presence of these signaling phrases without consuming them. This then allows the %m to pick them up. As plain regular expression syntax this zero-width assertion looks like: -" -" \%(undefined reference\|multiple definition\)\@= -" -" But in order to use it in efm we need to replace \ by %\ and % by %% - - -CompilerSet makeprg=compile\ racket -CompilerSet errorformat=\%Z%*\\S%.%#, - \%C\ \ \ %f:%l:%c, - \%C\ \ \ %f:%l:%c:\ %m, - \%C\ \ %.%#%\\%%(module%\\spath:%\\\|at\:%\\\|in\:%\\\|expected\:%\\\|given\:%\\)%\\@=%m, - \%C\ %.%#, - \%E%\\%%(%\\w%\\)%\\@=%f:%*\\d:%*\\d:\ %m, - \%E%*\\f:%*\\d:%*\\d:\ %m, - \%E%\\%%(%\\S%\\+:%\\\|%\.%\\+--%\\)%\\@=%m, -" vim: sw=2 sts=2 et diff --git a/neovim/compiler/terragrunt.vim b/neovim/compiler/terragrunt.vim deleted file mode 100644 index 54f94ef..0000000 --- a/neovim/compiler/terragrunt.vim +++ /dev/null @@ -1,21 +0,0 @@ -if exists('current_compiler') - finish -endif -let current_compiler = 'go-test' - -if exists(':CompilerSet') != 2 - command -nargs=* CompilerSet setlocal -endif - -" The errorformat can also use vim's regular expression syntax (albeit in a rather awkward way) which gives us a solution to the problem. We can use a non-capturing group and a zero-width assertion to require the presence of these signaling phrases without consuming them. This then allows the %m to pick them up. As plain regular expression syntax this zero-width assertion looks like: -" -" \%(undefined reference\|multiple definition\)\@= -" -" But in order to use it in efm we need to replace \ by %\ and % by %% - - -CompilerSet makeprg=terragrunt -CompilerSet errorformat=%.%#level=%t%.%#msg=%f:%l%\\,%c-%*\\d:\ %m, - \%Z%m, - \%E-\ %m\ (at\ %f:%l\\,%c-%*\\d), -" vim: sw=2 sts=2 et diff --git a/neovim/debug b/neovim/debug deleted file mode 100644 index 6319340..0000000 --- a/neovim/debug +++ /dev/null @@ -1,8 +0,0 @@ -~/projects/k8s ~/neovim -can't find session: kaks@projects-k8s -direnv: loading ~/projects/k8s/.envrc -direnv: using flake -direnv: nix-direnv: using cached dev shell -make: *** No rule to make target 'envtest'. Stop. -direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +ENVTEST +ENVTEST_K8S_VERSION +GOTOOLDIR +HOST_PATH +IN_NIX_SHELL +KUBEBUILDER_ASSETS +LD +LOCALBIN +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +OBJCOPY +OBJDUMP +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +dontAddDisableDepTrack +mesonFlags +nativeBuildInputs +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~XDG_DATA_DIRS ~name -~/neovim diff --git a/neovim/fnl/conf/diagnostic.fnl b/neovim/fnl/conf/diagnostic.fnl deleted file mode 100644 index 7ef1dd3..0000000 --- a/neovim/fnl/conf/diagnostic.fnl +++ /dev/null @@ -1,16 +0,0 @@ -(fn m [mode key cb] - (vim.keymap.set mode key cb {:silent true :noremap true})) - -(m :n :ge (fn [] - (vim.diagnostic.open_float))) - -(vim.diagnostic.config {:virtual_text false}) - -(vim.keymap.set :n :l (let [l (require :lsp_lines)] - l.toggle) - {:desc "Toggle lsp_lines"}) - -(vim.api.nvim_set_hl 0 :VirtualTextWarning {:link :Grey}) -(vim.api.nvim_set_hl 0 :VirtualTextError {:link :DiffDelete}) -(vim.api.nvim_set_hl 0 :VirtualTextInfo {:link :DiffChange}) -(vim.api.nvim_set_hl 0 :VirtualTextHint {:link :DiffAdd}) diff --git a/neovim/fnl/conf/events.fnl b/neovim/fnl/conf/events.fnl deleted file mode 100644 index 00d75d4..0000000 --- a/neovim/fnl/conf/events.fnl +++ /dev/null @@ -1,32 +0,0 @@ -(vim.api.nvim_create_augroup "conf#events" {:clear true}) -(local event vim.api.nvim_create_autocmd) - -(event [:BufReadPost] {:pattern ["*"] - :callback (fn [] - (local pattern "'\\s\\+$'") - (vim.cmd (.. "syn match TrailingWhitespace " - pattern)) - (vim.cmd "hi link TrailingWhitespace IncSearch")) - :group "conf#events"}) - -(local vimenter-cwd (vim.fn.getcwd)) -(event [:VimLeave] {:pattern ["*"] - :callback (fn [] - (vim.cmd (.. "mksession! " vimenter-cwd - :/.vimsession.vim))) - :group "conf#events"}) - -(event [:BufWinEnter :WinEnter] - {:pattern ["term://*"] - :callback (fn [] - (vim.cmd :startinsert)) - :group "conf#events"}) - -(event [:BufLeave] {:pattern ["term://*"] - :callback (fn [] - (vim.cmd :stopinsert)) - :group "conf#events"}) - -(event [:FileType] {:pattern [:dirvish] - :callback #(vim.cmd "silent! unmap ") - :group "conf#events"}) diff --git a/neovim/fnl/conf/filetype.fnl b/neovim/fnl/conf/filetype.fnl deleted file mode 100644 index 29f64b0..0000000 --- a/neovim/fnl/conf/filetype.fnl +++ /dev/null @@ -1,44 +0,0 @@ -(fn playbook? [filename] - (P filename) - (local pattern (vim.regex :^playbook.*)) - (pattern:match_str filename)) - -(fn group-vars? [relative-dir] - (local pattern (vim.regex :group_vars$)) - (pattern:match_str relative-dir)) - -(fn roles? [relative-dir] - (local pattern (vim.regex :roles$)) - (pattern:match_str relative-dir)) - -(fn task? [relative-file] - (local pattern (vim.regex :.*tasks.*)) - (pattern:match_str relative-file)) - -(fn ansible-files? [items] - (local [item & rest] items) - (if (not item) :yaml - (task? item) :yaml.ansible - (roles? item) :yaml.ansible - (group-vars? item) :yaml.ansible - (ansible-files? rest))) - -(fn yaml-filetype [path buf] - (local [repo?] - (vim.fs.find :.git - {:upward true - :path (vim.fs.dirname path) - :stop (vim.fs.dirname (vim.loop.cwd))})) - (local files (or (not repo?) (icollect [path file-or-dir (vim.fs.dir (vim.fs.dirname repo?) - {:skip #(not= "." - ($1:sub 1 - 1)) - :depth 2})] - (do - path)))) - (if (and repo? (playbook? (vim.fn.fnamemodify path ":t"))) :yaml.ansible - (and repo? (task? (vim.fn.fnamemodify path ":."))) :yaml.ansible - repo? (ansible-files? files) - :yaml)) - -(vim.filetype.add {:extension {:yml yaml-filetype :yaml yaml-filetype}}) diff --git a/neovim/fnl/conf/init.fnl b/neovim/fnl/conf/init.fnl deleted file mode 100644 index 90bc20c..0000000 --- a/neovim/fnl/conf/init.fnl +++ /dev/null @@ -1,172 +0,0 @@ -(vim.cmd "colorscheme kanagawa-wave") -(vim.cmd "filetype plugin on") -(vim.cmd "filetype indent on") -(vim.cmd "highlight WinSeparator guibg=None") -(vim.cmd "packadd cfilter") - -(require :conf.settings) -;; (require :conf.pkgs) -;; (require :conf.lsp) -;; (require :conf.events) -;; (require :conf.filetype) -;; (require :conf.newtab) -;; (require :conf.nix-develop) - -;; (require :conf.diagnostic) - -;; TODO: make a function that sets this autocommand: au BufWritePost currentfile :!curl -X POST -d "{\"previewRun\": true, \"yamlOverride\": \"$(cat % | yq -P)\", \"resources\": {\"repositories\": {\"self\": {\"refName\": \"refs/heads/branch\"}}}}" -s -H "Content-Type: application/json" -H "Authorization: Basic $WORK_AZDO_GIT_AUTH" "$WORK_AZDO_GIT_ORG_URL/Stater/_apis/pipelines/pipelineid/preview?api-version=7.1-preview.1" | jq -r '.finalYaml // .' > scratch.yaml - -(let [map vim.keymap.set] - (map :t : "") - ;; pausing and continueing printing output is not necessary inside neovim terminal right? - (map :t : ":q") - (map :n :qo ":copen") - (map :n :qc ":cclose") - (map :n :lo ":lopen") - (map :n :lc ":lclose") - (map :n "[q" ":cprevious") - (map :n "]q" ":cnext") - (map :n "[x" ":lprevious") - (map :n "]x" ":lnext") - (map :n : ":Telescope find_files" {:noremap true}) - (map :n "`" ":FocusDispatch ") - (map :n "`k" ":K9s ") - (map :n "`s" ":Ssh ") - (map :n :p ":NewTab") - (map :n :cf ":tabedit ~/flake|tc ~/flake|Go") - (map :n :cn ":tabedit ~/neovim|tc ~/neovim|Go")) - -(tset _G :P (lambda [...] - (let [inspected (icollect [_ v (ipairs [...])] - (vim.inspect v))] - (each [_ printer (ipairs inspected)] - (print printer))))) - -(local git-worktree (require :git-worktree)) -(git-worktree.setup {:change_directory_command :tcd - :update_on_change true - :autopush true}) - -(fn append [tbl item] - (table.insert tbl item) - tbl) - -(fn by-newline [lines] - (fn iter [items by result] - (local [item & rest] items) - (if (= item nil) result - (= "" item) (iter rest [] (append result by)) - (iter rest (append by item) result))) - - (ipairs (iter lines [] []))) - -(vim.keymap.set [:n] :w - (fn [] - (vim.fn.feedkeys ":Worktree switch ") - (local cmp (require :cmp)) - (vim.schedule (fn [] - (cmp.close) - (cmp.complete))))) - -(vim.keymap.set [:n] :W ":Worktree ") -(fn list-worktrees [] - (local pworktree (io.popen "git worktree list --porcelain")) - (icollect [_ worktree (by-newline (icollect [line (pworktree:lines)] - line))] - (match (icollect [_ line (ipairs worktree)] - (vim.split line " ")) - [[:worktree path] [:HEAD commit] [:branch branch]] (branch:gsub :refs/heads/ - "")))) - -(fn list-branches [] - (local pbranch (io.popen "git branch --list -r --format \"%(refname)\"")) - (icollect [_ ref (ipairs (icollect [line (pbranch:lines)] - (line:gsub :refs/remotes/.+/ "")))] - (if (not (= ref :HEAD)) - ref))) - -(vim.api.nvim_create_user_command :Worktree - (fn [ctx] - (match ctx.fargs - [:create tree branch upstream] (git-worktree.create_worktree tree - branch - upstream) - [:create tree upstream] (git-worktree.create_worktree tree - tree - upstream) - [:create tree] (git-worktree.create_worktree tree - tree - :origin) - [:switch tree] (git-worktree.switch_worktree tree) - [:delete tree] (git-worktree.delete_worktree tree) - _ (vim.notify "not recognized"))) - {:nargs "*" - :complete (fn [lead cmdline cursor] - (local cmdline-tokens - (vim.split cmdline " ")) - (match cmdline-tokens - [:Worktree :create & rest] (list-branches) - [:Worktree :switch & rest] (list-worktrees) - [:Worktree :delete & rest] (list-worktrees) - [:Worktree & rest] [:create - :switch - :delete]))}) - -(vim.api.nvim_create_user_command :HomeManager - (fn [ctx] - (vim.cmd (.. ":Dispatch home-manager switch --impure " - (os.getenv :HOME) "/flake#" - (. ctx.fargs 1)))) - {:nargs 1}) - -(vim.api.nvim_create_user_command :Gpush - (fn [ctx] - (vim.cmd ":Dispatch git push")) - {}) - -(vim.api.nvim_create_user_command :Grunt - (fn [ctx] - (match (. ctx.fargs 1) - :plan (vim.cmd (.. ":Dispatch " - (if ctx.bang - "TF_LOG=DEBUG " - "") - "terragrunt " - (table.concat ctx.fargs - " ") - " " :-out=gruntplan)) - :apply (vim.cmd (.. ":Dispatch " - (if ctx.bang - "TF_LOG=DEBUG " - "") - "terragrunt " - (table.concat ctx.fargs - " ") - " " :gruntplan)) - _ (vim.cmd (.. ":Start " - (if ctx.bang - "TF_LOG=DEBUG " - "") - "terragrunt " - (table.concat ctx.fargs - " "))))) - {:nargs "*" :bang true}) - -(vim.api.nvim_create_user_command :K9s - (fn [ctx] - (vim.cmd (.. ":Start k9s --context " - (. ctx.fargs 1)))) - {:nargs 1}) - -(vim.api.nvim_create_user_command :Ssh - (fn [ctx] - (vim.cmd (.. ":Start ssh " (. ctx.fargs 1)))) - {:nargs 1 - :complete (fn [lead cmdline cursor] - (local p - (io.popen :get-sshables)) - (local lines - (icollect [line (p:lines)] - line)) - (p:close) - lines)}) diff --git a/neovim/fnl/conf/lsp.fnl b/neovim/fnl/conf/lsp.fnl deleted file mode 100644 index 35fa34f..0000000 --- a/neovim/fnl/conf/lsp.fnl +++ /dev/null @@ -1,75 +0,0 @@ -(fn map-to-capabilities [{: client : buf} format] - (fn bo [name value] - (vim.api.nvim_buf_set_option buf name value)) - - (fn bm [mode key cb] - (vim.keymap.set mode key cb {:silent true :noremap true :buffer buf})) - - (fn lspdo [action] - (. vim.lsp.buf action)) - - (fn use [cpb] - (match cpb - :completionProvider (bo :omnifunc "v:lua.vim.lsp.omnifunc") - :renameProvider (bm :n :gr (lspdo :rename)) - :signatureHelpProvider (bm :n :gs (lspdo :signature_help)) - :definitionProvider (bm :n :gd (lspdo :definition)) - :declaration (bm :n :gD (lspdo :declaration)) - :implementationProvider (bm :n :gi (lspdo :implementation)) - :referencesProvider (bm :n :gg (lspdo :references)) - :documentSymbolProvider (bm :n :gds (lspdo :workspace_symbol)) - :codeActionProvider (bm :n :ga (lspdo :code_action)) - :codeLensProvider (bm :n :gl - (lambda [] - (vim.lsp.codelens.run))) - :hoverProvider (bo :keywordprg ":LspHover") - :documentFormattingProvider (if format - ((fn [] - (bo :formatexpr - "v:lua.vim.lsp.format()") - (bm :n :gq - #(vim.lsp.buf.format {:async true}))))))) - - (each [cpb enabled? (pairs client.server_capabilities)] - (if enabled? - (use cpb))) - {: client : buf}) - -(fn register-handlers [{: client : buf}] - (tset (. client :handlers) :textDocument/publishDiagnostics - (vim.lsp.with (fn [_ result ctx config] - (vim.lsp.diagnostic.on_publish_diagnostics _ result ctx - config) - (vim.diagnostic.setloclist {:open false})) - {:virtual_text true - :underline true - :update_in_insert false - :severity_sort true})) - {: client : buf}) - -(var format-on-save true) -(fn toggle-format-on-save [] - (set format-on-save (not format-on-save))) - -(vim.api.nvim_create_user_command :LspToggleOnSave toggle-format-on-save - {:nargs 1 :complete (fn [] [:format])}) - -(fn events [{: client : buf}] - (match client.server_capabilities - {:documentFormattingProvider true} - (let [format-events-group (vim.api.nvim_create_augroup :format-events - {:clear true})] - (vim.api.nvim_create_autocmd [:BufWritePre] - {:group format-events-group - :callback (lambda [] - (if format-on-save - (vim.lsp.buf.format))) - :buffer buf})))) - -(fn attach [client buf format] - (-> {: client : buf} - (register-handlers) - (map-to-capabilities format) - (events))) - -{: attach} diff --git a/neovim/fnl/conf/macros.fnl b/neovim/fnl/conf/macros.fnl deleted file mode 100644 index 9ce8b26..0000000 --- a/neovim/fnl/conf/macros.fnl +++ /dev/null @@ -1,45 +0,0 @@ -(fn by-two [l] - (fn iter [t i] - (let [k (. l (- i 1)) - v (. l i)] - (when (and (not= k nil) (not= v nil)) - (values (+ i 2) [k v])))) - - (values iter l 2)) - -(fn decode-opt-value [v] - (fn symbol-luatype [s] - (let [t (tostring s)] - (match t - :on true - :off false - _ t))) - - (if (sym? v) (symbol-luatype v) v)) - -(fn opt-template [o] - (fn remove/append [target value mode] - `(let [target# (. vim :opt ,target) - value# ,value] - ,(match mode - :append `(target#:append value#) - :remove `(target#:remove value#)))) - - (fn [v] - (match (string.sub o 1 1) - "-" (remove/append (string.sub o 2) v :remove) - "+" (remove/append (string.sub o 2) v :append) - _ `(tset (. vim :opt) ,o ,v)))) - -(fn settings [...] - `,(icollect [_ [o v] (by-two [...])] - ((opt-template (tostring o)) (decode-opt-value v)))) - -(fn globals [...] - (local globa (icollect [_ [k v] (by-two [...])] - [(tostring k) v])) - `(let [l# ,globa] - (each [a# b# (ipairs l#)] - (tset (. vim :g) (. b# 1) (. b# 2))))) - -{: settings : globals} diff --git a/neovim/fnl/conf/newtab/init.fnl b/neovim/fnl/conf/newtab/init.fnl deleted file mode 100644 index fbf8e18..0000000 --- a/neovim/fnl/conf/newtab/init.fnl +++ /dev/null @@ -1,36 +0,0 @@ -(local pickers (require :telescope.pickers)) -(local finders (require :telescope.finders)) -(local conf (. (require :telescope.config) :values)) -(local themes (require :telescope.themes)) -(local actions (require :telescope.actions)) -(local action_state (require :telescope.actions.state)) - -(fn colors [opts] - (local opts (if opts opts {})) - (local finder - (pickers.new opts - {:prompt_title :colors - :finder (finders.new_oneshot_job [:fd - :-d1 - "." - (os.getenv :HOME) - (.. (os.getenv :HOME) - :/projects)] - {}) - :attach_mappings (fn [prompt_buf map] - (actions.select_default:replace (fn [] - (actions.close prompt_buf) - (local selection - (action_state.get_selected_entry)) - (vim.cmd (.. :tabnew - (. selection - 1))) - (vim.cmd (.. :tc - (. selection - 1)))))) - :sorter (conf.generic_sorter opts)})) - (finder:find)) - -(vim.api.nvim_create_user_command :NewTab (fn [] (colors (themes.get_ivy))) {}) - -(vim.api.nvim_create_user_command :Colors colors {}) diff --git a/neovim/fnl/conf/nix-develop/init.fnl b/neovim/fnl/conf/nix-develop/init.fnl deleted file mode 100644 index 0983e06..0000000 --- a/neovim/fnl/conf/nix-develop/init.fnl +++ /dev/null @@ -1,122 +0,0 @@ -(local loop vim.loop) - -(var original-env {}) -(local ignored-variables {:SHELL true - :BASHOPTS true - :HOME true - :NIX_BUILD_TOP true - :NIX_ENFORCE_PURITY true - :NIX_LOG_FD true - :NIX_REMOTE true - :PPID true - :SHELL true - :SHELLOPTS true - :SSL_CERT_FILE true - :TEMP true - :TEMPDIR true - :TERM true - :TMP true - :TMPDIR true - :TZ true - :UID true}) - -(local separated-dirs {:PATH ":" :XDG_DATA_DIRS ":"}) - -(fn set-env [key value] - (if (not (. original-env key)) - (tset original-env key (or (. vim.env key) :nix-develop-nil))) - (local sep (. separated-dirs key)) - (if sep - (do - (local suffix (or (. vim.env key) "")) - (tset vim.env key (.. value sep suffix))) - (tset vim.env key value))) - -(fn unload-env [] - (each [k v (pairs original-env)] - (if (= v :nix-develop-nil) - (tset vim.env k nil) - (tset vim.env k v)))) - -(fn ignored? [key] - (. ignored-variables (string.upper key))) - -(fn exported? [Type] - (= Type :exported)) - -(fn handle-shellhook [shellhook] ; (P :handle-shellhook shellhook) - (var shellhook-env "") - (local stdin (loop.new_pipe)) - (local stdout (loop.new_pipe)) - (local p - (loop.spawn :bash {:stdio [stdin stdout nil]} - (fn [code signal] - (vim.schedule #(vim.notify (.. "shellhook: exit code " - code " " signal)))))) - (loop.read_start stdout - (fn [err data] - (assert (not err) err) - (if data - (set shellhook-env (.. shellhook-env data)) - (do - (if (not= shellhook-env "") - (vim.schedule (fn [] - (local json - (vim.fn.json_decode shellhook-env)) - ; (P json) - (each [key value (pairs json)] - (set-env key value))))))))) - (stdin:write (.. shellhook "jq -n 'env'\n\n")) - (stdin:close)) - -(fn handle-nix-print-dev-env [str] - (vim.schedule (fn [] - (local json (. (vim.fn.json_decode str) :variables)) - (-> (icollect [key {: type : value} (pairs json)] - (do - (if (and (exported? type) (not (ignored? key))) - (set-env key value)) - (if (= key :shellHook) - value))) - (#(each [_ shellhook (ipairs $1)] - (handle-shellhook shellhook))))))) - -(fn nix-develop [fargs unload] - (if unload - (unload-env)) - (local cmd :nix) - (local fargs (or fargs [])) - (local args [:print-dev-env :--json (unpack fargs)]) - (local stdout (loop.new_pipe)) - (local stdio [nil stdout nil]) - (var nix-print-dev-env "") - (local p - (loop.spawn cmd {: args : stdio} - (fn [code signal] - (if (not= code 0) - (vim.schedule #(vim.notify (.. "nix-develop: exit code " - code " " signal))))))) - (loop.read_start stdout - (fn [err data] - (assert (not err) err) - (if data - (set nix-print-dev-env (.. nix-print-dev-env data)) - (do - (vim.schedule #(vim.notify "nix-develop: stdout end")) - (if (not= nix-print-dev-env "") - (handle-nix-print-dev-env nix-print-dev-env))))))) - -(vim.api.nvim_create_user_command :NixDevelop - (fn [ctx] - (nix-develop ctx.fargs true)) - {:nargs "*"}) - -(vim.api.nvim_create_augroup :nix-develop {:clear true}) -(vim.api.nvim_create_autocmd [:DirChanged :VimEnter] - {:pattern ["*"] - :callback (fn [ctx] - (unload-env) - (if (= 1 - (vim.fn.filereadable (.. ctx.file - :/flake.nix))) - (nix-develop false)))}) diff --git a/neovim/fnl/conf/pkgs.fnl b/neovim/fnl/conf/pkgs.fnl deleted file mode 100644 index 1445454..0000000 --- a/neovim/fnl/conf/pkgs.fnl +++ /dev/null @@ -1,15 +0,0 @@ -;; (require :conf.pkgs.cmp) - -;; (require :conf.pkgs.null-ls) -;; (require :conf.pkgs.lspconfig) -;; (require :conf.pkgs.treesitter) -;; (require :conf.pkgs.tree-sitter-context) -;; (require :conf.pkgs.conjure) -;; (require :conf.pkgs.test) -;; (require :conf.pkgs.lsp_lines) -;; (require :conf.pkgs.noice) -;; (require :conf.pkgs.dap) -;; (require :conf.pkgs.heirline) -;; (require :conf.pkgs.gitsigns) -;; (require :conf.pkgs.harpoon) -;; (require :conf.pkgs.venn) diff --git a/neovim/fnl/conf/pkgs/cmp.fnl b/neovim/fnl/conf/pkgs/cmp.fnl deleted file mode 100644 index 76319f4..0000000 --- a/neovim/fnl/conf/pkgs/cmp.fnl +++ /dev/null @@ -1,114 +0,0 @@ -(local cmp (require :cmp)) -(local compare (require :cmp.config.compare)) -(local always-first [:write :edit :split :quit :cfirst]) - -(fn string-startswith? [str start] - (= start (string.sub str 1 (string.len start)))) - -(fn string-startswith-anyof? [str start-list] - (fn iter [[item & rest]] - (if (not item) false - (string-startswith? str item) true - (iter rest))) - - (iter start-list)) - -(fn string-startswith-upper? [str] - (local first-char (string.sub str 1 1)) - (= first-char (string.upper first-char))) - -(fn has-words-before? [] - (local [line col] (vim.api.nvim_win_get_cursor 0)) - (local [word & rest] (vim.api.nvim_buf_get_lines 0 (- line 1) line true)) - (local before (word:sub col col)) - (local is_string (before:match "%s")) - (and (not= col 0) (= is_string nil))) - -(fn enum [types key] - (. (. cmp types) key)) - -(fn cmp-setup [cmp autocomplete] - (let [luasnip (require :luasnip) - snip (fn [args] - (luasnip.lsp_expand (. args :body)))] - (local cfg - {:experimental {:ghost_text true} - :snippet {:expand snip} - :preselect cmp.PreselectMode.None - :mapping {: (cmp.mapping (fn [fallback] - (if (cmp.visible) - (cmp.select_next_item) - (luasnip.expand_or_jumpable) - (luasnip.expand_or_jump) - (has-words-before?) - (cmp.complete) - (fallback)) - [:i :s])) - : (cmp.mapping (fn [fallback] - (if (cmp.visible) - (cmp.select_prev_item) - (luasnip.jumpable -1) - (luasnip.jump -1) - (fallback)) - [:i :s])) - : (cmp.mapping.scroll_docs -4) - : (cmp.mapping.scroll_docs 4) - : (cmp.mapping.complete) - : (cmp.mapping.confirm {:behavior (enum :ConfirmBehavior - :Replace) - :select true})} - :sources (cmp.config.sources [{:name :nvim_lsp} - {:name :path} - {:name :luasnip}])}) - (if (not autocomplete) (tset cfg :completion {:autocomplete false})) - ;; (print (vim.inspect cfg)) - (cmp.setup cfg) - (cmp.setup.cmdline ["/" "?"] - {:sources (cmp.config.sources [{:name :buffer}]) - :experimental {:ghost_text true} - :mapping (cmp.mapping.preset.cmdline)}) - (cmp.setup.cmdline ":" - {:matching {:disallow_partial_fuzzy_matching true - :disallow_prefix_unmatching true} - :sources (cmp.config.sources [{:name :path}] - [{:name :cmdline - :keyword_length 1}]) - :preselect cmp.PreselectMode.Item - :sorting {:priority_weight 2 - :comparators [(fn [e1 e2] - (fn iter [[item & rest]] - (if (or (not rest) - (not item)) - false - (= e1.completion_item.label - item) - true - (iter rest))) - - (iter always-first)) - compare.offset - compare.exact - compare.score - compare.locality - compare.kind - compare.length - compare.order]} - :mapping (cmp.mapping.preset.cmdline {: {:c (fn [fallback] - (if (not (cmp.confirm {:behavior (enum :ConfirmBehavior - :Replace) - :select true})) - (fallback) - (vim.schedule fallback)))}})}))) - -; {:name :cmdline_history -; :keyword_pattern "^[ABCDEFHIJKLMNOPQRSTUVWXYZ].*" -; :entry_filter (fn [entry -; ctx] -; (if (string-startswith-upper entry.completion_item.label) -; true -; false)) -; :max_item_count 1)}))) -; disallow_fuzzy_matching = false, -; disallow_partial_matching = false, -; disallow_prefix_unmatching = false,))) -(cmp-setup cmp true) diff --git a/neovim/fnl/conf/pkgs/conjure.fnl b/neovim/fnl/conf/pkgs/conjure.fnl deleted file mode 100644 index c07a6f4..0000000 --- a/neovim/fnl/conf/pkgs/conjure.fnl +++ /dev/null @@ -1,17 +0,0 @@ -(tset vim.g "conjure#log#wrap" true) - -(tset vim.g "conjure#client#python#stdio#command" "python -iq") - -(vim.api.nvim_create_user_command :ConjurePythonCommand - (fn [opts] - (tset vim.g - "conjure#client#python#stdio#command" - opts.args)) - {:nargs 1}) - -(let [group (vim.api.nvim_create_augroup "conf#pkgs#conjure" {:clear true})] - (vim.api.nvim_create_autocmd [:BufEnter] - {: group - :callback (fn [opts] - (vim.diagnostic.disable opts.buf)) - :pattern [:conjure-log*]})) diff --git a/neovim/fnl/conf/pkgs/dap.fnl b/neovim/fnl/conf/pkgs/dap.fnl deleted file mode 100644 index 6476d3e..0000000 --- a/neovim/fnl/conf/pkgs/dap.fnl +++ /dev/null @@ -1,78 +0,0 @@ -(local dap (require :dap)) -(local adapters (. dap :adapters)) -(local configurations (. dap :configurations)) - -(local dapui (require :dapui)) - -(tset adapters :delve - {:type :server - :port "${port}" - :executable {:command :dlv :args [:dap :-l "127.0.0.1:${port}"]}}) - -(tset configurations :go - [{:type :delve - :name :Debug - :request :launch - :env {:CGO_CFLAGS :-Wno-error=cpp} - :program "${file}"} - {:type :delve - :name :DebugTest - :request :launch - :mode :test - :env {:CGO_CFLAGS :-Wno-error=cpp} - :program "${file}"} - {:type :delve - :name :DebugTerraform - :request :launch - :program "${file}" - :env {:CGO_CFLAGS :-Wno-error=cpp} - :args [:-debug]} - {:type :delve - :name :DebugTerraformAcc - :request :launch - :program "${file}" - :mode :test - :env {:CGO_CFLAGS :-Wno-error=cpp :TF_ACC :1}} - {:type :delve - :name :DebugTestSuite - :request :launch - :mode :test - :env {:CGO_CFLAGS :-Wno-error=cpp} - :program "${fileDirname}"}]) - -(dapui.setup {:expand_lines false}) - -(vim.keymap.set :n :si (lambda [] - (dapui.toggle {:reset true})) {:silent true}) -;; "breakpoints", -;; "repl", -;; "scopes", -;; "stacks", -;; "watches", -;; "hover", -;; "console",) -(vim.keymap.set :n :sfw - (lambda [] - (dapui.float_element :watches - {:width (vim.api.nvim_win_get_width 0) :height 30 :enter true}))) -(vim.keymap.set :n :sfs - (lambda [] - (dapui.float_element :scopes - {:width (vim.api.nvim_win_get_width 0) :height 30 :enter true}))) - -(vim.keymap.set :n :sq dap.terminate {:silent true}) -(vim.keymap.set :n :sc dap.continue {:silent true}) -(vim.keymap.set :n :sr dap.run_to_cursor {:silent true}) -(vim.keymap.set :n :sn dap.step_over {:silent true}) -(vim.keymap.set :n :ss dap.step_into {:silent true}) -(vim.keymap.set :n :so dap.step_out {:silent true}) -(vim.keymap.set :n :sb dap.toggle_breakpoint {:silent true}) -(vim.keymap.set :n :sB dap.set_breakpoint {:silent true}) -(vim.keymap.set :n :slp - (fn [] - (dap.set_breakpoint nil nil - (vim.fn.input "Log point message: "))) - {:silent true}) - -(vim.keymap.set :n :st dap.repl.toggle {:silent true}) -(vim.keymap.set :n :sl dap.run_last {:silent true}) diff --git a/neovim/fnl/conf/pkgs/gitsigns.fnl b/neovim/fnl/conf/pkgs/gitsigns.fnl deleted file mode 100644 index 813d410..0000000 --- a/neovim/fnl/conf/pkgs/gitsigns.fnl +++ /dev/null @@ -1,2 +0,0 @@ -(local gitsigns (require :gitsigns)) -(gitsigns.setup) diff --git a/neovim/fnl/conf/pkgs/harpoon.fnl b/neovim/fnl/conf/pkgs/harpoon.fnl deleted file mode 100644 index 3f5fc48..0000000 --- a/neovim/fnl/conf/pkgs/harpoon.fnl +++ /dev/null @@ -1,39 +0,0 @@ -(local harpoon-mark (require :harpoon.mark)) -(local harpoon-ui (require :harpoon.ui)) -(fn make-harpoon [func] - (fn [] - (func) - (vim.cmd :redrawtabline))) - -(vim.keymap.set :n "[]" (make-harpoon (fn [] (harpoon-mark.add_file)))) -(vim.keymap.set :n "][" (make-harpoon (fn [] (harpoon-ui.toggle_quick_menu)))) -(vim.keymap.set :n "]]" (make-harpoon (fn [] (harpoon-ui.nav_next)))) -(vim.keymap.set :n "[[" (make-harpoon (fn [] (harpoon-ui.nav_prev)))) - -(var use-numbers false) -(local num [1 2 3 4 5]) -(local shortcuts ["+" "-" "<" ">" "\""]) -(fn print-use-numbers [] - (print (vim.inspect use-numbers))) - -(fn toggle-harpoon-mappings [] - (if (not use-numbers) - (do - ; (each [_ i (ipairs shortcuts)] ; (vim.keymap.del :n i)) - (vim.keymap.set :n "[+" (make-harpoon (fn [] (harpoon-ui.nav_file 1)))) - (vim.keymap.set :n "[-" (make-harpoon (fn [] (harpoon-ui.nav_file 2)))) - (vim.keymap.set :n "[<" (make-harpoon (fn [] (harpoon-ui.nav_file 3)))) - (vim.keymap.set :n "[>" (make-harpoon (fn [] (harpoon-ui.nav_file 4)))) - (vim.keymap.set :n "[\"" (make-harpoon (fn [] (harpoon-ui.nav_file 5)))) - (set use-numbers true)) - (do - ; (each [_ s (ipairs shortcuts)] ; (vim.keymap.del :n s) - (vim.keymap.set :n "[1" (make-harpoon (fn [] (harpoon-ui.nav_file 1)))) - (vim.keymap.set :n "[2" (make-harpoon (fn [] (harpoon-ui.nav_file 2)))) - (vim.keymap.set :n "[3" (make-harpoon (fn [] (harpoon-ui.nav_file 3)))) - (vim.keymap.set :n "[4" (make-harpoon (fn [] (harpoon-ui.nav_file 4)))) - (vim.keymap.set :n "[5" (make-harpoon (fn [] (harpoon-ui.nav_file 5)))) - (set use-numbers false)))) - -(vim.api.nvim_create_user_command :H toggle-harpoon-mappings {}) -(toggle-harpoon-mappings) diff --git a/neovim/fnl/conf/pkgs/heirline.fnl b/neovim/fnl/conf/pkgs/heirline.fnl deleted file mode 100644 index c8d9c52..0000000 --- a/neovim/fnl/conf/pkgs/heirline.fnl +++ /dev/null @@ -1,241 +0,0 @@ -(local heirline (require :heirline)) -(local conditions (require :heirline.conditions)) -(local utils (require :heirline.utils)) -(local colors (let [kanagawa-colors (require :kanagawa.colors)] - (kanagawa-colors.setup))) - -(local Align {:provider "%="}) -(local Space {:provider " "}) -(fn with [tbl with-kv] - (local w {}) - (each [k v (pairs tbl)] - (tset w k v)) - (each [k v (pairs with-kv)] - (tset w k v)) - w) - -(heirline.load_colors colors) -(fn palette [name] - (. colors :palette name)) - -(fn theme [theme name] - (. colors :theme theme name)) - -(var FileNameBlock - {;; let's first set up some attributes needed by this component and it's children - :init (lambda [self] - (tset self :filename (vim.api.nvim_buf_get_name 0)))}) - -(local FileName - {:provider (lambda [self] - ;; first, trim the pattern relative to the current directory. For other - ;;- options, see :h filename-modifers - (var filename (vim.fn.fnamemodify (. self :filename) ":.")) - (if (= filename "") - (set filename "[No Name]") - ;;- now, if the filename would occupy more than 1/4th of the available - ;;-- space, we trim the file path to its initials - ;;-- See Flexible Components section below for dynamic truncation - (if (not (conditions.width_percent_below (length filename) - 0.25)) - (set filename (vim.fn.pathshorten filename)))) - filename) - :hl {:fg (. (utils.get_highlight :Directory) :fg)}}) - -(local FileNameModifier {:hl (lambda [] - (when vim.bo.modified - {:fg (theme :diag :warning) - :bold true - :force true}))}) - -(local FileFlags [{:condition (lambda [] vim.bo.modified) - :provider "[+]" - :hl {:fg (theme :diag :warning)}}]) - -(set FileNameBlock (utils.insert FileNameBlock - (utils.insert FileNameModifier FileName) - FileFlags {:provider "%<"})) - -(local DAPMessages {:condition (lambda [] - (local dap (require :dap)) - (local session (dap.session)) - (not (= session nil))) - :provider (lambda [] - (local dap (require :dap)) - (.. "ο†ˆ " (dap.status))) - :hl :Debug}) - -(local Ruler {;; %l = current line number - ;; %L = number of lines in the buffer - ;; %c = column number - ;; %P = percentage through file of displayed window - :provider "%7(%l/%3L%):%2c %P"}) - -(local ScrollBar - {:static {:sbar ["▁" "β–‚" "β–ƒ" "β–„" "β–…" "β–†" "β–‡" "β–ˆ"]} - ;; Another variant, because the more choice the better. - ;; sbar { '🭢', '🭷', '🭸', '🭹', '🭺', '🭻'}} - :provider (lambda [self] - (local curr_line (. (vim.api.nvim_win_get_cursor 0) 1)) - (local lines (vim.api.nvim_buf_line_count 0)) - (local i - (- (length self.sbar) - (math.floor (* (/ (- curr_line 1) lines) - (length (. self :sbar)))))) - (string.rep (. self :sbar i) 2)) - :hl {:fg (theme :syn :fun) :bg (theme :ui :bg)}}) - -(local Nix - {:condition (fn [] vim.env.IN_NIX_SHELL) - :provider (fn [self] - (local purity vim.env.IN_NIX_SHELL) - (local name vim.env.name) - (.. "οŒ“" purity "(" name ")")) - :hl {:fg (theme :syn :fun) :bold true :bg (theme :ui :bg_m3)}}) - -(local RecordingMacro {:condition #(not= "" (vim.fn.reg_recording)) - :provider (fn [self] - (.. "Recording... " (vim.fn.reg_recording))) - :hl {:fg (theme :syn :fun) - :bold true - :bg (theme :ui :bg_m3)}}) - -(local harpoon (require :harpoon)) -(local harpoon-mark (require :harpoon.mark)) -(local harpoon-colors [(theme :syn :identifier) - (theme :syn :identifier) - (theme :syn :identifier)]) - -(fn mark-component [i mark] - (utils.insert {} {:hl {:bg (if (= mark.filename - (vim.fn.fnamemodify (vim.api.nvim_buf_get_name 0) - ":.")) - (theme :ui :bg_p1) - (theme :ui :bg_m1)) - :bold true - :fg (. harpoon-colors i)} - :provider (fn [self] - (.. " M" i " "))})) - -;{:hl {:fg (theme :syn :fun)} :provider (vim.fn.pathshorten mark.filename)})) -; {:hl {:bold true :fg (. harpoon-colors i)} :provider ")"} Space)) - -(local HarpoonMarks - (utils.insert {:hl :TabLineSel - :condition #(< 0 - (length (. (harpoon.get_mark_config) - :marks)))} - {:init (lambda [self] - (local mark-list - (. (harpoon.get_mark_config) :marks)) - (each [i mark (ipairs mark-list)] - (tset self i - (self:new (mark-component i mark) i))) - (while (> (length self) (length mark-list)) - (table.remove self (length self))))})) - -(local Tabpage - {:provider (lambda [self] - (fn fnamemod [name mod] - (vim.fn.fnamemodify name mod)) - - (fn format-name [name] - (if (= name "") "[No Name]" - (fnamemod name ":t"))) - - (.. "%" self.tabnr "T " self.tabnr " ")) - :hl (lambda [self] - (if (not self.is_active) :TabLine :TabLineSel))}) - -(fn active-tab-hrpn [self] - (local hl {}) - (if (. self :is_active) - (do - (tset hl :fg (theme :syn :identifier)) - (tset hl :bold true))) - hl) - -(fn active-hl [hl] - (lambda [self] - (if self.is_active - hl - {}))) - -(fn tab-visible-buffers [tab] - (local visible (vim.fn.tabpagebuflist tab)) - (if (= visible 0) - [] - visible)) - -(fn tab-harpoon-marks [tab] - (local visible (tab-visible-buffers tab)) - (local tab-buffers (accumulate [buffers [] _ buf (ipairs visible)] - (do - (if (not (vim.tbl_contains buffers buf)) - (table.insert buffers buf)) - buffers))) - (icollect [_ buf (ipairs tab-buffers)] - (do - (local status (harpoon-mark.status buf)) - (if (not= status "") - status)))) - -(local Tabpage - (utils.insert Tabpage {:hl active-tab-hrpn :provider "🌊 [ "} - {:hl (active-hl {:fg (theme :syn :fun)}) - :provider (lambda [self] - (local harpoon_marks - (tab-harpoon-marks self.tabnr)) - (table.concat harpoon_marks " "))} - {:hl active-tab-hrpn :provider " ] %T"})) - -(local TabpageClose {:provider "%999X ο™• %X" :hl :TabLine}) - -(local TabPages - {;; only show this component if there's 2 or more tabpages - :condition (lambda [] - (>= (length (vim.api.nvim_list_tabpages)) 1))}) - -(local TabPages (utils.insert TabPages (utils.make_tablist Tabpage) - TabpageClose)) - -(local dispatch-get-request (. vim.fn "dispatch#request")) -(local Dispatch (utils.insert {:init (fn [self] - (set self.req (dispatch-get-request))) - :condition (fn [] - (not (vim.tbl_isempty (dispatch-get-request))))} - {:provider "dispatch(" - :hl (fn [self] - {:fg (if (= 1 self.req.completed) - (theme :syn :fun) - (theme :diag :warning)) - :bold true})} - {:provider (fn [self] - self.req.command) - :hl {:fg (theme :syn :string) :bold false}} - {:provider ")" - :hl (fn [self] - {:fg (if (= 1 self.req.completed) - (theme :syn :fun) - (theme :diag :warning)) - :bold true})})) - -(local StatusLine [FileNameBlock - Space - HarpoonMarks - Space - TabPages - DAPMessages - Space - RecordingMacro - Dispatch - Align - Space - Nix - Space - Ruler - Space - ScrollBar - Space]) - -(heirline.setup {:statusline StatusLine}) diff --git a/neovim/fnl/conf/pkgs/lsp_lines.fnl b/neovim/fnl/conf/pkgs/lsp_lines.fnl deleted file mode 100644 index 7194bd9..0000000 --- a/neovim/fnl/conf/pkgs/lsp_lines.fnl +++ /dev/null @@ -1,2 +0,0 @@ -(let [l (require :lsp_lines)] - (l.setup)) diff --git a/neovim/fnl/conf/pkgs/lsp_signature.fnl b/neovim/fnl/conf/pkgs/lsp_signature.fnl deleted file mode 100644 index 7fecc9e..0000000 --- a/neovim/fnl/conf/pkgs/lsp_signature.fnl +++ /dev/null @@ -1,3 +0,0 @@ -(local lsp_signature (require :lsp_signature)) - -(lsp_signature.setup) diff --git a/neovim/fnl/conf/pkgs/lspconfig.fnl b/neovim/fnl/conf/pkgs/lspconfig.fnl deleted file mode 100644 index accd001..0000000 --- a/neovim/fnl/conf/pkgs/lspconfig.fnl +++ /dev/null @@ -1,51 +0,0 @@ -(local lspconfig (require :lspconfig)) -(local configs (require :lspconfig.configs)) -(local {: attach} (require :conf.lsp)) - -(lspconfig.pyright.setup {:root_dir (lspconfig.util.root_pattern :.git - (vim.fn.getcwd)) - :on_attach attach}) - -(lspconfig.tsserver.setup {:root_dir (lspconfig.util.root_pattern :.git - (vim.fn.getcwd)) - :on_attach attach}) - -(local pid (vim.fn.getpid)) -(lspconfig.omnisharp.setup {:cmd [:OmniSharp - :--languageserver - :--hostPID - (tostring pid)] - :handlers {[:textDocument/definition] (. (require :omnisharp_extended) - :handler)} - :root_dir (lspconfig.util.root_pattern :.git - (vim.fn.getcwd)) - :on_attach attach}) - -(lspconfig.gopls.setup {:root_dir (lspconfig.util.root_pattern :.git - (vim.fn.getcwd)) - :on_attach attach - :settings {:gopls {:codelenses {:test true :bench true} - ;; Show a code lens toggling the display of gc's choices.} - :buildFlags [:-tags=all]}}}) - -(lspconfig.ansiblels.setup {:ansible {:ansible {:path :ansible} - :executionEnvironment {:enabled false} - :python {:interpreterPath :python} - :validation {:enabled true - :lint {:enabled false - :arguments " --profile=production --write=all " - :path :ansible-lint}}}}) - -;; (tset configs :fennel_language_server -;; {:default_config {;; replace it with true path -;; :cmd [:fennel-language-server] -;; :filetypes [:fennel] -;; :single_file_support true -;; ;; source code resides in directory `fnl/` -;; :root_dir (lspconfig.util.root_pattern :fnl) -;; :settings {:fennel {:workspace {;; If you are using hotpot.nvim or aniseed, -;; ;; make the server aware of neovim runtime files. -;; :library (vim.api.nvim_list_runtime_paths)} -;; :diagnostics {:globals [:vim]}}}}}) -;; -;; (lspconfig.fennel_language_server.setup {:on_attach attach}) diff --git a/neovim/fnl/conf/pkgs/neotest.fnl b/neovim/fnl/conf/pkgs/neotest.fnl deleted file mode 100644 index 251cdcb..0000000 --- a/neovim/fnl/conf/pkgs/neotest.fnl +++ /dev/null @@ -1,4 +0,0 @@ -(let [nt (require :neotest) - python (require :neotest-python)] - (nt.setup {:adapters [(python {:dap {:justMyCode false}})]})) - diff --git a/neovim/fnl/conf/pkgs/noice.fnl b/neovim/fnl/conf/pkgs/noice.fnl deleted file mode 100644 index 58ac761..0000000 --- a/neovim/fnl/conf/pkgs/noice.fnl +++ /dev/null @@ -1,34 +0,0 @@ -(local noice (require :noice)) -(noice.setup {:views {:cmdline_popup {:border {:style :none :padding [1 3]} - :win_options {:winhighlight "NormalFloat:NormalFloat,FloatBorder:FloatBorder"}}} - :lsp {;; override markdown rendering so that **cmp** and other plugins use **Treesitter** - :override {[:vim.lsp.util.convert_input_to_markdown_lines] true - [:vim.lsp.util.stylize_markdown] true - [:cmp.entry.get_documentation] true}} - :popupmenu {:enabled false} - :messages {; NOTE: If you enable messages then the cmdline is enabled automatically. - ; This is a current Neovim limitation. - :enabled true - ; enables the Noice messages UI - :view :mini - ; default view for messages - :view_error :mini - ; view for errors - :view_warn :mini - ; view for warnings - :view_history :mini - ; view for :messages - :view_search :virtualtext} - ; view for search count messages. Set to `false` to disable} - ;; you can enable a preset for easier configuration - :presets {:bottom_search true - ; use a classic bottom cmdline for search - :command_palette true - ; position the cmdline and popupmenu together - :long_message_to_split true - ; long messages will be sent to a split - :inc_rename false - ; enables an input dialog for inc-rename.nvim - :lsp_doc_border false}}) - -; add a border to hover docs and signature help}}) diff --git a/neovim/fnl/conf/pkgs/null-ls.fnl b/neovim/fnl/conf/pkgs/null-ls.fnl deleted file mode 100644 index 9908823..0000000 --- a/neovim/fnl/conf/pkgs/null-ls.fnl +++ /dev/null @@ -1,21 +0,0 @@ -(local lsp-conf (require :conf.lsp)) -(local null-ls (require :null-ls)) - -(local fmt null-ls.builtins.formatting) -(local diag null-ls.builtins.diagnostics) - -(fn executable? [program] - (fn [] - (= 1 (vim.fn.executable program)))) - -(null-ls.setup {:update_in_insert false - :debug true - :on_attach (fn [client buf] - (lsp-conf.attach client buf true)) - :sources [fmt.alejandra - fmt.fnlfmt - (fmt.black.with {:condition (executable? :black)}) - (fmt.goimports.with {:condition (executable? :goimports)}) - (fmt.gofumpt.with {:condition (executable? :gofumpt)}) - (fmt.raco_fmt.with {:condition (executable? :raco)}) - (fmt.terraform_fmt.with {:condition (executable? :terraform)})]}) diff --git a/neovim/fnl/conf/pkgs/test.fnl b/neovim/fnl/conf/pkgs/test.fnl deleted file mode 100644 index 4f0bcc4..0000000 --- a/neovim/fnl/conf/pkgs/test.fnl +++ /dev/null @@ -1,9 +0,0 @@ -(tset vim.g "test#strategy" :neovim) -(tset vim.g "test#neovim#term_position" :botright) - -(vim.keymap.set :n :t ":TestNearest" {:silent true}) -(vim.keymap.set :n :C ":TestClass" {:silent true}) -(vim.keymap.set :n :T ":TestFile" {:silent true}) -(vim.keymap.set :n :a ":TestSuite" {:silent true}) -(vim.keymap.set :n :l ":TestLast" {:silent true}) -(vim.keymap.set :n :g ":TestVisit" {:silent true}) diff --git a/neovim/fnl/conf/pkgs/tree-sitter-context.fnl b/neovim/fnl/conf/pkgs/tree-sitter-context.fnl deleted file mode 100644 index 12fedc6..0000000 --- a/neovim/fnl/conf/pkgs/tree-sitter-context.fnl +++ /dev/null @@ -1,2 +0,0 @@ -(local context (require :treesitter-context)) -(context.setup {:enable true}) diff --git a/neovim/fnl/conf/pkgs/treesitter.fnl b/neovim/fnl/conf/pkgs/treesitter.fnl deleted file mode 100644 index c613be0..0000000 --- a/neovim/fnl/conf/pkgs/treesitter.fnl +++ /dev/null @@ -1,2 +0,0 @@ -(let [ts (require :nvim-treesitter.configs)] - (ts.setup {:highlight {:enable true}})) diff --git a/neovim/fnl/conf/pkgs/venn.fnl b/neovim/fnl/conf/pkgs/venn.fnl deleted file mode 100644 index 064e84e..0000000 --- a/neovim/fnl/conf/pkgs/venn.fnl +++ /dev/null @@ -1,18 +0,0 @@ -;; venn.nvim: enable or disable keymappings -(fn toggle-venn [] - (if (not vim.b.venn_enabled) - (do - (set vim.b.venn_enabled true) - (vim.cmd "setlocal ve=all") ; draw a line on HJKL keystokes - (vim.keymap.set [:n] :J "j:VBox" {:noremap true :buffer 0}) - (vim.keymap.set [:n] :K "k:VBox" {:noremap true :buffer 0}) - (vim.keymap.set [:n] :L "l:VBox" {:noremap true :buffer 0}) - (vim.keymap.set [:n] :H "h:VBox" {:noremap true :buffer 0}) ; draw a box by pres]sing "f" with visual selection) - (vim.keymap.set [:v] :f ":VBox" {:noremap true :buffer 0})) - (do - (vim.cmd "setlocal ve=") - (vim.cmd "mapclear ") - (set vim.b.venn_enabled nil)))) - -; toggle keymappings for venn using v) -(vim.keymap.set [:n] :v toggle-venn {:noremap true}) diff --git a/neovim/fnl/conf/settings.fnl b/neovim/fnl/conf/settings.fnl deleted file mode 100644 index ec68e6c..0000000 --- a/neovim/fnl/conf/settings.fnl +++ /dev/null @@ -1,69 +0,0 @@ -(import-macros {: settings : globals} :conf.macros) - -(globals - codeium_enabled false - loaded_2html_plugin true - loaded_fzf false - loaded_man false - loaded_gzip false - loaded_health false - loaded_matchit false - loaded_matchparen false - loaded_netrwPlugin false - loaded_rplugin false - loaded_shada false - loaded_spellfile false - loaded_tarPlugin false - loaded_tohtml false - loaded_tutor false - loaded_zipPlugin false - - mapleader " " - maplocalleader " " - dirvish_mode ":sort | sort ,^.*[^/]$, r") - -(settings - +shortmess "c" - +diffopt vertical - +isfname "@-@" - wmw 10 - inccommand split - signcolumn yes - smd off - scrolloff 8 - termguicolors on - incsearch on - undofile on - undodir (.. (os.getenv :HOME) :/.local/share/nvim/undo) - backup off - backupcopy yes - swapfile off - wrap off - splitbelow on - magic on - showbreak "+++" - listchars {:eol "󰁂"} - list on - autoread on - autoindent on - smartindent on - expandtab on - tabstop 4 - softtabstop 4 - shiftwidth 4 - hidden on - number on - relativenumber on - exrc on - secure on - completeopt "menuone,noselect" - wildmode "lastused" - complete ".,w,k,kspell,b" - foldopen "block,hor,jump,mark,percent,quickfix,search,tag" - laststatus 3 - ; winbar "%=%m %f" - winbar "" - hlsearch off - clipboard "" - showtabline 0 - cmdheight 0) diff --git a/neovim/fnl/conf/wict-nvim/builder.fnl b/neovim/fnl/conf/wict-nvim/builder.fnl deleted file mode 100644 index 177b773..0000000 --- a/neovim/fnl/conf/wict-nvim/builder.fnl +++ /dev/null @@ -1,99 +0,0 @@ -(tset package.loaded :conf.wict-nvim.frames.frame nil) -(local vec (require :conf.wict-nvim.frames.vec)) -(local frame (require :conf.wict-nvim.frames.frame)) -(local m {}) - -;; Creates a new painter that wraps the paint and close methods of a painter -(local transform-painter (fn [painter ori width height] - (fn [frm] - (local coord (frame.frame->coord frm)) - (local new-ori (coord ori)) - (local new-frame - (frame new-ori - (vec.sub (coord width) new-ori) - (vec.sub (coord height) new-ori))) - (painter new-frame)))) - -(local pad (fn [painter pad-size] - (fn [frm] - (local pad-width (/ pad-size (frame.width frm))) - (local pad-height (/ pad-size (frame.height frm))) - (local transformed - (transform-painter painter (vec.vec pad-width pad-height) - (vec.vec (- 1 pad-width) pad-height) - (vec.vec pad-width (- 1 pad-height)))) - (transformed frm)))) - -(local beside (fn [p1 p2 size] - (local size (or size 0.5)) - (local left - (transform-painter p1 (vec.vec 0 0) (vec.vec size 0) - (vec.vec 0 1))) - (local right - (transform-painter p2 (vec.vec size 0) (vec.vec 1 0) - (vec.vec size 1))) - (fn [frm] - (left frm) - (right frm)))) - -(local builder {}) - -(fn builder.Padding [self size] - (table.insert self.partial-painters {:op :pad : size}) - self) - -(fn builder.Beside [self partial-builder size] - (table.insert self.partial-painters {:op :beside : partial-builder : size}) - self) - -(fn builder.LeftOf [self partial-builder size] - (table.insert self.partial-painters {:op :left : partial-builder : size}) - self) - -(fn builder.RightOf [self partial-builder size] - (table.insert self.partial-painters {:op :right : partial-builder : size}) - self) - -(fn builder.build-painter [self effects] - (accumulate [painter (fn [frame] (print :leaf-painter)) _ partial-painter (ipairs self.partial-painters)] - (do - (match partial-painter - {:op :pad : size} (do - (pad painter size)) - {:op :left : partial-builder} (do - (beside painter - (partial-builder:build-painter effects) - partial-painter.size)) - {:op :right : partial-builder} (do - (beside (partial-builder:build-painter effects) - painter partial-painter.size)) - {:op :beside : partial-builder} (do - (beside painter - (partial-builder:build-painter effects) - partial-painter.size)) - {: maps : buffer} (do - (local window (effects:new-window maps)) - (local painter-ptr painter) - (fn [frm] - (local frame-opts - (frame.frame->open-win-options frm)) - (local buf (buffer)) - (if (not (window:open?)) - (window:open buf frame-opts) - (window:repaint buf frame-opts)) - (painter-ptr frm))) - _ painter)))) - -(fn builder.Build [self effects] - (local painter (self:build-painter effects)) - (fn [frm] - (effects:attach) - (painter frm))) - -(fn builder.For [partial-painter] - (local bldr {:partial-painters [partial-painter]}) - (setmetatable bldr builder) - (set builder.__index builder) - bldr) - -builder diff --git a/neovim/fnl/conf/wict-nvim/effects.fnl b/neovim/fnl/conf/wict-nvim/effects.fnl deleted file mode 100644 index e4321da..0000000 --- a/neovim/fnl/conf/wict-nvim/effects.fnl +++ /dev/null @@ -1,81 +0,0 @@ -(local m {}) -(local window {}) - -(local aug vim.api.nvim_create_augroup) -(local del-aug (fn [] (vim.api.nvim_create_augroup :EffectsMgr {:clear true}))) -(local au vim.api.nvim_create_autocmd) -(local winvar (fn [...] (pcall vim.api.nvim_win_get_var ...))) -(local unmap (fn [{: mode : lhs : opts}] (pcall vim.keymap.del mode lhs opts))) -(local map (fn [mode lhs rhs opts] (vim.keymap.set mode lhs rhs opts))) - -(fn window.close [self] - (if (self:open?) - (set self.handle (vim.api.nvim_win_close self.handle true)))) - -(fn window.open [self buf frame] - (set frame.style :minimal) - (set self.handle (vim.api.nvim_open_win buf false frame)) - (P self.handle :before-setvar) - (vim.api.nvim_buf_set_var buf :effect-window self) - (vim.api.nvim_win_set_var self.handle :effect-window self) - (if self.enter - (vim.api.nvim_set_current_win self.handle))) - -(fn window.id [self] - self.handle) - -(fn window.open? [self] - (if self.handle - (vim.api.nvim_win_is_valid self.handle) false)) - -(fn window.new [self i enter maps] - (local w (setmetatable {: i : enter : maps} window)) - (set self.__index self) - w) - -(fn m.new-window [self maps] - (local w (window:new (+ (length self.windows) 1) (= (length self.windows) 0) - maps)) - (table.insert self.windows w) - w) - -(fn m.close [self] - (each [_ w (ipairs self.windows)] - (w:close)) - (if self.augroup - (set self.augroup (del-aug self.augroup))) - (if self.unmap - (set self.unmap (self.unmap)))) - -(fn m.attach [self] - (set self.augroup (aug :EffectsMgr {:clear true})) - (au [:WinEnter] - {:group self.augroup - :pattern "*" - :callback (fn [cb-info] - (P :effectEnter) - (local (ok? win) (winvar 0 :effect-window)) - (P ok? win) - (if (not ok?) - (self:close) - (do - (if win.maps - (self:win-maps win)))))})) - -(fn m.win-maps [self win] - (P win) - (if self.unmap - (self.unmap)) - (set self.unmap (fn [] - (each [_ m (ipairs win.maps)] - (unmap m)))) - (each [_ {: mode : lhs : rhs : opts} (ipairs win.maps)] - (map mode lhs (rhs self win) opts))) - -(fn m.new [self opts] - (local effects {:windows []}) - (setmetatable effects self) - (set self.__index self) - effects) - -m diff --git a/neovim/fnl/conf/wict-nvim/frames/frame.fnl b/neovim/fnl/conf/wict-nvim/frames/frame.fnl deleted file mode 100644 index d32c9b5..0000000 --- a/neovim/fnl/conf/wict-nvim/frames/frame.fnl +++ /dev/null @@ -1,61 +0,0 @@ -(local vec (require :conf.wict-nvim.frames.vec)) -(local m {}) -(local frame {}) - -;; frame is interpreted as matrix coords -;; origin ------------------> ne-edge -;; | -;; | -;; | -;; | -;; | -;; | -;;\ / -;; . -;; sw-edge -(fn frame.make [self ori width height] - (local f {: ori : width : height}) - (setmetatable f self) - (set self.__index self) - f) - -(fn frame.origin [f] - f.ori) - -(fn frame.width-edge [f] - f.width) - -(fn frame.height-edge [f] - f.height) - -(fn m.frame->coord [f] - (fn [v] - (vec.add (f:origin) - (vec.add (vec.scale (v:x-coord) (f:width-edge)) - (vec.scale (v:y-coord) (f:height-edge)))))) - -(fn m.width [f] - (let [width-edge (f:width-edge)] - (width-edge:x-coord))) - -(fn m.height [f] - (let [height-edge (f:height-edge)] - (height-edge:y-coord))) - -(fn m.frame->open-win-options [f anchor] - (local coord (m.frame->coord f)) - (local ori (f:origin)) - (local width-edge (f:width-edge)) - (local height-edge (f:height-edge)) - (local anchor (or anchor :NW)) - {:width (width-edge:x-coord) - :height (height-edge:y-coord) - :col (ori:x-coord) - :row (ori:y-coord) - : anchor - :relative :editor}) - -(setmetatable m {:__call (fn [self ...] - (frame:make ...))}) - -m diff --git a/neovim/fnl/conf/wict-nvim/frames/vec.fnl b/neovim/fnl/conf/wict-nvim/frames/vec.fnl deleted file mode 100644 index 4a9515d..0000000 --- a/neovim/fnl/conf/wict-nvim/frames/vec.fnl +++ /dev/null @@ -1,28 +0,0 @@ -(local m {}) -(local vec {}) - -(fn vec.make [self x y] - (local v {: x : y}) - (setmetatable v self) - (set self.__index self) - v) - -(fn vec.x-coord [v] - v.x) - -(fn vec.y-coord [v] - v.y) - -(fn m.add [v1 v2] - (vec:make (+ (v1:x-coord) (v2:x-coord)) (+ (v1:y-coord) (v2:y-coord)))) - -(fn m.sub [v1 v2] - (vec:make (- (v1:x-coord) (v2:x-coord)) (- (v1:y-coord) (v2:y-coord)))) - -(fn m.scale [a v] - (vec:make (math.floor (* a (v:x-coord))) (math.floor (* a (v:y-coord))))) - -(fn m.vec [...] - (vec:make ...)) - -m diff --git a/neovim/fnl/conf/wict-nvim/init.fnl b/neovim/fnl/conf/wict-nvim/init.fnl deleted file mode 100644 index 9e40fad..0000000 --- a/neovim/fnl/conf/wict-nvim/init.fnl +++ /dev/null @@ -1,31 +0,0 @@ -(tset package.loaded :conf.wict-nvim.frames.vec nil) -(local vec (require :conf.wict-nvim.frames.vec)) - -(tset package.loaded :conf.wict-nvim.frames.frame nil) -(local frame (require :conf.wict-nvim.frames.frame)) - -(tset package.loaded :conf.wict-nvim.builder nil) -(local builder (require :conf.wict-nvim.builder)) - -(tset package.loaded :conf.wict-nvim.effects nil) -(local effects (require :conf.wict-nvim.effects)) - -(local m {}) - -(local root-frame (frame (vec.vec 0 0) (vec.vec vim.o.columns 0) - (vec.vec 0 vim.o.lines))) - -(local painter (-> (builder.For {:buffer (fn [] 0) - :maps [{:mode [:n :v :o] - :lhs :q - :rhs (fn [effects window] - (fn [] - (effects:close)))}]}) - (builder.Beside (-> (builder.For {:buffer (fn [] 0) - :maps []})) - 0.5) - (builder.Padding 5) - (builder.Build (effects:new)))) - -; (painter root-frame) -{: root-frame : builder : effects} diff --git a/neovim/fnl/conf/wictl-nvim/init.fnl b/neovim/fnl/conf/wictl-nvim/init.fnl deleted file mode 100644 index bd04182..0000000 --- a/neovim/fnl/conf/wictl-nvim/init.fnl +++ /dev/null @@ -1,58 +0,0 @@ -(local Path (require :plenary.path)) -(tset package.loaded :conf.wict-nvim nil) -(local wict (require :conf.wict-nvim)) -(tset package.loaded :conf.wictl-nvim.resolvers nil) -(local Resolver (require :conf.wictl-nvim.resolvers)) - -(local bld wict.builder) -(local eff wict.effects) - -(local config_path (vim.fn.stdpath :config)) -(local data_path (vim.fn.stdpath :data)) -(local user_config (string.format "%s/wictl.json" config_path)) -(local cache_config (string.format "%s/wictl.json" data_path)) - -(local m {}) - -(local WictlConfig {}) -;; { -;; ["/path/to/project"] = { -;; terms = [{cmd = "k9s"}] -;; } - -(fn m.Edit [project]) - -(fn m.Read [path] - (local p (Path:new path)) - (vim.fn.json_decode (p:read))) - -(fn m.Save [] - (local cache-path (Path:new cache_config)) - (cache-path:write (vim.fn.json_encode WictlConfig) :w)) - -(local ensure-complete-project (fn [config] - (var config (or config {:terms []})) - (if (not config.terms) - (set config.terms - [{:name :k9s :cmd :bash}])) - config)) - -(local get-project (fn [] - (local proj (. WictlConfig (Resolver.project_key))) - (ensure-complete-project (or proj - (do - (local cfg {}) - (tset WictlConfig - (Resolver.project_key) - cfg) - cfg))))) - -(fn m.Get-Terms-Config [] - (local proj (get-project)) - proj.terms) - -(m.Save) -(m.Read cache_config) -(m.Get-Terms-Config) - -m diff --git a/neovim/fnl/conf/wictl-nvim/resolvers.fnl b/neovim/fnl/conf/wictl-nvim/resolvers.fnl deleted file mode 100644 index df5f2ac..0000000 --- a/neovim/fnl/conf/wictl-nvim/resolvers.fnl +++ /dev/null @@ -1,5 +0,0 @@ -(local m {}) -(fn m.project_key [] - (vim.loop.cwd)) - -m diff --git a/neovim/fnl/conf/wictl-nvim/term.fnl b/neovim/fnl/conf/wictl-nvim/term.fnl deleted file mode 100644 index 51e263a..0000000 --- a/neovim/fnl/conf/wictl-nvim/term.fnl +++ /dev/null @@ -1,54 +0,0 @@ -(tset package.loaded :conf.wict-nvim nil) -(local ui (require :conf.wict-nvim)) -(tset package.loaded :conf.wict-nvim.effects nil) -(local ui-eff (require :conf.wict-nvim.effects)) - -(tset package.loaded :conf.wictl-nvim nil) -(local wictl (require :conf.wictl-nvim)) - -(local Resolver (require :conf.wictl-nvim.resolvers)) -(local ui-bld ui.builder) -(local M {}) - -(local ProjectBufs {}) -(var selected nil) -(local term-ui (-> (ui-bld.For {:buffer (fn [] selected) - :maps [{:mode [:n :v :o] - :lhs :q - :rhs (fn [effects window] - (fn [] - (P :quitting!) - (effects:close)))}]}) - (ui-bld.Padding 2) - (ui-bld.Build (ui-eff:new)))) - -(fn M.open [idx] - (local new-term-buf (fn [] - (local (buf_handle term_handle) (M.start idx)) - (tset ProjectBufs (Resolver.project_key) idx - {: buf_handle : term_handle}) - {: buf_handle : term_handle})) - (local proj (or (. ProjectBufs (Resolver.project_key)) - (do - (local p []) - (tset ProjectBufs (Resolver.project_key) p) - p))) - (var term (or (. proj idx) (new-term-buf))) - (if (or (not (vim.api.nvim_buf_is_valid term.buf_handle)) - (not (vim.api.nvim_buf_get_var term.buf_handle :terminal_job_id))) - (set term (new-term-buf))) - (set selected term.buf_handle) - (term-ui ui.root-frame)) - -(fn M.start [idx] - (P :starting) - (local term (. (wictl.Get-Terms-Config) idx)) - (local prestart-buf (vim.api.nvim_get_current_buf)) - (vim.cmd (.. "edit term://" term.cmd)) - (local buf_handle (vim.api.nvim_get_current_buf)) - (local term_handle vim.b.terminal_job_id) - (vim.api.nvim_buf_set_option buf_handle :bufhidden :hide) - (vim.api.nvim_set_current_buf prestart-buf) - (values buf_handle term_handle)) - -M diff --git a/neovim/init.fnl b/neovim/init.fnl deleted file mode 100644 index 7e82675..0000000 --- a/neovim/init.fnl +++ /dev/null @@ -1,36 +0,0 @@ -;; fixes nixpkgs hotpot not adding package path correctly - -(tset _G.package :path - (.. (vim.fn.stdpath :cache) "/hotpot/hotpot.nvim/lua/?/init.lua;" - package.path)) - -(fn build-init [] - (let [{: build} (require :hotpot.api.make) - allowed-globals (icollect [n _ (pairs _G)] - n) - opts {:verbosity 0 - :compiler {:modules {:allowedGlobals allowed-globals}}} - here #(values $1) - config-path (vim.fn.stdpath :config)] - (build config-path opts (.. config-path :/init.fnl) here - (.. config-path :/after/ftdetect/.+) here - (.. config-path :/ftplugin/.+) here - (.. config-path :/after/ftplugin/.+) here))) - -;; Call hotpot.setup and compile again after fs event - -(let [hotpot (require :hotpot) - setup hotpot.setup - build hotpot.api.make.build - uv vim.loop - config-path (vim.fn.stdpath :config)] - (setup {:provide_require_fennel true - :compiler {:modules {:correlate true} - :macros {:env :_COMPILER - :compilerEnv _G - :allowedGlobals false}}}) - (let [handle (uv.new_fs_event) - path (vim.fn.expand (.. config-path :/init.fnl))] - (uv.fs_event_start handle path {} #(vim.schedule build-init)) - (vim.api.nvim_create_autocmd :VimLeavePre {:callback #(uv.close handle)}))) -(require :conf) diff --git a/neovim/init.lua b/neovim/init.lua deleted file mode 100644 index 3de4446..0000000 --- a/neovim/init.lua +++ /dev/null @@ -1,46 +0,0 @@ -_G.package["path"] = (vim.fn.stdpath("cache") .. "/hotpot/hotpot.nvim/lua/?/init.lua;" .. package.path) -local function build_init() - local _let_1_ = require("hotpot.api.make") - local build = _let_1_["build"] - local allowed_globals - do - local tbl_17_auto = {} - local i_18_auto = #tbl_17_auto - for n, _ in pairs(_G) do - local val_19_auto = n - if (nil ~= val_19_auto) then - i_18_auto = (i_18_auto + 1) - do end (tbl_17_auto)[i_18_auto] = val_19_auto - else - end - end - allowed_globals = tbl_17_auto - end - local opts = {verbosity = 0, compiler = {modules = {allowedGlobals = allowed_globals}}} - local here - local function _3_(_241) - return _241 - end - here = _3_ - local config_path = vim.fn.stdpath("config") - return build(config_path, opts, (config_path .. "/init.fnl"), here, (config_path .. "/after/ftdetect/.+"), here, (config_path .. "/ftplugin/.+"), here, (config_path .. "/after/ftplugin/.+"), here) -end -do - local hotpot = require("hotpot") - local setup = hotpot.setup - local build = hotpot.api.make.build - local uv = vim.loop - local config_path = vim.fn.stdpath("config") - setup({provide_require_fennel = true, compiler = {modules = {correlate = true}, macros = {env = "_COMPILER", compilerEnv = _G, allowedGlobals = false}}}) - local handle = uv.new_fs_event() - local path = vim.fn.expand((config_path .. "/init.fnl")) - local function _4_() - return vim.schedule(build_init) - end - uv.fs_event_start(handle, path, {}, _4_) - local function _5_() - return uv.close(handle) - end - vim.api.nvim_create_autocmd("VimLeavePre", {callback = _5_}) -end -return require("conf") \ No newline at end of file diff --git a/neovim/test.py b/neovim/test.py deleted file mode 100644 index e69de29..0000000 diff --git a/overlays/#vimPlugins.nix# b/overlays/#vimPlugins.nix# deleted file mode 100644 index 7933c5a..0000000 --- a/overlays/#vimPlugins.nix# +++ /dev/null @@ -1,53 +0,0 @@ -{pkgs, ...}: (final: prev: { - vimPlugins = let - getVimPlugin = { - name, - git, - rev, - ref ? "master", - }: - pkgs.vimUtils.buildVimPluginFrom2Nix { - inherit name; - src = builtins.fetchGit { - url = "https://github.com/${git}"; - submodules = true; - inherit rev; - inherit ref; - }; - }; - in - prev.vimPlugins - // { - neotest-python = getVimPlugin { - name = "neotest-python"; - git = "nvim-neotest/neotest-python"; - rev = "e53920d145d37783c8d8428365a0a230e0a18cb5"; - }; - firvish-nvim = getVimPlugin { - name = "firvish-nvim"; - git = "Furkanzmc/firvish.nvim"; - rev = "127f9146175d6bbaff6a8b761081cfd2279f8351"; - }; - nvim-parinfer = getVimPlugin { - name = "nvim-parinfer"; - git = "gpanders/nvim-parinfer"; - rev = "82bce5798993f4fe5ced20e74003b492490b4fe8"; - }; - vim-just = getVimPlugin { - name = "vim-just"; - git = "NoahTheDuke/vim-just"; - rev = "838c9096d4c5d64d1000a6442a358746324c2123"; - }; - vim-rest-console = getVimPlugin { - name = "vim-rest-console"; - git = "diepm/vim-rest-console"; - rev = "7b407f47185468d1b57a8bd71cdd66c9a99359b2"; - }; - codeium-vim = getVimPlugin { - name = "codeium-vim"; - git = "Exafunction/codeium.vim"; - rev = "be2fa21f4f63850382a0cefeaa9f766b977c9f0c"; - ref = "refs/heads/main"; - }; - }; -}) diff --git a/overlays/.#vimPlugins.nix b/overlays/.#vimPlugins.nix deleted file mode 120000 index 92794ea..0000000 --- a/overlays/.#vimPlugins.nix +++ /dev/null @@ -1 +0,0 @@ -mike@lemptop.166922:1691484931 \ No newline at end of file diff --git a/overlays/vimPlugins.nix b/overlays/vimPlugins.nix index 7933c5a..65235fa 100644 --- a/overlays/vimPlugins.nix +++ b/overlays/vimPlugins.nix @@ -1,3 +1,4 @@ + {pkgs, ...}: (final: prev: { vimPlugins = let getVimPlugin = { diff --git a/profiles/core/configuration.nix b/profiles/core/configuration.nix new file mode 100644 index 0000000..e677306 --- /dev/null +++ b/profiles/core/configuration.nix @@ -0,0 +1,154 @@ +{ + config, + pkgs, + ... +}: { + users.users.mike = { + isNormalUser = true; + extraGroups = ["wheel" "networkmanager" "docker" "transmission"]; + }; + + virtualisation.docker.enable = true; + + hardware.keyboard.qmk.enable = true; + services.udev.extraRules = '' + # Atmel DFU + ### ATmega16U2 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2fef", TAG+="uaccess" + ### ATmega32U2 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff0", TAG+="uaccess" + ### ATmega16U4 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff3", TAG+="uaccess" + ### ATmega32U4 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff4", TAG+="uaccess" + ### AT90USB64 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff9", TAG+="uaccess" + ### AT90USB162 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffa", TAG+="uaccess" + ### AT90USB128 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffb", TAG+="uaccess" + + # Input Club + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1c11", ATTRS{idProduct}=="b007", TAG+="uaccess" + + # STM32duino + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1eaf", ATTRS{idProduct}=="0003", TAG+="uaccess" + # STM32 DFU + SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", TAG+="uaccess" + + # BootloadHID + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", TAG+="uaccess" + + # USBAspLoader + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", TAG+="uaccess" + + # USBtinyISP + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1782", ATTRS{idProduct}=="0c9f", TAG+="uaccess" + + # ModemManager should ignore the following devices + # Atmel SAM-BA (Massdrop) + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + + # Caterina (Pro Micro) + ## pid.codes shared PID + ### Keyboardio Atreus 2 Bootloader + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2302", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ## Spark Fun Electronics + ### Pro Micro 3V3/8MHz + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9203", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### Pro Micro 5V/16MHz + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9205", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### LilyPad 3V3/8MHz (and some Pro Micro clones) + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9207", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ## Pololu Electronics + ### A-Star 32U4 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="0101", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ## Arduino SA + ### Leonardo + SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### Micro + SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0037", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ## Adafruit Industries LLC + ### Feather 32U4 + SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000c", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### ItsyBitsy 32U4 3V3/8MHz + SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000d", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### ItsyBitsy 32U4 5V/16MHz + SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000e", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ## dog hunter AG + ### Leonardo + SUBSYSTEMS=="usb", ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + ### Micro + SUBSYSTEMS=="usb", ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="0037", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" + + # hid_listen + KERNEL=="hidraw*", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" + + # hid bootloaders + ## QMK HID + SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2067", TAG+="uaccess" + ## PJRC's HalfKay + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0478", TAG+="uaccess" + + # APM32 DFU + SUBSYSTEMS=="usb", ATTRS{idVendor}=="314b", ATTRS{idProduct}=="0106", TAG+="uaccess" + + # GD32V DFU + SUBSYSTEMS=="usb", ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", TAG+="uaccess" + + # WB32 DFU + SUBSYSTEMS=="usb", ATTRS{idVendor}=="342d", ATTRS{idProduct}=="dfa0", TAG+="uaccess" + ''; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "lemptop"; + networking.networkmanager.enable = true; + time.timeZone = "Europe/Amsterdam"; + + services.xserver.enable = true; + services.xserver.displayManager.startx.enable = true; + services.xserver.libinput.enable = true; + + services.udev.packages = [ pkgs.yubikey-personalization ]; + services.pcscd.enable = true; + security.pam.services = { + login.u2fAuth = true; + sudo.u2fAuth = true; + }; + + sound.enable = true; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + services.transmission = { + enable = true; + }; + + hardware.bluetooth.enable = true; + services.blueman.enable = true; + + programs.slock.enable = true; + + documentation.dev.enable = true; + environment.systemPackages = with pkgs; [ + man-pages + man-pages-posix + vim + wget + git + pinentry-curses + ]; + + system.stateVersion = "23.05"; + nix.package = pkgs.nixUnstable; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; +} diff --git a/profiles/core/hm.nix b/profiles/core/hm.nix new file mode 100644 index 0000000..e1a29d6 --- /dev/null +++ b/profiles/core/hm.nix @@ -0,0 +1,24 @@ +{inputs, config, lib, ...}: { + imports = [ + inputs.home-manager.nixosModules.default + (mkAliasOptionModule [ "hm" ] [ "home-manager" "users" my.username ]) + ]; + + system.extraDependencies = collectFlakeInputs inputs.home-manager; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + verbose = true; + extraSpecialArgs = { inherit inputs; }; + }; + + hm = { + home.stateVersion = config.system.stateVersion; + home.enableNixpkgsReleaseCheck = false; + + systemd.user.startServices = "sd-switch"; + + manual.html.enable = true; + }; +} diff --git a/profiles/core/home.nix b/profiles/core/home.nix new file mode 100644 index 0000000..5d57f76 --- /dev/null +++ b/profiles/core/home.nix @@ -0,0 +1,242 @@ +{ + inputs, + config, + pkgs, + ... +}: { + programs.home-manager.enable = true; + home.homeDirectory = "/home/${username}"; + home.username = username; + home.stateVersion = "23.05"; + fonts.fontconfig.enable = true; + xdg = { + enable = true; + configFile = with config.lib.meta; { + "emacs/init.el".source = mkMutableSymlink ./emacs/init.el; + }; + mimeApps = { + enable = true; + defaultApplications = { + "text/x-shellscript" = ["text.desktop"]; + "x-scheme-handler/magnet" = ["torrent.desktop"]; + "application/x-bittorrent" = ["torrent.desktop"]; + "x-scheme-handler/mailto" = ["mail.desktop"]; + "text/plain" = ["text.desktop"]; + "application/postscript" = ["pdf.desktop"]; + "application/pdf" = ["pdf.desktop"]; + "image/png" = ["img.desktop"]; + "image/jpeg" = ["img.desktop"]; + "image/gif" = ["img.desktop"]; + "application/rss+xml" = ["rss.desktop"]; + "video/x-matroska" = ["video.desktop"]; + "video/mp4" = ["video.desktop"]; + "x-scheme-handler/lbry" = ["lbry.desktop"]; + "inode/directory" = ["file.desktop"]; + }; + }; + mime.enable = true; + desktopEntries = { + text= { type = "Application"; name = "Text editor"; exec = "${pkgs.st}/bin/st -e kak %u"; }; + file = { type = "Application"; name = "File Manager"; exec = "${pkgs.st}/bin/st -e lfub %u"; }; + torrent = { type = "Application"; name = "Torrent"; exec = "${pkgs.coreutils}/bin/env transadd %U"; }; + img = { type = "Application"; name = "Image Viewer"; exec = "${pkgs.sxiv}/bin/sxiv -a %u"; }; + video = { type = "Application"; name = "Video Viewer"; exec = "${pkgs.mpv}/bin/mpv -quiet %f"; }; + mail = { type = "Application"; name = "Mail"; exec = "${pkgs.st}/bin/st -e neomutt %u"; }; + pdf = { type = "Application"; name = "PDF reader"; exec = "${pkgs.zathura}/bin/zathura %u"; }; + rss = { type = "Application"; name = "RSS feed addition"; exec = "${pkgs.coreutils}/bin/env rssadd %u"; }; + }; + }; + + programs.ssh = { + enable = true; + matchBlocks = { + "*" = { + identityFile = "${config.home.homeDirectory}/.ssh/id_ed25519"; + }; + }; + }; + + home.sessionVariables = { + EDITOR = "kak"; + TERMINAL = "st"; + }; + + home.sessionPath = [ + "${config.home.homeDirectory}/.krew/bin" + "${config.home.homeDirectory}/.cargo/bin" + "${pkgs.ncurses}/bin" + ]; + + programs.starship.enable = true; + + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + + programs.readline = { + enable = true; + extraConfig = '' + $if mode=vi + + set keymap vi-command + # these are for vi-command mode + Control-l: clear-screen + + set keymap vi-insert + # these are for vi-insert mode + Control-l: clear-screen + $endif + ''; + }; + + programs.emacs = { + enable = true; + package = pkgs.emacs29; + }; + + programs.tmux = { + enable = true; + extraConfig = '' + set-option -g default-shell ${pkgs.bashInteractive}/bin/bash + set -s set-clipboard on + setw -g mouse on + set -g default-terminal "st-256color" + set -ga terminal-overrides ",xterm-256color:Tc" + set-option -g focus-events on + set-option -sg escape-time 10 + # unbind C-b + # set -g prefix C-space + # bind C-space send-prefix + + bind-key R source ${config.xdg.configHome}/tmux/tmux.conf; display-message "sourced ${config.xdg.configHome}/tmux/tmux.conf!" + + set-window-option -g mode-keys vi + bind-key -T copy-mode-vi v send -X begin-selection + bind-key -T copy-mode-vi V send -X select-line + bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard' + bind-key -T copy-mode-vi : command-prompt + + bind-key -T window k select-pane -t '{up-of}' + bind-key -T window j select-pane -t '{down-of}' + bind-key -T window l select-pane -t '{right-of}' + bind-key -T window h select-pane -t '{left-of}' + bind-key -T window = select-layout even-vertical + bind-key -T window o kill-pane -a + bind-key -T window _ resize-pane -y 90% + bind-key -T window n run-shell ' + window="$(tmux display -p "#{window_name}")" + if [[ "''${window##kakc@}" != "$window" ]]; then + tmux splitw "kak -c ''${window##kakc@}" + else + tmux splitw "kak -c ''${KAK_SERVER##kaks@}" + fi + ' + bind -n C-space switch-client -T window + + bind -n C-s run-shell tmux-normal-mode + bind -n C-q run-shell 'tmux-normal-mode --quit' + ''; + }; + + programs.bash = { + enable = true; + bashrcExtra = '' + export PATH=$PATH:$HOME/.local/bin + [[ -f ~/.cache/wal/sequences ]] && (cat ~/.cache/wal/sequences &) + unset LD_PRELOAD + if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then + . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' + fi + # include nix.sh if it exists + [[ -f ~/.nix-profile/etc/profile.d/nix.sh ]] && . ~/.nix-profile/etc/profile.d/nix.sh + # source some workspace specific stuff + [[ -f ~/env.sh ]] && . ~/env.sh + export COLORTERM=truecolor + export GPG_TTY="$(tty)" + export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + gpgconf --launch gpg-agent + ''; + shellAliases = { + e = "kakup "; + es = "kakup -f"; + k9s = "k9s"; + k = "kubectl "; + d = "docker "; + ls = "ls --color=auto"; + s = "sudo nixos-rebuild switch --flake ${config.home.homeDirectory}/flake#"; + b = "/run/current-system/bin/switch-to-configuration boot"; + h = "home-manager switch --flake ${config.home.homeDirectory}/flake --impure"; + fa = "azdo-switch-project"; + v = "nvim"; + V = "nvim -S .vimsession.vim"; + M = "xrandr --output HDMI1 --auto --output eDP1 --off"; + m = "xrandr --output eDP1 --auto --output HDMI1 --off"; + mM = "xrandr --output eDP1 --auto --output HDMI1 --off"; + newflake = "nix flake new -t ~/flake "; + ansible-flake = "nix flake new -t ~/flake#ansible "; + go-flake = "nix flake new -t ~/flake#go "; + lock-pass = "gpgconf --kill gpg-agent"; + }; + }; + + programs.nushell.enable = true; + + programs.git = { + enable = true; + userName = "Mike Vink"; + userEmail = email; + extraConfig = { + worktree.guessRemote = true; + mergetool.fugitive.cmd = "vim -f -c \"Gdiff\" \"$MERGED\""; + merge.tool = "fugitive"; + }; + ignores = [ + "/.direnv/" + "/.envrc" + "/.env" + ".vimsession.vim" + ]; + }; + + # https://github.com/drduh/config/blob/master/gpg.conf + # https://www.gnupg.org/documentation/manuals/gnupg/GPG-Configuration-Options.html + # https://www.gnupg.org/documentation/manuals/gnupg/GPG-Esoteric-Options.html + programs.gpg = { + enable = true; + scdaemonSettings = { + disable-ccid = true; + }; + settings = { + personal-cipher-preferences = "AES256 AES192 AES"; + personal-digest-preferences = "SHA512 SHA384 SHA256"; + personal-compress-preferences = "ZLIB BZIP2 ZIP Uncompressed"; + default-preference-list = "SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed"; + cert-digest-algo = "SHA512"; + s2k-digest-algo = "SHA512"; + s2k-cipher-algo = "AES256"; + charset = "utf-8"; + fixed-list-mode = true; + no-comments = true; + no-emit-version = true; + no-greeting = true; + keyid-format = "0xlong"; + list-options = "show-uid-validity"; + verify-options = "show-uid-validity"; + "with-fingerprint" = true; + require-cross-certification = true; + no-symkey-cache = true; + use-agent = true; + throw-keyids = true; + }; + }; + services.gpg-agent = { + enable = true; + enableSshSupport = true; + defaultCacheTtl = 34550000; + maxCacheTtl = 34550000; + }; + programs.password-store = { + enable = true; + }; +} diff --git a/profiles/email/gmail.nix b/profiles/email/gmail.nix new file mode 100644 index 0000000..fa5d44e --- /dev/null +++ b/profiles/email/gmail.nix @@ -0,0 +1,118 @@ +{ + inputs, + config, + pkgs, + ... +}: { + accounts.email = { + maildirBasePath = "${config.xdg.dataHome}/mail"; + accounts = { + gmail = { + primary = true; + realName = "Mike Vink"; + userName = "mike1994vink@gmail.com"; + address = "mike1994vink@gmail.com"; + passwordCommand = ["${pkgs.pass}/bin/pass" "personal/neomutt"]; + imap = { host = "imap.gmail.com"; port = 993; tls = { enable = true; }; }; + smtp = { host = "smtp.gmail.com"; port = 587; tls = { enable = true; useStartTls = true; }; }; + msmtp = { + enable = true; + }; + neomutt = { + enable = true; + sendMailCommand = "msmtp -a gmail"; + mailboxName = "=== mike1994vink ==="; + extraConfig = '' + set spoolfile='Inbox' + unvirtual-mailboxes * + ''; + }; + mbsync = { + enable = true; + create = "both"; remove = "both"; expunge = "both"; + groups = { + gmail = { + channels = { + Inbox = { farPattern = "INBOX"; nearPattern = "INBOX"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Archive = { farPattern = "[Gmail]/All Mail"; nearPattern = "Archive"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Spam = { farPattern = "[Gmail]/Spam"; nearPattern = "Spam"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Trash = { farPattern = "[Gmail]/Bin"; nearPattern = "Trash"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Important = { farPattern = "[Gmail]/Important"; nearPattern = "Important"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Sent = { farPattern = "[Gmail]/Sent Mail"; nearPattern = "Sent"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + FarDrafts = { farPattern = "[Gmail]/Drafts"; nearPattern = "FarDrafts"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + }; + }; + }; + }; + notmuch = { + enable = true; + neomutt = { + enable = true; + virtualMailboxes = [ + { name = "Inbox"; query = "folder:/gmail/ tag:inbox"; } + { name = "Archive"; query = "folder:/gmail/ tag:archive"; } + { name = "Sent"; query = "folder:/gmail/ tag:sent"; } + { name = "Spam"; query = "folder:/gmail/ tag:spam"; } + { name = "Trash"; query = "folder:/gmail/ tag:trash"; } + { name = "Jobs"; query = "folder:/gmail/ tag:jobs"; } + { name = "Houses"; query = "folder:/gmail/ tag:houses"; } + { name = "Development"; query = "folder:/gmail/ tag:dev"; } + ]; + }; + }; + }; + family = { + primary = false; + realName = "Natalia & Mike Vink"; + userName = "natalia.mike.vink@gmail.com"; + address = "natalia.mike.vink@gmail.com"; + passwordCommand = ["${pkgs.pass}/bin/pass" "personal/neomutt-family"]; + imap = { host = "imap.gmail.com"; port = 993; tls = { enable = true; }; }; + smtp = { host = "smtp.gmail.com"; port = 587; tls = { enable = true; useStartTls = true; }; }; + msmtp = { + enable = true; + }; + neomutt = { + enable = true; + sendMailCommand = "msmtp -a gmail"; + mailboxName = "=== family ==="; + extraConfig = '' + set spoolfile='Inbox' + unvirtual-mailboxes * + ''; + }; + + mbsync = { + enable = true; + create = "both"; remove = "both"; expunge = "both"; + groups = { + family = { + channels = { + Inbox = { farPattern = "INBOX"; nearPattern = "INBOX"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Archive = { farPattern = "[Gmail]/All Mail"; nearPattern = "Archive"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Spam = { farPattern = "[Gmail]/Spam"; nearPattern = "Spam"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Trash = { farPattern = "[Gmail]/Bin"; nearPattern = "Trash"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Important = { farPattern = "[Gmail]/Important"; nearPattern = "Important"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + Sent = { farPattern = "[Gmail]/Sent Mail"; nearPattern = "Sent"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + FarDrafts = { farPattern = "[Gmail]/Drafts"; nearPattern = "FarDrafts"; extraConfig = { Create = "Near"; Expunge = "Both"; }; }; + }; + }; + }; + }; + notmuch = { + enable = true; + neomutt = { + enable = true; + virtualMailboxes = [ + { name = "Inbox"; query = "folder:/family/ tag:inbox"; } + { name = "Archive"; query = "folder:/family/ tag:archive"; } + { name = "Sent"; query = "folder:/family/ tag:sent"; } + { name = "Spam"; query = "folder:/family/ tag:spam"; } + { name = "Trash"; query = "folder:/family/ tag:trash"; } + ]; + }; + }; + }; + }; + }; +} diff --git a/profiles/email/mailsync.nix b/profiles/email/mailsync.nix new file mode 100644 index 0000000..3fcb0c5 --- /dev/null +++ b/profiles/email/mailsync.nix @@ -0,0 +1,34 @@ +{ + inputs, + config, + pkgs, + ... +}: { + programs.mbsync = { + enable = true; + }; + systemd.user.timers.mailsync = { + Unit = { + Description = "daemon that syncs mail"; + }; + Timer = { + OnBootSec = "5m"; + OnUnitActiveSec = "5m"; + Unit = "mailsync.service"; + }; + Install = { + WantedBy = [ "timers.target" ]; + }; + }; + systemd.user.services.mailsync = { + Unit = { + Description = "daemon that syncs mail"; + }; + Service = { + Type = "oneshot"; + RemainAfterExit = "no"; + ExecSearchPath = "${config.home.profileDirectory}/bin:/run/current-system/sw/bin"; + ExecStart = "${pkgs.coreutils}/bin/env mailsync"; + }; + }; +} diff --git a/profiles/email/neomutt.nix b/profiles/email/neomutt.nix new file mode 100644 index 0000000..384173f --- /dev/null +++ b/profiles/email/neomutt.nix @@ -0,0 +1,198 @@ +{ + inputs, + config, + pkgs, + ... +}: { + programs.msmtp = { + enable = true; + }; + + xdg.configFile."neomutt/mailcap" = { + text = '' + text/plain; $EDITOR %s ; + text/html; openfile %s ; nametemplate=%s.html + text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput; + image/*; openfile %s ; + video/*; setsid mpv --quiet %s &; copiousoutput + audio/*; mpv %s ; + application/pdf; openfile %s ; + application/pgp-encrypted; gpg -d '%s'; copiousoutput; + application/pgp-keys; gpg --import '%s'; copiousoutput; + application/x-subrip; $EDITOR %s ; + ''; + }; + + programs.neomutt = { + enable = true; + sort = "reverse-date"; + sidebar = { + enable = true; + }; + extraConfig = '' + set use_threads=yes + set send_charset="us-ascii:utf-8" + set mailcap_path = $HOME/.config/neomutt/mailcap + set mime_type_query_command = "file --mime-type -b %s" + set date_format="%y/%m/%d %I:%M%p" + set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" + set smtp_authenticators = 'gssapi:login' + set query_command = "abook --mutt-query '%s'" + set rfc2047_parameters = yes + set sleep_time = 0 # Pause 0 seconds for informational messages + set markers = no # Disables the `+` displayed at line wraps + set mark_old = no # Unread mail stay unread until read + set mime_forward = no # mail body is forwarded as text + set forward_attachments = yes # attachments are forwarded with mail + set wait_key = no # mutt won't ask "press key to continue" + set fast_reply # skip to compose when replying + set fcc_attach # save attachments with the body + set forward_format = "Fwd: %s" # format of subject when forwarding + set forward_quote # include message in forwards + set reverse_name # reply as whomever it was to + set include # include message in replies + set mail_check=0 # to avoid lags using IMAP with some email providers (yahoo for example) + auto_view text/html # automatically show html (mailcap uses lynx) + auto_view application/pgp-encrypted + #set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. + alternative_order text/plain text/enriched text/html + + set sidebar_visible = yes + set sidebar_width = 20 + set sidebar_short_path = yes + set sidebar_next_new_wrap = yes + set mail_check_stats + set sidebar_format = '%D%?F? [%F]?%* %?N?%N/? %?S?%S?' + bind index,pager \Ck sidebar-prev + bind index,pager \Cj sidebar-next + bind index,pager \Co sidebar-open + bind index,pager \Cp sidebar-prev-new + bind index,pager \Cn sidebar-next-new + bind index,pager B sidebar-toggle-visible + + # Default index colors: + color index yellow default '.*' + color index_author red default '.*' + color index_number blue default + color index_subject cyan default '.*' + + # New mail is boldened: + color index brightyellow black "~N" + color index_author brightred black "~N" + color index_subject brightcyan black "~N" + + # Tagged mail is highlighted: + color index brightyellow blue "~T" + color index_author brightred blue "~T" + color index_subject brightcyan blue "~T" + + # Flagged mail is highlighted: + color index brightgreen default "~F" + color index_subject brightgreen default "~F" + color index_author brightgreen default "~F" + + # Other colors and aesthetic settings: + mono bold bold + mono underline underline + mono indicator reverse + mono error bold + color normal default default + color indicator brightblack white + color sidebar_highlight red default + color sidebar_divider brightblack black + color sidebar_flagged red black + color sidebar_new green black + color error red default + color tilde black default + color message cyan default + color markers red white + color attachment white default + color search brightmagenta default + color status brightyellow black + color hdrdefault brightgreen default + color quoted green default + color quoted1 blue default + color quoted2 cyan default + color quoted3 yellow default + color quoted4 red default + color quoted5 brightred default + color signature brightgreen default + color bold black default + color underline black default + + # Regex highlighting: + color header brightmagenta default "^From" + color header brightcyan default "^Subject" + color header brightwhite default "^(CC|BCC)" + color header blue default ".*" + color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses + color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL + color body green default "\`[^\`]*\`" # Green text between ` and ` + color body brightblue default "^# \.*" # Headings as bold blue + color body brightcyan default "^## \.*" # Subheadings as bold cyan + color body brightgreen default "^### \.*" # Subsubheadings as bold green + color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow + color body brightcyan default "[;:][-o][)/(|]" # emoticons + color body brightcyan default "[;:][)(|]" # emoticons + color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon? + color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon? + color body red default "(BAD signature)" + color body cyan default "(Good signature)" + color body brightblack default "^gpg: Good signature .*" + color body brightyellow default "^gpg: " + color body brightyellow red "^gpg: BAD signature from.*" + mono body bold "^gpg: Good signature" + mono body bold "^gpg: BAD signature from.*" + color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" + ''; + binds = [ + { map = ["index" "pager"]; key = "x"; action = "modify-labels"; } + { map = ["index" "pager"]; key = "i"; action = "noop"; } + { map = ["index" "pager"]; key = "g"; action = "noop"; } + { map = ["index"]; key = "\\Cf"; action = "noop"; } + { map = ["index" "pager"]; key = "M"; action = "noop"; } + { map = ["index" "pager"]; key = "C"; action = "noop"; } + { map = ["index"]; key = "gg"; action = "first-entry"; } + { map = ["index"]; key = "j"; action = "next-entry"; } + { map = ["index"]; key = "k"; action = "previous-entry"; } + { map = ["attach"]; key = ""; action = "view-mailcap"; } + { map = ["attach"]; key = "l"; action = "view-mailcap"; } + { map = ["editor"]; key = ""; action = "noop"; } + { map = ["index"]; key = "G"; action = "last-entry"; } + { map = ["pager" "attach"]; key = "h"; action = "exit"; } + { map = ["pager"]; key = "j"; action = "next-line"; } + { map = ["pager"]; key = "k"; action = "previous-line"; } + { map = ["pager"]; key = "l"; action = "view-attachments"; } + { map = ["index"]; key = "U"; action = "undelete-message"; } + { map = ["index"]; key = "L"; action = "limit"; } + { map = ["index"]; key = "h"; action = "noop"; } + { map = ["index"]; key = "l"; action = "display-message"; } + { map = ["index" "query"]; key = ""; action = "tag-entry"; } + { map = ["index" "pager"]; key = "H"; action = "view-raw-message"; } + { map = ["browser"]; key = "l"; action = "select-entry"; } + { map = ["browser"]; key = "gg"; action = "top-page"; } + { map = ["browser"]; key = "G"; action = "bottom-page"; } + { map = ["pager"]; key = "gg"; action = "top"; } + { map = ["pager"]; key = "G"; action = "bottom"; } + { map = ["index" "pager" "browser"]; key = "d"; action = "half-down"; } + { map = ["index" "pager" "browser"]; key = "u"; action = "half-up"; } + { map = ["index" "pager"]; key = "\\Cr"; action = "group-reply"; } + { map = ["index" "pager"]; key = "R"; action = "group-chat-reply"; } + { map = ["index"]; key = "\031"; action = "previous-undeleted"; } + { map = ["index"]; key = "\005"; action = "next-undeleted"; } + { map = ["pager"]; key = "\031"; action = "previous-line"; } + { map = ["pager"]; key = "\005"; action = "next-line"; } + { map = ["editor"]; key = ""; action = "complete-query"; } + ]; + macros = [ + { map = ["index"]; key = "X"; action = "=Spamy"; } + { map = ["index"]; key = "A"; action = "+archive -unread -inboxz^'z"; } + { map = ["index"]; key = "h"; action = "z^'z"; } + { map = ["index"]; key = "D"; action = ""; } + { map = ["index" "pager"]; key = "S"; action = "!notmuch-hook &"; } + { map = ["index"]; key = "c"; action = "?"; } + { map = ["index"]; key = "\\\\"; action = ""; } + { map = ["browser"]; key = "h"; action = ".."; } + ]; + }; +} diff --git a/profiles/email/notmuch.nix b/profiles/email/notmuch.nix new file mode 100644 index 0000000..3b182c7 --- /dev/null +++ b/profiles/email/notmuch.nix @@ -0,0 +1,22 @@ +{ + inputs, + config, + pkgs, + ... +}: { + programs.notmuch = { + enable = true; + new = { + tags = ["new"]; + ignore = [".mbsyncstate" ".uidvalidity"]; + }; + search.excludeTags = ["deleted" "spam"]; + maildir.synchronizeFlags = true; + extraConfig = { + database.path = "${config.xdg.dataHome}/mail"; + user.name = "Mike Vink"; + user.primary_email = "mike1994vink@gmail.com"; + crypto.gpg_path="gpg"; + }; + }; +} diff --git a/profiles/nix.nix b/profiles/nix.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/profiles/nix.nix @@ -0,0 +1 @@ +{} diff --git a/profiles/station/codeium.nix b/profiles/station/codeium.nix new file mode 100644 index 0000000..f3841b3 --- /dev/null +++ b/profiles/station/codeium.nix @@ -0,0 +1,58 @@ +{ + inputs, + config, + pkgs, + ... +}: let + codeium = with pkgs; stdenv.mkDerivation rec { + pname = "codeium"; + version = "1.1.39"; + + ls-sha = "c8fda9657259bb7f3d432c1b558db921db4257aa"; + + src = fetchurl { + url = "https://github.com/Exafunction/codeium/releases/download/language-server-v${version}/language_server_linux_x64.gz"; + sha256 = "sha256-LA1VVW4X30a8UD9aDUCTmBKVXM7G0WE7dSsZ73TaaVo="; + }; + + nativeBuildInputs = [ + autoPatchelfHook + ]; + + sourceRoot = "."; + + unpackPhase = '' + cp $src language_server_linux_x64.gz + gzip -d language_server_linux_x64.gz + ''; + + installPhase = '' + install -m755 -D language_server_linux_x64 $out + ''; + + preFixup = '' + patchelf \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + $out + ''; + + meta = with lib; { + homepage = "https://www.codeium.com/"; + description = "Codeium language server"; + platforms = platforms.linux; + }; + }; +in { + home.activation = { + # links codeium into place + codium-symlink = inputs.home-manager.lib.hm.dag.entryAfter ["writeBoundary"] '' + CODEIUM_TARGET="${config.home.homeDirectory}/.codeium/bin/c8fda9657259bb7f3d432c1b558db921db4257aa" + if [ -L $CODEIUM_TARGET ] && [ -e $CODEIUM_TARGET ]; then + $DRY_RUN_CMD echo "codeium linked" + else + mkdir -p $CODEIUM_TARGET + $DRY_RUN_CMD ln -sf ${codeium} "$CODEIUM_TARGET/language_server_linux_x64" + fi + ''; + }; +} diff --git a/profiles/station/kak-lsp.toml b/profiles/station/kak-lsp.toml new file mode 100644 index 0000000..b0592cf --- /dev/null +++ b/profiles/station/kak-lsp.toml @@ -0,0 +1,428 @@ +snippet_support = true +verbosity = 2 + +[server] +# exit session if no requests were received during given period in seconds +# set to 0 to disable +timeout = 1800 # seconds = 30 minutes + +[language.bash] +filetypes = ["sh"] +roots = [".git", ".hg"] +command = "bash-language-server" +args = ["start"] + +[language.c_cpp] +filetypes = ["c", "cpp"] +roots = ["compile_commands.json", ".clangd", ".git", ".hg"] +command = "clangd" + +[language.clojure] +filetypes = ["clojure"] +roots = ["project.clj", ".git", ".hg"] +command = "clojure-lsp" +settings_section = "_" +[language.clojure.settings._] +# See https://clojure-lsp.io/settings/#all-settings +# source-paths-ignore-regex = ["resources.*", "target.*"] + +[language.cmake] +filetypes = ["cmake"] +roots = ["CMakeLists.txt", ".git", ".hg"] +command = "cmake-language-server" + +[language.crystal] +filetypes = ["crystal"] +roots = ["shard.yml"] +command = "crystalline" + +[language.css] +filetypes = ["css"] +roots = ["package.json", ".git", ".hg"] +command = "vscode-css-languageserver" +args = ["--stdio"] + +[language.less] +filetypes = ["less"] +roots = ["package.json", ".git", ".hg"] +command = "vscode-css-languageserver" +args = ["--stdio"] + +[language.scss] +filetypes = ["scss"] +roots = ["package.json", ".git", ".hg"] +command = "vscode-css-languageserver" +args = ["--stdio"] + +[language.d] +filetypes = ["d", "di"] +roots = [".git", "dub.sdl", "dub.json"] +command = "dls" + +[language.dart] +# start shell to find path to dart analysis server source +filetypes = ["dart"] +roots = ["pubspec.yaml", ".git", ".hg"] +command = "sh" +args = ["-c", "dart $(dirname $(command -v dart))/snapshots/analysis_server.dart.snapshot --lsp"] + +[language.elixir] +filetypes = ["elixir"] +roots = ["mix.exs"] +command = "elixir-ls" +settings_section = "elixirLS" +[language.elixir.settings.elixirLS] +# See https://github.com/elixir-lsp/elixir-ls/blob/master/apps/language_server/lib/language_server/server.ex +# dialyzerEnable = true + +[language.elm] +filetypes = ["elm"] +roots = ["elm.json"] +command = "elm-language-server" +args = ["--stdio"] +settings_section = "elmLS" +[language.elm.settings.elmLS] +# See https://github.com/elm-tooling/elm-language-server#server-settings +runtime = "node" +elmPath = "elm" +elmFormatPath = "elm-format" +elmTestPath = "elm-test" + +[language.elvish] +filetypes = ["elvish"] +roots = [".git", ".hg"] +command = "elvish" +args = ["-lsp"] + +[language.erlang] +filetypes = ["erlang"] +# See https://github.com/erlang-ls/erlang_ls.git for more information and +# how to configure. This default config should work in most cases though. +roots = ["rebar.config", "erlang.mk", ".git", ".hg"] +command = "erlang_ls" + +[language.go] +filetypes = ["go"] +roots = ["Gopkg.toml", "go.mod", ".git", ".hg"] +command = "gopls" +settings_section = "gopls" +[language.go.settings.gopls] +# See https://github.com/golang/tools/blob/master/gopls/doc/settings.md +# "build.buildFlags" = [] + +[language.haskell] +filetypes = ["haskell"] +roots = ["hie.yaml", "cabal.project", "Setup.hs", "stack.yaml", "*.cabal"] +command = "haskell-language-server-wrapper" +args = ["--lsp"] +settings_section = "_" +[language.haskell.settings._] +# See https://haskell-language-server.readthedocs.io/en/latest/configuration.html +# haskell.formattingProvider = "ormolu" + +[language.html] +filetypes = ["html"] +roots = ["package.json"] +command = "vscode-html-languageserver" +args = ["--stdio"] + +# # Commented out by default because you still need to set the paths in the JDT +# # Language Server arguments below before this can become a valid configuration. +# [language.java] +# filetypes = ["java"] +# roots = [".git", "mvnw", "gradlew"] +# command = "java" +# args = [ +# "-Declipse.application=org.eclipse.jdt.ls.core.id1", +# "-Dosgi.bundles.defaultStartLevel=4", +# "-Declipse.product=org.eclipse.jdt.ls.core.product", +# "-Dlog.level=ALL", +# "-Dfile.encoding=utf-8", +# "--add-modules=ALL-SYSTEM", +# "--add-opens", +# "java.base/java.util=ALL-UNNAMED", +# "--add-opens", +# "java.base/java.lang=ALL-UNNAMED", +# "-noverify", +# "-Xmx1G", +# "-jar", +# "/path/to/eclipse.jdt.ls/repository/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar", +# "-configuration", +# "/path/to/eclipse.jdt.ls/repository/config_linux", +# "-data", +# "/path/to/eclipse-workspace", +# ] +# [language.java.settings] +# # See https://github.dev/eclipse/eclipse.jdt.ls +# # "java.format.insertSpaces" = true + +[language.jsx] # works for javascript as well +filetypes = ["javascript"] +roots = ["package.json", "tsconfig.json", ".git", ".hg"] +command = "typescript-language-server" +args = ["--stdio"] + +[language.json] +filetypes = ["json"] +roots = ["package.json"] +command = "vscode-json-languageserver" +args = ["--stdio"] + +# Requires Julia package "LanguageServer" +# Run: `julia --project=@kak-lsp -e 'import Pkg; Pkg.add("LanguageServer")'` to install it +# Configuration adapted from https://github.com/neovim/nvim-lspconfig/blob/bcebfac7429cd8234960197dca8de1767f3ef5d3/lua/lspconfig/julials.lua +[language.julia] +filetypes = ["julia"] +roots = ["Project.toml", ".git", ".hg"] +command = "julia" +args = [ + "--startup-file=no", + "--history-file=no", + "-e", + """ + ls_install_path = joinpath(get(DEPOT_PATH, 1, joinpath(homedir(), ".julia")), "environments", "kak-lsp"); + pushfirst!(LOAD_PATH, ls_install_path); + using LanguageServer; + popfirst!(LOAD_PATH); + depot_path = get(ENV, "JULIA_DEPOT_PATH", ""); + buffer_file = ENV["kak_buffile"]; + project_path = let + dirname(something( + # 1. Check if there is an explicitly set project + Base.load_path_expand(( + p = get(ENV, "JULIA_PROJECT", nothing); + p === nothing ? nothing : isempty(p) ? nothing : p + )), + # 2. Check for Project.toml in current working directory + Base.current_project(pwd()), + # 3. Check for Project.toml from buffer's full file path excluding the file name + Base.current_project(dirname(buffer_file)), + # 4. Fallback to global environment + Base.active_project() + )) + end + server = LanguageServer.LanguageServerInstance(stdin, stdout, project_path, depot_path); + server.runlinter = true; + run(server); + """, +] +[language.julia.settings] +# See https://github.com/julia-vscode/LanguageServer.jl/blob/master/src/requests/workspace.jl +# Format options. See https://github.com/julia-vscode/DocumentFormat.jl/blob/master/src/DocumentFormat.jl +# "julia.format.indent" = 4 +# Lint options. See https://github.com/julia-vscode/StaticLint.jl/blob/master/src/linting/checks.jl +# "julia.lint.call" = true +# Other options, see https://github.com/julia-vscode/LanguageServer.jl/blob/master/src/requests/workspace.jl +# "julia.lint.run" = "true" + +[language.latex] +filetypes = ["latex"] +roots = [".git", ".hg"] +command = "texlab" +settings_section = "texlab" +[language.latex.settings.texlab] +# See https://github.com/latex-lsp/texlab/wiki/Configuration +# +# Preview configuration for zathura with SyncTeX search. +# For other PDF viewers see https://github.com/latex-lsp/texlab/wiki/Previewing +forwardSearch.executable = "zathura" +forwardSearch.args = [ + "%p", + "--synctex-forward", # Support texlab-forward-search + "%l:1:%f", + "--synctex-editor-command", # Inverse search: use Control+Left-Mouse-Button to jump to source. + """ + sh -c ' + echo " + evaluate-commands -client %opt{texlab_client} %{ + evaluate-commands -try-client %opt{jumpclient} %{ + edit -- %{input} %{line} + } + } + " | kak -p $kak_session + ' + """, +] + +[language.lua] +filetypes = ["lua"] +roots = [".git", ".hg"] +command = "lua-language-server" +[language.lua.settings.Lua] +# See https://github.com/sumneko/vscode-lua/blob/master/setting/schema.json +# diagnostics.enable = true + +[language.nim] +filetypes = ["nim"] +roots = ["*.nimble", ".git", ".hg"] +command = "nimlsp" + +[language.nix] +filetypes = ["nix"] +roots = ["flake.nix", "shell.nix", ".git", ".hg"] +command = "rnix-lsp" + +[language.ocaml] +filetypes = ["ocaml"] +# Often useful to simply do a `touch dune-workspace` in your project root folder if you have problems with root detection +roots = ["dune-workspace", "dune-project", "Makefile", "opam", "*.opam", "esy.json", ".git", ".hg", "dune"] +command = "ocamllsp" + +[language.php] +filetypes = ["php"] +roots = [".htaccess", "composer.json"] +command = "intelephense" +args = ["--stdio"] +settings_section = "intelephense" +[language.php.settings] +intelephense.storagePath = "/tmp/intelephense" + +[language.proto] +filetypes = ["protobuf"] +roots = [".git", ".hg"] +command = "pls" # https://github.com/lasorda/protobuf-language-server + +[language.python] +filetypes = ["python"] +roots = ["requirements.txt", "setup.py", ".git", ".hg"] +command = "pyright-langserver" +args = ["--stdio"] +settings_section = "_" +[language.python.settings.python.analysis] +autoSearchPaths = true +diagnosticMode = "workspace" +useLibraryCodeForTypes = true + + +[language.r] +filetypes = ["r"] +roots = ["DESCRIPTION", ".git", ".hg"] +command = "R" +args = ["--slave", "-e", "languageserver::run()"] + +[language.racket] +filetypes = ["racket"] +roots = ["info.rkt"] +command = "racket" +args = ["-l", "racket-langserver"] + +[language.reason] +filetypes = ["reason"] +roots = ["package.json", "Makefile", ".git", ".hg"] +command = "ocamllsp" + +[language.ruby] +filetypes = ["ruby"] +roots = ["Gemfile"] +command = "solargraph" +args = ["stdio"] +settings_section = "_" +[language.ruby.settings._] +# See https://github.com/castwide/solargraph/blob/master/lib/solargraph/language_server/host.rb +# diagnostics = false + +# [language.rust] +# filetypes = ["rust"] +# roots = ["Cargo.toml"] +# command = "sh" +# args = [ +# "-c", +# """ +# if path=$(rustup which rls 2>/dev/null); then +# "$path" +# else +# rls +# fi +# """, +# ] +# [language.rust.settings.rust] +# # See https://github.com/rust-lang/rls#configuration +# # features = [] + +[language.rust] +filetypes = ["rust"] +roots = ["Cargo.toml"] +command = "sh" +args = [ + "-c", + """ + if path=$(rustup which rust-analyzer 2>/dev/null); then + "$path" + else + rust-analyzer + fi + """, +] +settings_section = "rust-analyzer" +[language.rust.settings.rust-analyzer] +# See https://rust-analyzer.github.io/manual.html#configuration +hoverActions.enable = false # kak-lsp doesn't support this at the moment +# cargo.features = [] + +[language.terraform] +filetypes = ["terraform"] +roots = ["*.tf"] +command = "terraform-ls" +args = ["serve"] +[language.terraform.settings.terraform-ls] +# See https://github.com/hashicorp/terraform-ls/blob/main/docs/SETTINGS.md +# rootModulePaths = [] + +[language.tsx] # works for typescript as well +filetypes = ["typescript"] +roots = ["package.json", "tsconfig.json", ".git", ".hg"] +command = "typescript-language-server" +args = ["--stdio"] + +# [language.typescript] +# filetypes = ["typescript"] +# roots = ["package.json", "tsconfig.json", ".git", ".hg"] +# command = "deno" +# args = ["lsp"] +# [language.typescript.settings.deno] +# enable = true +# lint = true + +[language.yaml] +filetypes = ["yaml"] +roots = [".git", ".hg"] +command = "yaml-language-server" +args = ["--stdio"] +[language.yaml.settings] +# See https://github.com/redhat-developer/yaml-language-server#language-server-settings +# Defaults are at https://github.com/redhat-developer/yaml-language-server/blob/master/src/yamlSettings.ts +# yaml.format.enable = true + +[language.zig] +filetypes = ["zig"] +roots = ["build.zig"] +command = "zls" + +[language.cs] +filetypes = ["cs"] +roots = [".git"] +command = "OmniSharp" +args = ["--encoding", "utf-8", "-z", "--languageserver", "DotNet:enablePackageRestore=false", "FormattingOptions:EnableEditorConfigSupport=true", "Sdk:IncludePrereleases=true"] + +# Semantic tokens support +# See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens +# for the default list of tokens and modifiers. +# However, many language servers implement their own values. +# Make sure to check the output of `lsp-capabilities` and each server's documentation and source code as well. +# Examples: +# - TypeScript: https://github.com/microsoft/vscode-languageserver-node/blob/main/client/src/common/semanticTokens.ts +# - Rust Analyzer: https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/syntax_highlighting.rs +[semantic_tokens] +faces = [ + {face="documentation", token="comment", modifiers=["documentation"]}, + {face="comment", token="comment"}, + {face="function", token="function"}, + {face="keyword", token="keyword"}, + {face="module", token="namespace"}, + {face="operator", token="operator"}, + {face="string", token="string"}, + {face="type", token="type"}, + {face="default+d", token="variable", modifiers=["readonly"]}, + {face="default+d", token="variable", modifiers=["constant"]}, + {face="variable", token="variable"}, +] diff --git a/profiles/station/kakoune.nix b/profiles/station/kakoune.nix new file mode 100644 index 0000000..41caf9f --- /dev/null +++ b/profiles/station/kakoune.nix @@ -0,0 +1,35 @@ +{ + inputs, + flake, + config, + pkgs, + ... +}: + let + kakouneWithPlugins = pkgs.wrapKakoune pkgs.kakoune-unwrapped { configure = { plugins = with pkgs.kakounePlugins; [kak-lsp parinfer-rust]; }; }; + in { + home.packages = [kakouneWithPlugins]; + home.activation = { + kakoune-symlink = inputs.home-manager.lib.hm.dag.entryAfter ["writeBoundary"] '' + KAK_CONFIG="${config.home.homeDirectory}/kakoune" + XDG_CONFIG_HOME_KAK="${config.xdg.configHome}/kak" + if [ -L $XDG_CONFIG_HOME_KAK ] && [ -e $XDG_CONFIG_HOME_KAK ]; then + $DRY_RUN_CMD echo "kakoune linked" + else + $DRY_RUN_CMD ln -s $KAK_CONFIG $XDG_CONFIG_HOME_KAK + fi + rm -rf $XDG_CONFIG_HOME_KAK/autoload/default + ln -sf ${kakouneWithPlugins}/share/kak/autoload $XDG_CONFIG_HOME_KAK/autoload/default + ''; + }; + home.file."${config.xdg.configHome}/kak-lsp/kak-lsp.toml" = { + source = ./kak-lsp.toml; + }; + + #set global windowing_modules "" + #require-module tmux + #require-module tmux-repl + #alias global terminal tmux-terminal-vertical + #alias global sp new + +} diff --git a/profiles/station/meta.nix b/profiles/station/meta.nix new file mode 100644 index 0000000..e6f3a78 --- /dev/null +++ b/profiles/station/meta.nix @@ -0,0 +1,8 @@ +{inputs,lib,config, ...}: with lib; { + lib.meta = { + configPath = "${config.home.homeDirectory}/flake"; + mkMutableSymlink = path: + config.lib.file.mkOutOfStoreSymlink + (config.lib.meta.configPath + removePrefix (toString inputs.self) (toString path)); + }; +} diff --git a/profiles/station/mpv.nix b/profiles/station/mpv.nix new file mode 100644 index 0000000..1b673ab --- /dev/null +++ b/profiles/station/mpv.nix @@ -0,0 +1,47 @@ + +{ + flake, + config, + pkgs, + ... +}: { + programs.mpv = { + enable = true; + scripts = [ + (with pkgs; stdenv.mkDerivation rec { + pname = "mpv-sockets"; + version = "1.0"; + + src = fetchFromGitHub { + owner = "wis"; + repo = "mpvSockets"; + rev = "be9b7ca84456466e54331bab59441ac207659c1c"; + sha256 = "sha256-tcY+cHvkQpVNohZ9yHpVlq0bU7iiKMxeUsO/BRwGzAs="; + }; + + # installFlags = [ "SCRIPTS_DIR=$(out)/share/mpv/scripts" ]; + passthru.scriptName = "mpvSockets.lua"; + installPhase = '' + install -m755 -D mpvSockets.lua $out/share/mpv/scripts/mpvSockets.lua + ''; + + meta = with lib; { + description = "mpvSockets lua module for mpv"; + homepage = "https://github.com/wis/mpvSockets"; + license = licenses.mit; + platforms = platforms.linux; + }; + }) + ]; + config = { + gpu-context = "drm"; + }; + bindings = { + l="seek 5"; + h="seek -5"; + j="seek -60"; + k="seek 60"; + S="cycle sub"; + }; + }; +} diff --git a/profiles/station/neovim.nix b/profiles/station/neovim.nix new file mode 100644 index 0000000..8957c89 --- /dev/null +++ b/profiles/station/neovim.nix @@ -0,0 +1,104 @@ +{ + inputs, + config, + pkgs, + ... +}: { + home.activation = { + # fixes hotpot cannot be found error after updates + clearHotpotCache = inputs.home-manager.lib.hm.dag.entryAfter ["writeBoundary"] '' + HOTPOT_CACHE="${config.xdg.cacheHome}/nvim/hotpot" + if [[ -d "$HOTPOT_CACHE" ]]; then + $DRY_RUN_CMD rm -rf "$VERBOSE_ARG" "$HOTPOT_CACHE" + fi + ''; + }; + + xdg = { + configFile = with config.lib.meta; { + "nvim".source = mkMutableSymlink ../neovim; + }; + }; + + editorconfig = { + enable = true; + settings = { + "*" = { + trim_trailing_whitespace = true; + insert_final_newline = true; + }; + "*.yaml" = { + indent_style = "space"; + indent_size = 2; + }; + }; + }; + + programs.neovim = { + enable = true; + package = pkgs.neovim-unwrapped; + viAlias = true; + vimAlias = true; + extraPackages = with pkgs; [ + bashInteractive + sumneko-lua-language-server + pyright + gopls + fennel + fnlfmt + alejandra + statix + ]; + plugins = with pkgs.vimPlugins; [ + # highlighting + nvim-treesitter.withAllGrammars + nvim-treesitter-context + playground + gruvbox-material + kanagawa-nvim + lsp_lines-nvim + heirline-nvim + gitsigns-nvim + noice-nvim + nui-nvim + vim-helm + + # external + git-worktree-nvim + vim-dirvish + vim-fugitive + vim-dispatch + vim-oscyank + venn-nvim + gv-vim + + # Coding + plenary-nvim + telescope-nvim + nvim-lspconfig + null-ls-nvim + lsp_signature-nvim + omnisharp-extended-lsp-nvim + nvim-dap + nvim-dap-ui + luasnip + vim-test + vim-rest-console + harpoon + + # cmp + nvim-cmp + cmp-cmdline + cmp-nvim-lsp + cmp-buffer + cmp-path + cmp_luasnip + + # trying out lisp + conjure + vim-racket + nvim-parinfer + hotpot-nvim + ]; + }; +} diff --git a/profiles/station/newsboat.nix b/profiles/station/newsboat.nix new file mode 100644 index 0000000..fc47060 --- /dev/null +++ b/profiles/station/newsboat.nix @@ -0,0 +1,83 @@ +{...}: { + programs.newsboat = { + enable = true; + autoReload = true; + urls = [ + {url = "https://github.com/neovim/neovim/releases.atom";} + {url = "https://github.com/rancher/rancher/releases.atom";} + {url = "https://github.com/istio/istio/releases.atom";} + {url = "https://github.com/argoproj/argo-cd/releases.atom";} + {url = "https://github.com/argoproj/argo-cd/releases.atom";} + {url = "https://github.com/kyverno/kyverno/releases.atom";} + {url = "https://github.com/hashicorp/terraform/releases.atom";} + {url = "https://github.com/ansible/ansible/releases.atom";} + {url = "https://github.com/ansible/awx/releases.atom";} + {url = "https://kubeshark.co/rss.xml";} + {url = "https://azurecomcdn.azureedge.net/en-us/updates/feed/?product=azure-devops";} + {url = "https://www.hashicorp.com/blog/categories/products-technology/feed.xml";} + {url = "https://kubernetes.io/feed.xml";} + {url = "https://www.cncf.io/rss";} + {url = "https://blog.alexellis.io/rss/";} + {url = "https://www.openfaas.com/feed";} + {url = "https://istio.io/latest/blog/feed.xml";} + {url = "https://www.youtube.com/feeds/videos.xml?channel_id=UCUyeluBRhGPCW4rPe_UvBZQ";} + ]; + extraConfig = '' + #show-read-feeds no + auto-reload yes + + external-url-viewer "urlscan -dc -r 'linkhandler {}'" + + bind-key j down + bind-key k up + bind-key j next articlelist + bind-key k prev articlelist + bind-key J next-feed articlelist + bind-key K prev-feed articlelist + bind-key G end + bind-key g home + bind-key d pagedown + bind-key u pageup + bind-key l open + bind-key h quit + bind-key a toggle-article-read + bind-key n next-unread + bind-key N prev-unread + bind-key D pb-download + bind-key U show-urls + bind-key x pb-delete + + color listnormal cyan default + color listfocus black yellow standout bold + color listnormal_unread blue default + color listfocus_unread yellow default bold + color info red black bold + color article white default bold + + browser linkhandler + macro , open-in-browser + macro t set browser "qndl" ; open-in-browser ; set browser linkhandler + macro a set browser "tsp yt-dlp --embed-metadata -xic -f bestaudio/best --restrict-filenames" ; open-in-browser ; set browser linkhandler + macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler + macro w set browser "lynx" ; open-in-browser ; set browser linkhandler + macro d set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler + macro c set browser "echo %u | xclip -r -sel c" ; open-in-browser ; set browser linkhandler + macro C set browser "youtube-viewer --comments=%u" ; open-in-browser ; set browser linkhandler + macro p set browser "peertubetorrent %u 480" ; open-in-browser ; set browser linkhandler + macro P set browser "peertubetorrent %u 1080" ; open-in-browser ; set browser linkhandler + + highlight all "---.*---" yellow + highlight feedlist ".*(0/0))" black + highlight article "(^Feed:.*|^Title:.*|^Author:.*)" cyan default bold + highlight article "(^Link:.*|^Date:.*)" default default + highlight article "https?://[^ ]+" green default + highlight article "^(Title):.*$" blue default + highlight article "\\[[0-9][0-9]*\\]" magenta default bold + highlight article "\\[image\\ [0-9]+\\]" green default bold + highlight article "\\[embedded flash: [0-9][0-9]*\\]" green default bold + highlight article ":.*\\(link\\)$" cyan default + highlight article ":.*\\(image\\)$" blue default + highlight article ":.*\\(embedded flash\\)$" magenta default + ''; + }; +} diff --git a/profiles/station/packages.nix b/profiles/station/packages.nix new file mode 100644 index 0000000..02c5b8e --- /dev/null +++ b/profiles/station/packages.nix @@ -0,0 +1,90 @@ +{ + flake, + config, + pkgs, + username, + ... +}: let + core-packages = with pkgs; + [ + # nixopsnixops + age + sops + # k8s and friends + kubernetes-helm + kubectl + kind + krew + jq + yq-go + dasel + initool + python311Packages.editorconfig + gnutls + # other stuff + coreutils + dnsutils + iputils + inetutils + usbutils + gcc + pkgsi686Linux.glibc + gnumake + raylib + gdb + maim + calcurse + profanity + file + lf + ueberzug + mypaint + lynx + pstree + pywal + bashInteractive + k9s + powershell + azure-cli + htop + subversion + ripgrep + gnused + gnugrep + curl + inotify-tools + alejandra + statix + fzf + github-cli + lazygit + fd + argocd + parallel + bc + sxiv + nushell + sent + ] + ++ (import ../shell-scripts.nix {inherit pkgs config;}); + mike-extra-packages = with pkgs; [ + (nerdfonts.override {fonts = ["FiraCode"];}) + noto-fonts + noto-fonts-emoji + docker + k9s + dmenu + librewolf + firefox-wayland + xclip + libreoffice + ]; +in { + home.packages = + core-packages + ++ ( + if (username == "mike") + then mike-extra-packages + else [] + ); +} diff --git a/profiles/station/suckless.nix b/profiles/station/suckless.nix new file mode 100644 index 0000000..d10414d --- /dev/null +++ b/profiles/station/suckless.nix @@ -0,0 +1,73 @@ +{ + flake, + config, + pkgs, + suckless, + ... +}: let +in { + xsession = { + enable = true; + initExtra = '' + ${pkgs.xorg.xmodmap}/bin/xmodmap -e "remove mod1 = Alt_R" + ${pkgs.xorg.xmodmap}/bin/xmodmap -e "add mod3 = Alt_R" + wal -R + dwm + dwmblocks & + ''; + }; + services.picom = { + enable = true; + activeOpacity = 0.99; + inactiveOpacity = 0.7; + opacityRules = [ + "100:class_g = 'dwm'" + "100:name *= 'Firefox'" + "100:name *= 'mpv'" + "100:name *= 'LibreWolf'" + ]; + settings = { + inactive-opacity-override = false; + frame-opacity = 1; + }; + }; + services.dunst = { + enable = true; + settings = { + global = { + monitor = 0; + follow = "keyboard"; + width = 370; + height = 350; + offset = "0x19"; + padding = 2; + horizontal_padding = 2; + transparency = 25; + font = "Monospace 12"; + format = "%s\\n%b"; + }; + urgency_low = { + background = "#1d2021"; + foreground = "#928374"; + timeout = 3; + }; + urgency_normal = { + foreground = "#ebdbb2"; + background = "#458588"; + timeout = 5; + }; + urgency_critical = { + background = "#1cc24d"; + foreground = "#ebdbb2"; + frame_color = "#fabd2f"; + timeout = 10; + }; + }; + }; + home.packages = with pkgs; [ + st + dwm + dwmblocks + libnotify + ]; +} diff --git a/profiles/station/zathura.nix b/profiles/station/zathura.nix new file mode 100644 index 0000000..198f039 --- /dev/null +++ b/profiles/station/zathura.nix @@ -0,0 +1,27 @@ +{ + flake, + config, + pkgs, + ... +}: { + programs.zathura = { + enable = true; + extraConfig = '' + set sandbox none + set statusbar-h-padding 0 + set statusbar-v-padding 0 + set page-padding 1 + set selection-clipboard clipboard + map u scroll half-up + map d scroll half-down + map D toggle_page_mode + map r reload + map R rotate + map K zoom in + map J zoom out + map i recolor + map p print + map g goto top + ''; + }; +} diff --git a/shell-scripts.nix b/shell-scripts.nix deleted file mode 100644 index 3b849e0..0000000 --- a/shell-scripts.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - pkgs, - config, - ... -}: -with builtins; let - script-names = attrNames (readDir ./shell-scripts); - package = ( - filename: - with pkgs; let - in - stdenv.mkDerivation { - name = filename; - - buildCommand = '' - install -Dm755 $script $out/bin/${filename} - ''; - - script = substituteAll { - src = ./shell-scripts/${filename}; - isExecutable = true; - inherit bash; - home = config.home.homeDirectory; - }; - } - ); - packages = map package script-names; -in - packages diff --git a/shell-scripts/checkout b/shell-scripts/checkout deleted file mode 100644 index 95f28c8..0000000 --- a/shell-scripts/checkout +++ /dev/null @@ -1,69 +0,0 @@ -#!@bash@/bin/bash -error () { - echo "$1" - exit 1 -} - -. <(pass show work/env) -DEST_DIR="" -case "${@}" in - az|"az "*) - shift - LIST_PROJECTS="/_apis/projects?api-version=7.1-preview.4" - AUTH_HEADER="Authorization: Basic $(echo -n ":$GIT_PASS" | base64)" - LIST_REPOSITORIES="/_apis/git/repositories?api-version=7.1-preview.1" - GIT_DIR="$HOME/projects/" - if [ ! -d $GIT_DIR ]; then - mkdir -p $GIT_DIR - fi - MAX_REPOS=20 - - echo "curl -s -H \"$AUTH_HEADER\" $WORK_AZDO_GIT_ORG_URL$LIST_PROJECTS" - PROJECT=$(curl -s -H "$AUTH_HEADER" $WORK_AZDO_GIT_ORG_URL$LIST_PROJECTS \ - | jq ' - .value[].name - ' \ - | xargs -I{} bash -c " - curl -s -H '$AUTH_HEADER' $WORK_AZDO_GIT_ORG_URL/{}$LIST_REPOSITORIES \ - | jq ' - .value[].name - ' \ - | awk '{ gsub(/\"/, \"\", \$1); printf \"{}/_git/%s\\n\", \$1 }' - " \ - | fzf) - - DEST_DIR="$GIT_DIR/$(echo $PROJECT | cut -d '/' -f3)" - if [ ! -d $DEST_DIR ] - then - git clone --bare $WORK_AZDO_GIT_ORG_URL/$PROJECT $DEST_DIR - fi - ;; - gh|"gh "*) - shift - repo=$(gh repo list --json owner,name -q '.[] | "\(.owner.login)/\(.name)"' | fzf --print-query -1) - GIT_DIR="$HOME/projects" - if [ ! -d $GIT_DIR ]; then - mkdir -p $GIT_DIR - fi - - if [[ "$(echo "$repo" | wc -l)" -ne 1 ]]; then - echo "Fetching my repo" - repo="$(echo "$repo" | tail -n1)" - fi - - DEST_DIR="$GIT_DIR/$(echo $repo | cut -d '/' -f2)" - if [ ! -d $DEST_DIR ] - then - gh repo clone $repo $DEST_DIR -- --bare - fi - ;; - *) - error "Don't know how to fetch this" - ;; -esac - -if ! [[ -z "$DEST_DIR" ]]; then - cd $DEST_DIR - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" - $EDITOR "$DEST_DIR" -fi diff --git a/shell-scripts/compile b/shell-scripts/compile deleted file mode 100755 index 04c0586..0000000 --- a/shell-scripts/compile +++ /dev/null @@ -1,40 +0,0 @@ -#!@bash@/bin/bash -echo " Compiliiing ${@}" - -error () { - echo "$1" - exit 1 -} - -case "${@}" in - racket*) - shift - echo " \-> racket -l errortrace -t ${@}" - racket -l errortrace -t ${@} - ;; - ansible-lint*) - shift - echo " \-> ansible-lint --profile production --write=all -qq --nocolor" - ansible-lint --profile production --write=all -qq --nocolor ${@} - ;; - ansible-playbook*) - shift - echo " \-> ansible-playbook -e@<(pass)" - ansible-playbook -b -e "{\"ansible_become_pass\":\"$PASSWORD\"}" ${@} - ;; - awx*) - echo " \-> awx" - shift - awx "$@" | filter-ansi - ;; - helm\ lint*) - shift - shift - echo " \-> helm lint --set cluster=debug-cluster --strict --quiet --with-subcharts ${@}" - helm lint --set cluster=debug-cluster --strict --quiet --with-subcharts ${@} | sed -u -E -e "s@$(basename ${PWD})/|error during tpl function execution for \".*\"@@g" - ;; - *) - echo " \-> ${@}" - ${@} - ;; -esac diff --git a/shell-scripts/filter-ansi b/shell-scripts/filter-ansi deleted file mode 100755 index 369f9fd..0000000 --- a/shell-scripts/filter-ansi +++ /dev/null @@ -1,2 +0,0 @@ -# #!@bash@/bin/bash -cat -u - | sed -u -E -e 's/\x1b\[[0-9;]*[mGKHF]|\r//g' diff --git a/shell-scripts/get-sshables b/shell-scripts/get-sshables deleted file mode 100755 index f67c23c..0000000 --- a/shell-scripts/get-sshables +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -euxo pipefail -[[ -d ~/sshables ]] || mkdir -p ~/sshables - -for cluster in $(kubectl config get-clusters | tail -n +2); do - [[ -f ~/sshables/$cluster ]] || { echo $cluster; kubectl --context $cluster get nodes -oname > ~/sshables/$cluster; } -done diff --git a/shell-scripts/kakup b/shell-scripts/kakup deleted file mode 100755 index af1a520..0000000 --- a/shell-scripts/kakup +++ /dev/null @@ -1,100 +0,0 @@ -#!@bash@/bin/bash -session-or-client() { - { - project="$(cat -)" - if [[ -z $project ]]; then - return - fi - pushd $project - name=${PWD#$HOME/} - name=${name//\//-} - name=${name#-} - server=kaks@$name - client=kakc@$name - TMUX_ENV="-e KAK_SERVER=$server -e KAK_CLIENT=$client" - - tmux has-session -t $server || { - tmux new $TMUX_ENV -d -s $server -n $server bash -c '[[ -f .envrc ]] && eval "$(direnv export bash)"; { kak -s '$name' -d & }; tmux wait -S '$name'; wait' - tmux wait "$name" - } - if [[ -z $TMUX ]] || [ $SWITCH_TO_SESSION -eq 1 ]; then - tmux has-session -t $client || tmux new $TMUX_ENV -d -s $client -n $client kak -c $name - fi - popd - } debug 2>&1 - echo $client -} - -search() { - if tty -s - then - project="$(fd -d1 "." -t d $HOME $HOME/projects | fzf -1)" - else - output=$(mktemp -d /tmp/kakup.XXXXXXXX)/fifo - mkfifo ${output} - st -e bash -c "fd -d1 '.' -t d $HOME $HOME/projects | fzf -1 | tee ${output} >/dev/null 2>&1" & - project="$(cat ${output})" - rm -r $(dirname ${output}) - fi - - pushd $project >/dev/null 2>&1 - if grep 'bare = true' config >/dev/null 2>&1 ; then - if tty -s - then - branch="$(git branch -a --format '%(refname)' | fzf -1)" - else - output=$(mktemp -d /tmp/kakup.XXXXXXXX)/fifo - mkfifo ${output} - st -e bash -c "git branch -a --format '%(refname)' | fzf -1 >${output}" & - branch="$(cat ${output})" - rm -r $(dirname ${output}) - fi - echo "$branch" >debug 2>&1 - if [[ "$branch" == "refs/remotes/"* ]]; then - git branch ${branch#refs/remotes/*/} -t $branch >debug 2>&1 - git worktree add ${branch#refs/remotes/*/} ${branch#refs/remotes/*/} >debug 2>&1 - branch="${branch#refs/remotes/*/}" - elif [[ "$branch" == "refs/heads/"* ]]; then - branch="${branch#refs/heads/}" - git worktree add $branch $branch >debug 2>&1 - fi - echo "$project/$branch" - else - echo "$project" - fi - popd >/dev/null 2>&1 -} - -NEW_TERM=0 -SWITCH_TO_SESSION=0 -while getopts "tfF" opt; do - case "$opt" in - h|\?) exit 0 ;; - t) NEW_TERM=1 ;; - f) client="$(search | session-or-client)" ;; - F) SWITCH_TO_SESSION=1; client="$(search | session-or-client)" ;; - esac -done - -shift $((OPTIND - 1)) - -[ -z "$client" ] && { - case "${@}" in - "") client="$(pwd | session-or-client)" ;; - *) client="$(echo "${@}" | session-or-client)" ;; - esac -} - -[[ ! -z "$client" ]] && { - if [ $NEW_TERM -eq 1 ]; then - st -e tmux attach -t "$client" - elif [[ -z $TMUX ]]; then - tmux attach -t "$client" - else - if [ $SWITCH_TO_SESSION -eq 0 ]; then - tmux new-window -n $client kak -c ${client##kakc@} - else - tmux switch -t $client - fi - fi -} diff --git a/shell-scripts/kubeconfig-merge b/shell-scripts/kubeconfig-merge deleted file mode 100644 index 73d3ac1..0000000 --- a/shell-scripts/kubeconfig-merge +++ /dev/null @@ -1,3 +0,0 @@ -#!@bash@/bin/bash -cp $HOME/.kube/config /tmp/.kube_config -KUBECONFIG=$1:/tmp/.kube_config kubectl config view --flatten > $HOME/.kube/config diff --git a/shell-scripts/lfub b/shell-scripts/lfub deleted file mode 100644 index 9012f50..0000000 --- a/shell-scripts/lfub +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# This is a wrapper script for lb that allows it to create image previews with -# ueberzug. This works in concert with the lf configuration file and the -# lf-cleaner script. - -set -e - -cleanup() { - exec 3>&- - rm "$FIFO_UEBERZUG" -} - -if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then - lf "$@" -else - [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf" - export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$" - mkfifo "$FIFO_UEBERZUG" - ueberzug layer -s <"$FIFO_UEBERZUG" -p json & - exec 3>"$FIFO_UEBERZUG" - trap cleanup HUP INT QUIT TERM PWR EXIT - lf "$@" 3>&- -fi diff --git a/shell-scripts/linkhandler b/shell-scripts/linkhandler deleted file mode 100755 index f62b581..0000000 --- a/shell-scripts/linkhandler +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# Feed script a url or file location. -# If an image, it will view in sxiv, -# if a video or gif, it will view in mpv -# if a music file or pdf, it will download, -# otherwise it opens link in browser. - -if [ -z "$1" ]; then - url="$(xclip -o)" -else - url="$1" -fi - -case "$url" in - *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) - setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;; - *png|*jpg|*jpe|*jpeg|*gif) - curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; - *pdf|*cbz|*cbr) - curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; - *mp3|*flac|*opus|*mp3?source*) - qndl "$url" 'curl -LO' >/dev/null 2>&1 ;; - *) - [ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1 -esac diff --git a/shell-scripts/mailsync b/shell-scripts/mailsync deleted file mode 100644 index 426e5b7..0000000 --- a/shell-scripts/mailsync +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/sh - -# - Syncs mail for all accounts, or a single account given as an argument. -# - Displays a notification showing the number of new mails. -# - Displays a notification for each new mail with its subject displayed. -# - Runs notmuch to index new mail. -# - This script can be set up as a cron job for automated mail syncing. - -# There are many arbitrary and ugly features in this script because it is -# inherently difficult to pass environmental variables to cronjobs and other -# issues. It also should at least be compatible with Linux (and maybe BSD) with -# Xorg and MacOS as well. - -# Run only if not already running in other instance -pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;} - -# First, we have to get the right variables for the mbsync file, the pass -# archive, notmuch and the GPG home. This is done by searching common profile -# files for variable assignments. This is ugly, but there are few options that -# will work on the maximum number of machines. -eval "$(grep -h -- \ - "^\s*\(export \)\?\(MBSYNCRC\|MPOPRC\|PASSWORD_STORE_DIR\|PASSWORD_STORE_GPG_OPTS\|NOTMUCH_CONFIG\|GNUPGHOME\|MAILSYNC_MUTE\|XDG_CONFIG_HOME\|XDG_DATA_HOME\)=" \ - "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ - "$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ - "$HOME/.pam_environment" 2>/dev/null)" - -export GPG_TTY="$(tty)" - -[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" -[ -n "$MPOPRC" ] || MPOPRC="$HOME/.config/mpop/config" - -lastrun="${XDG_CONFIG_HOME:-$HOME/.config}/neomutt/.mailsynclastrun" - -# Settings are different for MacOS (Darwin) systems. -case "$(uname)" in - Darwin) notify() { osascript -e "display notification \"$2\" with title \"$1\"" ;} ;; - *) - case "$(readlink -f /sbin/init)" in - *systemd*|*openrc*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; - esac - # remember if a display server is running since `ps` doesn't always contain a display - pgrepoutput="$(pgrep -ax X\(\|org\|wayland\))" - displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" - [ -z "$displays" ] && [ -d /tmp/.X11-unix ] && displays=$(cd /tmp/.X11-unix && for x in X*; do echo ":${x#X}"; done) - - notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do - export DISPLAY="$x" - notify-send --app-name="mutt-wizard" "$1" "$2" - done ;} - ;; -esac - -# Check account for new mail. Notify if there is new content. -syncandnotify() { - case "$1" in - imap) mbsync -q "$2" ;; - pop) mpop -q "$2" ;; - esac - new=$(find\ - "$HOME/.local/share/mail/${2%%-*}/"[Ii][Nn][Bb][Oo][Xx]/new/ \ - "$HOME/.local/share/mail/${2%%-*}/"[Ii][Nn][Bb][Oo][Xx]/cur/ \ - -type f -newer "$lastrun" 2> /dev/null) - newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) - case 1 in - $((newcount > 5)) ) - echo "$newcount new mail for $2." - [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "πŸ“¬ $newcount new mail(s) in \`$2\` account." - ;; - $((newcount > 0)) ) - echo "$newcount new mail for $2." - [ -z "$MAILSYNC_MUTE" ] && - for file in $new; do - # Extract and decode subject and sender from mail. - subject="$(sed -n "/^Subject:/ s|Subject: *|| p" "$file" | - perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" - from="$(sed -n "/^From:/ s|From: *|| p" "$file" | - perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" - from="${from% *}" ; from="${from%\"}" ; from="${from#\"}" - notify "πŸ“§$from:" "$subject" - done - ;; - *) echo "No new mail for $2." ;; -esac -} - -allgroups="$(grep -hs "Group" "$MBSYNCRC" "$MPOPRC" | sort -u)" - -# Get accounts to sync. All if no argument. Prefix with `error` if non-existent. -IFS=' -' -if [ -z "$1" ]; then - tosync="$allgroups" -else - tosync="$(for arg in "$@"; do for grp in $allgroups; do - [ "$arg" = "${grp##* }" ] && echo "$grp" && break - done || echo "error $arg"; done)" -fi - -for grp in $tosync; do - case $grp in - Group*) syncandnotify imap "${grp##* }" & ;; - account*) syncandnotify pop "${grp##* }" & ;; - error*) echo "ERROR: Account ${channelt##* } not found." ;; - esac -done - -wait - -notmuch-hook - -#Create a touch file that indicates the time of the last run of mailsync -touch "$lastrun" diff --git a/shell-scripts/maimpick b/shell-scripts/maimpick deleted file mode 100644 index 5de26c1..0000000 --- a/shell-scripts/maimpick +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# This is bound to Shift+PrintScreen by default, requires maim. It lets you -# choose the kind of screenshot to take, including copying the image or even -# highlighting an area to copy. scrotcucks on suicidewatch right now. - -# variables -output="$(date '+%y%m%d-%H%M-%S').png" -xclip_cmd="xclip -sel clip -t image/png" - -case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in - "a selected area") maim -u -s pic-selected-"${output}" ;; - "current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;; - "full screen") maim -q -d 0.2 pic-full-"${output}" ;; - "a selected area (copy)") maim -u -s | ${xclip_cmd} ;; - "current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;; - "full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;; -esac diff --git a/shell-scripts/news b/shell-scripts/news deleted file mode 100755 index 097582b..0000000 --- a/shell-scripts/news +++ /dev/null @@ -1,5 +0,0 @@ -#!@bash@/bin/bash -cat <(cat ~/.config/newsboat/urls) <(for url in $(env | grep NEWSBOAT_URL_); do - printf '%s\n' ${url#NEWSBOAT_URL_*=} -done) > ~/.newsboat-urls -newsboat -u ~/.newsboat-urls diff --git a/shell-scripts/nixup b/shell-scripts/nixup deleted file mode 100755 index afbe4b1..0000000 --- a/shell-scripts/nixup +++ /dev/null @@ -1,94 +0,0 @@ -#!@bash@/bin/bash -case "${@}" in - bootstrap-store) - [[ -d ${HOME}/nix ]] || { - docker create --name nix-data-${USER} nixos/nix sh >/dev/null 2>&1 - sudo docker cp nix-data-${USER}:/nix ~ - docker rm nix-data-${USER} - } - docker create -v ${HOME}/nix:/nix --name nix-data-${USER} nixos/nix sh - ;; - nuke) - docker rm nix-data-${USER} - docker rm nixos-${USER} - ;; - "") - if ! docker image ls | grep nixos-${USER}; then - cat > /tmp/docker-build-${USER} < /etc/nsswitch.conf - -# Download Nix and install it into the system. -ARG NIX_VERSION=2.3.14 -RUN wget https://nixos.org/releases/nix/nix-\${NIX_VERSION}/nix-\${NIX_VERSION}-\$(uname -m)-linux.tar.xz \ - && tar xf nix-\${NIX_VERSION}-\$(uname -m)-linux.tar.xz \ - && addgroup -g 30000 -S nixbld \ - && for i in \$(seq 1 30); do adduser -S -D -h /var/empty -g "Nix build user \$i" -u \$((30000 + i)) -G nixbld nixbld\$i ; done \ - && mkdir -m 0755 /etc/nix \ - && echo 'sandbox = false' > /etc/nix/nix.conf \ - && mkdir -m 0755 /nix && USER=root sh nix-\${NIX_VERSION}-\$(uname -m)-linux/install \ - && ln -s /nix/var/nix/profiles/default/etc/profile.d/nix.sh /etc/profile.d/ \ - && rm -r /nix-\${NIX_VERSION}-\$(uname -m)-linux* \ - && /nix/var/nix/profiles/default/bin/nix-collect-garbage --delete-old \ - && /nix/var/nix/profiles/default/bin/nix-store --optimise \ - && /nix/var/nix/profiles/default/bin/nix-store --verify --check-contents - -# Somehow this file is missing? -RUN mkdir -p /etc/bash && touch /etc/bash/bashrc - -ONBUILD ENV \ - ENV=/etc/profile \ - USER=root \ - PATH=/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin \ - GIT_SSL_CAINFO=/etc/ssl/certs/ca-certificates.crt \ - NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt - -ENV \ - ENV=/etc/profile \ - USER=root \ - PATH=/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin \ - GIT_SSL_CAINFO=/etc/ssl/certs/ca-certificates.crt \ - NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \ - NIX_PATH=/nix/var/nix/profiles/per-user/root/channels - -# Add your user the alpine way -RUN apk add --no-cache --update shadow \ - && groupadd -g $(getent group docker | cut -d: -f3) docker \ - && groupadd -g $(id -g) ${USER} \ - && useradd -g $(id -g) --groups wheel,docker -u $(id -u) ${USER} \ - && rm -rf /var/cache/apk/* -EOF - docker build . -t nixos-${USER} -f /tmp/docker-build-${USER} - fi - docker run --volumes-from=nix-data-${USER} --rm -it \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v /etc/kube:/etc/kube \ - -v /etc/ssl/certs/ca-bundle.crt:/etc/ssl/certs/ca-bundle.crt \ - -v /etc/ssl/certs/ca-bundle.crt:/etc/ssl/certs/ca-certificates.crt \ - -e GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt \ - -e NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt \ - -e SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt \ - -e no_proxy=$no_proxy \ - -e http_proxy=$http_proxy \ - -e https_proxy=$http_proxy \ - -e SHELL=bash \ - -e USER=${USER} \ - -u $(id -u):$(id -g) \ - --group-add wheel \ - --group-add docker \ - -v ${HOME}:${HOME} \ - -w ${HOME} \ - --name nixos-${USER} \ - --network host \ - nixos-${USER} bash --login - ;; - clear) - docker run --rm --volumes-from=nix-data-${USER} nixos/nix nix-collect-garbage -d - ;; - list) - docker run --rm --volumes-from nix-data-${USER} nixos/nix ls -la /nix - ;; -esac diff --git a/shell-scripts/notmuch-hook b/shell-scripts/notmuch-hook deleted file mode 100644 index da376b6..0000000 --- a/shell-scripts/notmuch-hook +++ /dev/null @@ -1,17 +0,0 @@ -. <(pass show personal/notmuch) -notmuch new --quiet -notmuch tag -new +unread +jobs -- 'tag:new and (from:jobs-listings* or from:jobs-noreply*)' -notmuch tag -new +unread +houses -- 'tag:new and (from:"'$MAKELAAR'" or thread:{'$MAKELAAR'})' -notmuch tag -new -inbox +unread +dev -- 'tag:new and (from:/.*github.com/ or thread:{from:/.*github.com/})' - -notmuch tag -new +inbox +unread -- tag:new - -# Gmail + mbsync = a lot of duplicates due to the archive -notmuch tag -new -inbox +archive -- 'folder:/Archive/ -folder:/Inbox/ -folder:/\[Gmail\]/ -folder:/FarDrafts/ -folder:/Important/ -folder:/Sent/' - -# Tag messages with files that were moved to trash in neomutt -notmuch tag --remove-all +trash -- folder:/Trash/ -# Same but with messages with files that were moved to spam -notmuch tag --remove-all +spam -- folder:/Spam/ -# Remove files of messages that were tagged but still have files left behind in the mailbox, should be fine since gmail already keeps a duplicate in the Archive so the message will not be deleted only one file of the message -notmuch search --output=files -- 'folder:/Inbox/ -tag:inbox' | grep Inbox | xargs >/dev/null 2>&1 rm diff --git a/shell-scripts/openfile b/shell-scripts/openfile deleted file mode 100644 index 0f60b10..0000000 --- a/shell-scripts/openfile +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Helps open a file with xdg-open from mutt in a external program without weird side effects. -tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" -file="$tempdir/${1##*/}" -[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" -mkdir -p "$tempdir" -cp -f "$1" "$file" -$opener "$file" >/dev/null 2>&1 -find "${tempdir:?}" -mtime +1 -type f -delete diff --git a/shell-scripts/pass-ansible-vault-client b/shell-scripts/pass-ansible-vault-client deleted file mode 100755 index 8b8d026..0000000 --- a/shell-scripts/pass-ansible-vault-client +++ /dev/null @@ -1,17 +0,0 @@ -#!@bash@/bin/bash -VAULT_ID="" -while [[ $# -gt 0 ]]; do - case $1 in - --vault-id) - VAULT_ID=$2 - shift - shift - ;; - --vault-id=*) - VAULT_ID="${1#*=}" - shift - ;; - esac -done - -pass show work/ansible-vault/$VAULT_ID diff --git a/shell-scripts/sb-battery b/shell-scripts/sb-battery deleted file mode 100644 index aeb7413..0000000 --- a/shell-scripts/sb-battery +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -# Prints all batteries, their percentage remaining and an emoji corresponding -# to charge status (πŸ”Œ for plugged up, πŸ”‹ for discharging on battery, etc.). - -case $BUTTON in - 3) notify-send "πŸ”‹ Battery module" "πŸ”‹: discharging -πŸ›‘: not charging -β™»: stagnant charge -πŸ”Œ: charging -⚑: charged -❗: battery very low! -- Scroll to change adjust xbacklight." ;; - 4) xbacklight -inc 10 ;; - 5) xbacklight -dec 10 ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -# Loop through all attached batteries and format the info -for battery in /sys/class/power_supply/BAT?*; do - # If non-first battery, print a space separator. - [ -n "${capacity+x}" ] && printf " " - # Sets up the status and capacity - case "$(cat "$battery/status" 2>&1)" in - "Full") status="⚑" ;; - "Discharging") status="πŸ”‹" ;; - "Charging") status="πŸ”Œ" ;; - "Not charging") status="πŸ›‘" ;; - "Unknown") status="♻️" ;; - *) exit 1 ;; - esac - capacity="$(cat "$battery/capacity" 2>&1)" - # Will make a warn variable if discharging and low - [ "$status" = "πŸ”‹" ] && [ "$capacity" -le 25 ] && warn="❗" - # Prints the info - printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn -done && printf "\\n" diff --git a/shell-scripts/sb-clock b/shell-scripts/sb-clock deleted file mode 100644 index ba9e43d..0000000 --- a/shell-scripts/sb-clock +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -clock=$(date '+%I') - -case "$clock" in - "00") icon="πŸ•›" ;; - "01") icon="πŸ•" ;; - "02") icon="πŸ•‘" ;; - "03") icon="πŸ•’" ;; - "04") icon="πŸ•“" ;; - "05") icon="πŸ•”" ;; - "06") icon="πŸ••" ;; - "07") icon="πŸ•–" ;; - "08") icon="πŸ•—" ;; - "09") icon="πŸ•˜" ;; - "10") icon="πŸ•™" ;; - "11") icon="πŸ•š" ;; - "12") icon="πŸ•›" ;; -esac - -case $BUTTON in - 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m//;s|..0m||")" && notify-send "Appointments" "$(calcurse -d3)" ;; - 2) setsid -f "$TERMINAL" -e calcurse ;; - 3) notify-send "πŸ“… Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` -- Middle click opens calcurse if installed" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -date "+%Y %b %d (%a) $icon%I:%M%p" diff --git a/shell-scripts/sb-internet b/shell-scripts/sb-internet deleted file mode 100644 index 225d376..0000000 --- a/shell-scripts/sb-internet +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# Show wifi πŸ“Ά and percent strength or πŸ“‘ if none. -# Show 🌐 if connected to ethernet or ❎ if none. -# Show πŸ”’ if a vpn connection is active - -case $BUTTON in - 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; - 3) notify-send "🌐 Internet module" "\- Click to connect -❌: wifi disabled -πŸ“‘: no wifi connection -πŸ“Ά: wifi connection with quality -❎: no ethernet -🌐: ethernet working -πŸ”’: vpn is active -" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then - wifiicon="$(awk '/^\s*w/ { print "πŸ“Ά", int($3 * 100 / 70) "% " }' /proc/net/wireless)" -elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then - grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="πŸ“‘ " || wifiicon="❌ " -fi - -printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/πŸ”’/" /sys/class/net/tun*/operstate 2>/dev/null)" diff --git a/shell-scripts/sb-mailbox b/shell-scripts/sb-mailbox deleted file mode 100644 index ab1669e..0000000 --- a/shell-scripts/sb-mailbox +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Displays number of unread mail and an loading icon if updating. -# When clicked, brings up `neomutt`. - -case $BUTTON in - 1) setsid -f "$TERMINAL" -e neomutt ;; - 2) setsid -f mailsync >/dev/null ;; - 3) notify-send "πŸ“¬ Mail module" "\- Shows unread mail -- Shows πŸ”ƒ if syncing mail -- Left click opens neomutt -- Middle click syncs mail" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" - -pidof mbsync >/dev/null 2>&1 && icon="πŸ”ƒ" - -[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "πŸ“¬$unread$icon" diff --git a/shell-scripts/sb-nettraf b/shell-scripts/sb-nettraf deleted file mode 100644 index 06b3c49..0000000 --- a/shell-scripts/sb-nettraf +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# Module showing network traffic. Shows how much data has been received (RX) or -# transmitted (TX) since the previous time this script ran. So if run every -# second, gives network traffic per second. - -case $BUTTON in - 1) setsid -f "$TERMINAL" -e bmon ;; - 3) notify-send "🌐 Network traffic module" "πŸ”»: Traffic received -πŸ”Ί: Traffic transmitted" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -update() { - sum=0 - for arg; do - read -r i < "$arg" - sum=$(( sum + i )) - done - cache=/tmp/${1##*/} - [ -f "$cache" ] && read -r old < "$cache" || old=0 - printf %d\\n "$sum" > "$cache" - printf %d\\n $(( sum - old )) -} - -rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) -tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) - -printf "πŸ”»%4sB πŸ”Ί%4sB\\n" $(numfmt --to=iec $rx $tx) diff --git a/shell-scripts/sb-news b/shell-scripts/sb-news deleted file mode 100644 index a155c0a..0000000 --- a/shell-scripts/sb-news +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Displays number of unread news items and an loading icon if updating. -# When clicked, brings up `newsboat`. - -case $BUTTON in - 1) setsid "$TERMINAL" -e newsboat ;; - 2) setsid -f newsup >/dev/null exit ;; - 3) notify-send "πŸ“° News module" "\- Shows unread news items -- Shows πŸ”ƒ if updating with \`newsup\` -- Left click opens newsboat -- Middle click syncs RSS feeds -Note: Only one instance of newsboat (including updates) may be running at a time." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - - cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "πŸ“°" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)" diff --git a/shell-scripts/set-bg b/shell-scripts/set-bg deleted file mode 100644 index bede726..0000000 --- a/shell-scripts/set-bg +++ /dev/null @@ -1,15 +0,0 @@ -#!@bash@/bin/bash -reload=0 -while getopts "r" opt; do - case "$opt" in - h|\?) exit 0 ;; - r) reload=1 ;; - esac -done -if [ $reload -eq 1 ]; then - # (cat ~/.cache/wal/sequences &) - wal -R -else - sxiv -tob ~/bg | parallel wal -i -fi -kak -l | parallel '<<< "colorscheme wal" kak -p {}' diff --git a/shell-scripts/spectrwmbar b/shell-scripts/spectrwmbar deleted file mode 100644 index a106b01..0000000 --- a/shell-scripts/spectrwmbar +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env sh -# script for spectrwm status bar - -trap 'update' 5 - -fgcolors=("+@fg=1;" "+@fg=2;" "+@fg=3;" "+@fg=4;" "+@fg=5;" "+@fg=6;" "+@fg=7;" "+@fg=8;") -nfgcolors=${#fgcolors[@]} - -SLEEP_SEC=5m - -repeat() { - i=0; while [ $i -lt $1 ] - do - echo -ne "$TOKEN" - i=$(( i + 1 )) - done -} - -cpu() { - read cpu a b c previdle rest < /proc/stat - prevtotal=$((a+b+c+previdle)) - sleep 0.5 - read cpu a b c idle rest < /proc/stat - total=$((a+b+c+idle)) - cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) )) - echo -e "CPU: $cpu%" -} - -battery() { - BATTERY="$(cat /sys/class/power_supply/BAT0/capacity)" - - BAR_LEFT=$BATTERY - BATTERY_BAR="" - BLOCK=$(( 100 / nfgcolors )) - TOKEN=$(printf '\u2588') - - BAT_COL=$(( $nfgcolors -1 )) - #loops forever outputting a line every SLEEP_SEC secs - while [ $(( BAR_LEFT - BLOCK )) -gt 0 ] - do - BATTERY_BAR="${fgcolors[$BAT_COL]}$(repeat $BLOCK)${BATTERY_BAR}" - BAR_LEFT=$(( BAR_LEFT - BLOCK )) - BAT_COL=$(( BAT_COL - 1)) - done - - BATTERY_BAR="BATTERY: ${fgcolors[$BAT_COL]}$(repeat $BAR_LEFT)${BATTERY_BAR}" - echo $BATTERY_BAR -} - -update() { - echo "$(cpu) $(battery)" - wait -} - -while :; do - update - sleep $SLEEP_SEC & - wait -done diff --git a/shell-scripts/sysact b/shell-scripts/sysact deleted file mode 100755 index 4bb92dc..0000000 --- a/shell-scripts/sysact +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# A dmenu wrapper script for system functions. -export WM="dwm" -ctl='systemctl' - -wmpid(){ # This function is needed if there are multiple instances of the window manager. - echo "$(pidof dwm)" -} - -case "$(printf "πŸ”’ lock\nπŸšͺ leave $WM\n♻️ renew $WM\n🐻 hibernate\nπŸ”ƒ reboot\nπŸ–₯️shutdown\nπŸ’€ sleep\nπŸ“Ί display off" | dmenu -i -p 'Action: ')" in - 'πŸ”’ lock') slock ;; - "πŸšͺ leave $WM") kill -TERM "$(wmpid)" ;; - "♻️ renew $WM") kill -HUP "$(wmpid)" ;; - '🐻 hibernate') slock $ctl hibernate -i ;; - 'πŸ’€ sleep') slock $ctl suspend -i ;; - 'πŸ”ƒ reboot') $ctl reboot -i ;; - 'πŸ–₯️shutdown') $ctl poweroff -i ;; - 'πŸ“Ί display off') xset dpms force off ;; - *) exit 1 ;; -esac diff --git a/shell-scripts/terragrunt b/shell-scripts/terragrunt deleted file mode 100755 index 38918e8..0000000 --- a/shell-scripts/terragrunt +++ /dev/null @@ -1,94 +0,0 @@ -#!@bash@/bin/bash -TERRAGRUNT_ARGS=() -CONTEXT="" -ENV="" -MODULE="" -FULL=0 -while [[ $# -gt 0 ]]; do - case $1 in - -full) - FULL=1 - shift - ;; - -m|--module-path) - MODULE="$2" - shift - shift - ;; - -m=*|--module-path=*) - MODULE="${1#*=}" - shift - ;; - -e|--env) - ABS_ENV="$2" - CONTEXT=${ABS_ENV%/*} - ENV=${ABS_ENV#*/} - shift - shift - ;; - -e=*|--env=*) - ABS_ENV="${1#*=}" - CONTEXT=${ABS_ENV%/*} - ENV=${ABS_ENV#*/} - shift - ;; - *|-*) - TERRAGRUNT_ARGS+=("$1") - shift - esac -done - -TTY="" -case ${TERRAGRUNT_ARGS[0]} in - plan) - TERRAGRUNT_ARGS+=(-no-color -compact-warnings) - ;; - apply|destroy) - TTY="-t" - for arg in $TERRAGRUNT_ARGS; do - if [[ $arg -eq "gruntplan" ]]; then - TTY="" - fi - done - TERRAGRUNT_ARGS+=(-no-color -compact-warnings) - ;; - init) - TERRAGRUNT_ARGS+=(-no-color -compact-warnings) - ;; -esac - -VARIABLES="" -REPO="${PWD}" -TERRAGRUNT_EXTRA_MOUNTS="" -for var in $(pass show work/env) -do - case $var in - TERRAGRUNT_EXTRA_MOUNTS*) - TERRAGRUNT_EXTRA_MOUNTS="$TERRAGRUNT_EXTRA_MOUNTS ${var#*=}" - ;; - *) - VARIABLES="$VARIABLES$(printf ' -e %s' "$var")" - ;; - esac -done - -for var in $(printenv) -do - case $var in - TF_*) - VARIABLES="$VARIABLES$(printf ' -e %s' $var)" - ;; - esac -done - -ENVIRONMENTS="$REPO/environments" -WORKDIR="$ENVIRONMENTS/$ENV/$MODULE" - -# TODO(mike): how to do concise mode | grep -E '(^.*[#~+-] .*|^[[:punct:]]|Plan)' -# TODO(mike): check expiry of azure directory -echo "docker run --rm -i $TTY $VARIABLES -v $HOME/.terragrunt-cache:/tmp -v $HOME/.azure:/root/.azure -v $HOME/.netrc:/root/.netrc $TERRAGRUNT_EXTRA_MOUNTS -v ${REPO}:${REPO} -w ${WORKDIR} $TERRAGRUNT_CONTAINER terragrunt ${TERRAGRUNT_ARGS[@]} | filter-ansi | grep --line-buffered -E '(^ .*[#~+-] .*|^[[:punct:]]|^Plan.*|^\S.*)'" -if [[ $FULL -eq 0 ]]; then - docker run --rm -i $TTY $VARIABLES -v $HOME/.terragrunt-cache:/tmp -v $HOME/.azure:/root/.azure -v $HOME/.netrc:/root/.netrc $TERRAGRUNT_EXTRA_MOUNTS -v ${REPO}:${REPO} -w ${WORKDIR} $TERRAGRUNT_CONTAINER terragrunt ${TERRAGRUNT_ARGS[@]} | filter-ansi | grep --line-buffered -E '(^ .*[#~+-] .*|^[[:punct:]]|^Plan.*|^\S.*)' -else - docker run --rm -i $TTY $VARIABLES -v $HOME/.terragrunt-cache:/tmp -v $HOME/.azure:/root/.azure -v $HOME/.netrc:/root/.netrc $TERRAGRUNT_EXTRA_MOUNTS -v ${REPO}:${REPO} -w ${WORKDIR} $TERRAGRUNT_CONTAINER terragrunt ${TERRAGRUNT_ARGS[@]} | filter-ansi -fi diff --git a/shell-scripts/tmux-normal-mode b/shell-scripts/tmux-normal-mode deleted file mode 100644 index 5730017..0000000 --- a/shell-scripts/tmux-normal-mode +++ /dev/null @@ -1,28 +0,0 @@ - # Make our own copy-mode with Kakoune! - # cursor_y=$(tmux display-message -t "''${pane_id}" -p "#{cursor_y}") ;\ - # cursor_x=$(tmux display-message -t "''${pane_id}" -p "#{cursor_x}") ;\ - # pane_height=$(tmux display-message -t "''${pane_id}" -p "#{pane_height}") ;\ - # line_count="$(wc -l "$file" |awk "{print \$1}")" ;\ - # sel_line=$(( line_count - ( pane_height - cursor_y ) + 1 )) ;\ - # printf "sel = %s\n" "$line_count" >>/tmp/debug.log ;\ - # cursor="''${sel_line}.''${cursor_x},''${sel_line}.''${cursor_x}" ;\ - # printf "cursor = %s\n" "$cursor" >>/tmp/debug.log - -kakoune_session="$(tmux display-message -p "#{window_name}" | sed "s/kakc@//")" -dispatch_name="dispatch://$(tmux display-message -p "#{pane_start_command}")" -case "${@}" in - '') - output=$(mktemp -d /tmp/kak-tmux.XXXXXXXX)/fifo - mkfifo ${output} - ( tmux capture-pane -S '-' -E '-' -J -e -p -t $TMUX_PANE | filter-ansi >${output} & ) - tmux new-window -t kaks@$kakoune_session -n "$dispatch_name" -d " - kak -c '$kakoune_session' -e \"edit -fifo ${output} '${dispatch_name}';\ - set-option buffer readonly true ;\ - set-option window filetype dispatch ;\ - hook -always -once buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } }\"" - tmux swap-pane -s kaks@$kakoune_session:"$dispatch_name".0 -t : - ;; - --quit) - tmux break-pane -t kaks@$kakoune_session -a -d -n "$dispatch_name" - ;; -esac diff --git a/shell-scripts/transadd b/shell-scripts/transadd deleted file mode 100644 index a598fad..0000000 --- a/shell-scripts/transadd +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running. - -# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep. - -pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}") - -transmission-remote -a "$@" && notify-send "πŸ”½ Torrent added." diff --git a/signed.txt b/signed.txt deleted file mode 100644 index e5ee920..0000000 --- a/signed.txt +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA512 - -test message string ------BEGIN PGP SIGNATURE----- - -iQIzBAEBCgAdFiEEZEPiBfFrOLTcspamK6IYQ5k48SgFAmSjBIQACgkQK6IYQ5k4 -8ShT6Q/6AlvJQ4+7bNUTanYsm1i1coAwedVYhtys2IJEZ39U1mBp7s23NqntB8fB -huZasAfK0uOyfD263/RxVLKit2iKQRd5SzdbNIlUCHW2M+a8ueJwe+rYanIz8zLD -cr5ykWgB6RTgVRLZTK0R1Nk3j2ojlW3N9VmtiUnEAq7aSbzk0071edRvKSw4g6vJ -E8BrbE8SuhreYVtceiyLUp8w1XKosSVafbD2hhNe+MPCgjVJwVs82f2PzEs8OOSP -omQw/fLO51gnBx1Si0b37M5Ye+6Q9CAA9AY61+U3MumBQTKVpwL/XEvRgioXmBPY -tvqkD4PON7SjxLKI33daVgitBDeoweZ93NwBHGQ9neWLjSVbkl4fzrjw3MU3dDc5 -w/RjqAiaTdFb/MJ/kgUdj6xAi81JRh/rcHFfwF16gqRiaqgJG1CQrCYGtq13O+Ik -EtsCbQcgzhBQonrFgFNc881YABnXKpFnFR+Xuq1zRryxdyOyqFrQ8qV1WPIck00E -6hd/qFUdnVDulf9jzRmDer5yo916g/8KXMsWP45XXvoEL/5weI5kalCJbQl6k/xu -89RNwu4uJzWFKER1JAQvTC6vzI7D4f6OKc+uCyy5lNq0iuEx9xzDxdaHPaGAgYgv -5tB6TPfiixnHayj2P5svcmZxTGxk7X5cJ8cUtcIBz9dLg2FasrU= -=Xa80 ------END PGP SIGNATURE----- diff --git a/yubikey-installer.nix b/yubikey-installer.nix deleted file mode 100644 index 7c8a428..0000000 --- a/yubikey-installer.nix +++ /dev/null @@ -1,171 +0,0 @@ -# yubikey-installer.nix -let - configuration = { config, lib, pkgs, ... }: - with pkgs; - let - src = fetchGit "https://github.com/drduh/YubiKey-Guide"; - - guide = "${src}/README.md"; - - contrib = "${src}/contrib"; - - drduhConfig = fetchGit "https://github.com/drduh/config"; - - gpg-conf = "${drduhConfig}/gpg.conf"; - - xserverCfg = config.services.xserver; - - pinentryFlavour = if xserverCfg.desktopManager.lxqt.enable || xserverCfg.desktopManager.plasma5.enable then - "qt" - else if xserverCfg.desktopManager.xfce.enable then - "gtk2" - else if xserverCfg.enable || config.programs.sway.enable then - "gnome3" - else - "curses"; - - # Instead of hard-coding the pinentry program, chose the appropriate one - # based on the environment of the image the user has chosen to build. - gpg-agent-conf = runCommand "gpg-agent.conf" {} '' - sed '/pinentry-program/d' ${drduhConfig}/gpg-agent.conf > $out - echo "pinentry-program ${pinentry.${pinentryFlavour}}/bin/pinentry" >> $out - ''; - - view-yubikey-guide = writeShellScriptBin "view-yubikey-guide" '' - viewer="$(type -P xdg-open || true)" - if [ -z "$viewer" ]; then - viewer="${glow}/bin/glow -p" - fi - exec $viewer "${guide}" - ''; - - shortcut = makeDesktopItem { - name = "yubikey-guide"; - icon = "${yubikey-manager-qt}/share/ykman-gui/icons/ykman.png"; - desktopName = "drduh's YubiKey Guide"; - genericName = "Guide to using YubiKey for GPG and SSH"; - comment = "Open the guide in a reader program"; - categories = [ "Documentation" ]; - exec = "${view-yubikey-guide}/bin/view-yubikey-guide"; - }; - - yubikey-guide = symlinkJoin { - name = "yubikey-guide"; - paths = [ view-yubikey-guide shortcut ]; - }; - - in { - nixpkgs.config = { allowBroken = true; }; - - isoImage.isoBaseName = lib.mkForce "nixos-yubikey"; - # Uncomment this to disable compression and speed up image creation time - #isoImage.squashfsCompression = "gzip -Xcompression-level 1"; - - boot.kernelPackages = linuxPackages_latest; - # Always copytoram so that, if the image is booted from, e.g., a - # USB stick, nothing is mistakenly written to persistent storage. - boot.kernelParams = [ "copytoram" ]; - # Secure defaults - boot.cleanTmpDir = true; - boot.kernel.sysctl = { "kernel.unprivileged_bpf_disabled" = 1; }; - - services.pcscd.enable = true; - services.udev.packages = [ yubikey-personalization ]; - - programs = { - ssh.startAgent = false; - gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - }; - - environment.systemPackages = [ - # Tools for backing up keys - paperkey - pgpdump - parted - cryptsetup - - # Yubico's official tools - yubikey-manager - yubikey-manager-qt - yubikey-personalization - yubikey-personalization-gui - yubico-piv-tool - yubioath-desktop - - # Testing - ent - (haskell.lib.justStaticExecutables haskellPackages.hopenpgp-tools) - - # Password generation tools - diceware - pwgen - - # Miscellaneous tools that might be useful beyond the scope of the guide - cfssl - pcsctools - - # This guide itself (run `view-yubikey-guide` on the terminal to open it - # in a non-graphical environment). - yubikey-guide - ]; - - # Disable networking so the system is air-gapped - # Comment all of these lines out if you'll need internet access - boot.initrd.network.enable = false; - networking.dhcpcd.enable = false; - networking.dhcpcd.allowInterfaces = []; - networking.interfaces = {}; - networking.firewall.enable = true; - networking.useDHCP = false; - networking.useNetworkd = false; - networking.wireless.enable = false; - networking.networkmanager.enable = lib.mkForce false; - - # Unset history so it's never stored - # Set GNUPGHOME to an ephemeral location and configure GPG with the - # guide's recommended settings. - environment.interactiveShellInit = '' - unset HISTFILE - export GNUPGHOME="/run/user/$(id -u)/gnupg" - if [ ! -d "$GNUPGHOME" ]; then - echo "Creating \$GNUPGHOME…" - install --verbose -m=0700 --directory="$GNUPGHOME" - fi - [ ! -f "$GNUPGHOME/gpg.conf" ] && cp --verbose ${gpg-conf} "$GNUPGHOME/gpg.conf" - [ ! -f "$GNUPGHOME/gpg-agent.conf" ] && cp --verbose ${gpg-agent-conf} "$GNUPGHOME/gpg-agent.conf" - echo "\$GNUPGHOME is \"$GNUPGHOME\"" - ''; - - # Copy the contents of contrib to the home directory, add a shortcut to - # the guide on the desktop, and link to the whole repo in the documents - # folder. - system.activationScripts.yubikeyGuide = let - homeDir = "/home/nixos/"; - desktopDir = homeDir + "Desktop/"; - documentsDir = homeDir + "Documents/"; - in '' - mkdir -p ${desktopDir} ${documentsDir} - chown nixos ${homeDir} ${desktopDir} ${documentsDir} - - cp -R ${contrib}/* ${homeDir} - ln -sf ${yubikey-guide}/share/applications/yubikey-guide.desktop ${desktopDir} - ln -sfT ${src} ${documentsDir}/YubiKey-Guide - ''; - }; - - nixos = import { - inherit configuration; - supportedSystems = [ "x86_64-linux" ]; - }; - - # Choose the one you like: - #nixos-yubikey = nixos.iso_minimal; # No graphical environment - #nixos-yubikey = nixos.iso_gnome; - nixos-yubikey = nixos.iso_plasma5; - -in { - inherit nixos-yubikey; -} -- cgit v1.2.3