summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-09-27 21:26:02 +0200
committerMike Vink <mike1994vink@gmail.com>2023-09-27 21:26:02 +0200
commit654ec06ab6a885ea851c4cbf68d06a00b41b0e14 (patch)
treea588832b91c4506ad92f4f20beec1f5865e116ac
parentca986b8407391a6a89c26cf159da42ac26578049 (diff)
seq keep fix
-rw-r--r--debug2
-rw-r--r--emacs/init.el154
-rw-r--r--email/gmail.nix74
-rw-r--r--email/mailsync.nix3
-rw-r--r--email/neomutt.nix3
-rw-r--r--email/notmuch.nix3
-rw-r--r--flake.lock30
-rw-r--r--flake.nix32
-rw-r--r--home.nix21
-rw-r--r--home/codeium.nix5
-rw-r--r--home/kakoune.nix4
-rw-r--r--home/meta.nix8
-rw-r--r--home/mpv.nix1
-rw-r--r--home/neovim.nix21
-rw-r--r--home/packages.nix4
l---------installer1
-rw-r--r--lib/default.nix15
-rw-r--r--modules/nix.nix1
-rw-r--r--neovim/README.md2
-rw-r--r--neovim/compiler/ansible-lint.vim11
-rw-r--r--neovim/compiler/go-test.vim14
-rw-r--r--neovim/compiler/helm.vim14
-rw-r--r--neovim/compiler/racket.vim26
-rw-r--r--neovim/compiler/terragrunt.vim21
-rw-r--r--neovim/debug8
-rw-r--r--neovim/fnl/conf/diagnostic.fnl16
-rw-r--r--neovim/fnl/conf/events.fnl32
-rw-r--r--neovim/fnl/conf/filetype.fnl44
-rw-r--r--neovim/fnl/conf/init.fnl172
-rw-r--r--neovim/fnl/conf/lsp.fnl75
-rw-r--r--neovim/fnl/conf/macros.fnl45
-rw-r--r--neovim/fnl/conf/newtab/init.fnl36
-rw-r--r--neovim/fnl/conf/nix-develop/init.fnl122
-rw-r--r--neovim/fnl/conf/pkgs.fnl15
-rw-r--r--neovim/fnl/conf/pkgs/cmp.fnl114
-rw-r--r--neovim/fnl/conf/pkgs/conjure.fnl17
-rw-r--r--neovim/fnl/conf/pkgs/dap.fnl78
-rw-r--r--neovim/fnl/conf/pkgs/gitsigns.fnl2
-rw-r--r--neovim/fnl/conf/pkgs/harpoon.fnl39
-rw-r--r--neovim/fnl/conf/pkgs/heirline.fnl241
-rw-r--r--neovim/fnl/conf/pkgs/lsp_lines.fnl2
-rw-r--r--neovim/fnl/conf/pkgs/lsp_signature.fnl3
-rw-r--r--neovim/fnl/conf/pkgs/lspconfig.fnl51
-rw-r--r--neovim/fnl/conf/pkgs/neotest.fnl4
-rw-r--r--neovim/fnl/conf/pkgs/noice.fnl34
-rw-r--r--neovim/fnl/conf/pkgs/null-ls.fnl21
-rw-r--r--neovim/fnl/conf/pkgs/test.fnl9
-rw-r--r--neovim/fnl/conf/pkgs/tree-sitter-context.fnl2
-rw-r--r--neovim/fnl/conf/pkgs/treesitter.fnl2
-rw-r--r--neovim/fnl/conf/pkgs/venn.fnl18
-rw-r--r--neovim/fnl/conf/settings.fnl69
-rw-r--r--neovim/fnl/conf/wict-nvim/builder.fnl99
-rw-r--r--neovim/fnl/conf/wict-nvim/effects.fnl81
-rw-r--r--neovim/fnl/conf/wict-nvim/frames/frame.fnl61
-rw-r--r--neovim/fnl/conf/wict-nvim/frames/vec.fnl28
-rw-r--r--neovim/fnl/conf/wict-nvim/init.fnl31
-rw-r--r--neovim/fnl/conf/wictl-nvim/init.fnl58
-rw-r--r--neovim/fnl/conf/wictl-nvim/resolvers.fnl5
-rw-r--r--neovim/fnl/conf/wictl-nvim/term.fnl54
-rw-r--r--neovim/init.fnl36
-rw-r--r--neovim/init.lua46
-rw-r--r--neovim/test.py (renamed from home/fennel-language-server.nix)0
-rw-r--r--overlays/#vimPlugins.nix#53
l---------overlays/.#vimPlugins.nix1
-rw-r--r--shell-scripts/notmuch-hook8
-rw-r--r--signed.txt20
-rw-r--r--yubikey-installer.nix171
67 files changed, 2407 insertions, 86 deletions
diff --git a/debug b/debug
deleted file mode 100644
index d270b3d..0000000
--- a/debug
+++ /dev/null
@@ -1,2 +0,0 @@
-~/flake ~/flake
-~/flake
diff --git a/emacs/init.el b/emacs/init.el
new file mode 100644
index 0000000..0d4f33d
--- /dev/null
+++ b/emacs/init.el
@@ -0,0 +1,154 @@
+;; 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
index 43be078..760532b 100644
--- a/email/gmail.nix
+++ b/email/gmail.nix
@@ -1,8 +1,7 @@
{
- flake,
+ inputs,
config,
pkgs,
- home-manager,
...
}: {
accounts.email = {
@@ -22,9 +21,10 @@
neomutt = {
enable = true;
sendMailCommand = "msmtp -a gmail";
- mailboxName = "=== gmail ===";
+ mailboxName = "=== mike1994vink ===";
extraConfig = ''
set spoolfile='Inbox'
+ unvirtual-mailboxes *
'';
};
mbsync = {
@@ -49,14 +49,66 @@
neomutt = {
enable = true;
virtualMailboxes = [
- { name = "Inbox"; query = "tag:inbox"; }
- { name = "Archive"; query = "tag:archive"; }
- { name = "Sent"; query = "tag:sent"; }
- { name = "Spam"; query = "tag:spam"; }
- { name = "Trash"; query = "tag:trash"; }
- { name = "Jobs"; query = "tag:jobs"; }
- { name = "Houses"; query = "tag:houses"; }
- { name = "Development"; query = "tag:dev"; }
+ { 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
index 3280f19..3fcb0c5 100644
--- a/email/mailsync.nix
+++ b/email/mailsync.nix
@@ -1,8 +1,7 @@
{
- flake,
+ inputs,
config,
pkgs,
- home-manager,
...
}: {
programs.mbsync = {
diff --git a/email/neomutt.nix b/email/neomutt.nix
index 4c3b366..384173f 100644
--- a/email/neomutt.nix
+++ b/email/neomutt.nix
@@ -1,8 +1,7 @@
{
- flake,
+ inputs,
config,
pkgs,
- home-manager,
...
}: {
programs.msmtp = {
diff --git a/email/notmuch.nix b/email/notmuch.nix
index fbafcbc..3b182c7 100644
--- a/email/notmuch.nix
+++ b/email/notmuch.nix
@@ -1,8 +1,7 @@
{
- flake,
+ inputs,
config,
pkgs,
- home-manager,
...
}: {
programs.notmuch = {
diff --git a/flake.lock b/flake.lock
index cfcee72..0b63960 100644
--- a/flake.lock
+++ b/flake.lock
@@ -7,11 +7,11 @@
]
},
"locked": {
- "lastModified": 1687647343,
- "narHash": "sha256-1/o/i9KEFOBdlF9Cs04kBcqDFbYMt6W4SMqGa+QnnaI=",
+ "lastModified": 1695738267,
+ "narHash": "sha256-LTNAbTQ96xSj17xBfsFrFS9i56U2BMLpD0BduhrsVkU=",
"owner": "nix-community",
"repo": "home-manager",
- "rev": "0ee5ab611dc1fbb5180bd7d88d2aeb7841a4d179",
+ "rev": "0f4e5b4999fd6a42ece5da8a3a2439a50e48e486",
"type": "github"
},
"original": {
@@ -38,11 +38,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1687502512,
- "narHash": "sha256-dBL/01TayOSZYxtY4cMXuNCBk8UMLoqRZA+94xiFpJA=",
+ "lastModified": 1695644571,
+ "narHash": "sha256-asS9dCCdlt1lPq0DLwkVBbVoEKuEuz+Zi3DG7pR/RxA=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "3ae20aa58a6c0d1ca95c9b11f59a2d12eebc511f",
+ "rev": "6500b4580c2a1f3d0f980d32d285739d8e156d92",
"type": "github"
},
"original": {
@@ -70,11 +70,11 @@
},
"nixpkgs-stable_2": {
"locked": {
- "lastModified": 1687031877,
- "narHash": "sha256-yMFcVeI+kZ6KD2QBrFPNsvBrLq2Gt//D0baHByMrjFY=",
+ "lastModified": 1694908564,
+ "narHash": "sha256-ducA98AuWWJu5oUElIzN24Q22WlO8bOfixGzBgzYdVc=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "e2e2059d19668dab1744301b8b0e821e3aae9c99",
+ "rev": "596611941a74be176b98aeba9328aa9d01b8b322",
"type": "github"
},
"original": {
@@ -86,11 +86,11 @@
},
"nixpkgs_2": {
"locked": {
- "lastModified": 1686979235,
- "narHash": "sha256-gBlBtk+KrezFkfMrZw6uwTuA7YWtbFciiS14mEoTCo0=",
+ "lastModified": 1694760568,
+ "narHash": "sha256-3G07BiXrp2YQKxdcdms22MUx6spc6A++MSePtatCYuI=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "7cc30fd5372ddafb3373c318507d9932bd74aafe",
+ "rev": "46688f8eb5cd6f1298d873d4d2b9cf245e09e88e",
"type": "github"
},
"original": {
@@ -115,11 +115,11 @@
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
- "lastModified": 1687398569,
- "narHash": "sha256-e/umuIKFcFtZtWeX369Hbdt9r+GQ48moDmlTcyHWL28=",
+ "lastModified": 1695284550,
+ "narHash": "sha256-z9fz/wz9qo9XePEvdduf+sBNeoI9QG8NJKl5ssA8Xl4=",
"owner": "Mic92",
"repo": "sops-nix",
- "rev": "2ff6973350682f8d16371f8c071a304b8067f192",
+ "rev": "2f375ed8702b0d8ee2430885059d5e7975e38f78",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index 335a92d..a304694 100644
--- a/flake.nix
+++ b/flake.nix
@@ -9,7 +9,7 @@
home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; };
};
- outputs = {
+ outputs = inputs@{
self,
nixpkgs,
mvinkio,
@@ -27,7 +27,6 @@
overlay = nixpkgs.lib.composeManyExtensions [
(import ./overlays/vimPlugins.nix {inherit pkgs;})
(import ./overlays/suckless.nix {inherit pkgs home;})
- # (import ./overlays/fennel-language-server.nix {inherit pkgs;})
];
pkgs = import nixpkgs {
@@ -37,7 +36,11 @@
inherit system;
};
- in {
+ 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];
@@ -45,23 +48,14 @@
homeConfigurations.mike = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
- modules = [
- ./home.nix
- ./home/suckless.nix
- ./home/neovim.nix
- ./home/codeium.nix
- ./home/packages.nix
- ./home/newsboat.nix
- ./home/kakoune.nix
- ./home/mpv.nix
- ./home/zathura.nix
- ./email/gmail.nix
- ./email/mailsync.nix
- ./email/neomutt.nix
- ./email/notmuch.nix
- ];
+ modules =
+ (attrValues
+ (attrsets.mergeAttrsList [
+ (modulesIn ./home)
+ (modulesIn ./email)
+ ])) ++ [./home.nix];
extraSpecialArgs = {
- inherit home-manager username email;
+ inherit inputs username email;
};
};
diff --git a/home.nix b/home.nix
index 56f97c0..7b3b97c 100644
--- a/home.nix
+++ b/home.nix
@@ -13,6 +13,9 @@
fonts.fontconfig.enable = true;
xdg = {
enable = true;
+ configFile = with config.lib.meta; {
+ "emacs/init.el".source = mkMutableSymlink ./emacs/init.el;
+ };
mimeApps = {
enable = true;
defaultApplications = {
@@ -46,15 +49,15 @@
};
};
-# programs.ssh = {
-# enable = true;
-# matchBlocks = {
-# "*" = {
-# identityFile = "${config.home.homeDirectory}/.ssh/id_ed25519";
-# };
-# };
-# };
-#
+ programs.ssh = {
+ enable = true;
+ matchBlocks = {
+ "*" = {
+ identityFile = "${config.home.homeDirectory}/.ssh/id_ed25519";
+ };
+ };
+ };
+
home.sessionVariables = {
EDITOR = "kak";
TERMINAL = "st";
diff --git a/home/codeium.nix b/home/codeium.nix
index f29f389..f3841b3 100644
--- a/home/codeium.nix
+++ b/home/codeium.nix
@@ -1,8 +1,7 @@
{
- flake,
+ inputs,
config,
pkgs,
- home-manager,
...
}: let
codeium = with pkgs; stdenv.mkDerivation rec {
@@ -46,7 +45,7 @@
in {
home.activation = {
# links codeium into place
- codium-symlink = home-manager.lib.hm.dag.entryAfter ["writeBoundary"] ''
+ 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"
diff --git a/home/kakoune.nix b/home/kakoune.nix
index dba1f25..41caf9f 100644
--- a/home/kakoune.nix
+++ b/home/kakoune.nix
@@ -1,8 +1,8 @@
{
+ inputs,
flake,
config,
pkgs,
- home-manager,
...
}:
let
@@ -10,7 +10,7 @@
in {
home.packages = [kakouneWithPlugins];
home.activation = {
- kakoune-symlink = home-manager.lib.hm.dag.entryAfter ["writeBoundary"] ''
+ 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
diff --git a/home/meta.nix b/home/meta.nix
new file mode 100644
index 0000000..e6f3a78
--- /dev/null
+++ b/home/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/home/mpv.nix b/home/mpv.nix
index 689cc75..1b673ab 100644
--- a/home/mpv.nix
+++ b/home/mpv.nix
@@ -3,7 +3,6 @@
flake,
config,
pkgs,
- home-manager,
...
}: {
programs.mpv = {
diff --git a/home/neovim.nix b/home/neovim.nix
index 1fbbf40..8957c89 100644
--- a/home/neovim.nix
+++ b/home/neovim.nix
@@ -1,23 +1,12 @@
{
- flake,
+ inputs,
config,
pkgs,
- home-manager,
...
}: {
home.activation = {
- # links neovim repo to xdg config home
- neovim-symlink = home-manager.lib.hm.dag.entryAfter ["writeBoundary"] ''
- NEOVIM_CONFIG="${config.home.homeDirectory}/neovim"
- XDG_CONFIG_HOME_NVIM="${config.xdg.configHome}/nvim"
- if [ -L $XDG_CONFIG_HOME_NVIM ] && [ -e $XDG_CONFIG_HOME_NVIM ]; then
- $DRY_RUN_CMD echo "neovim linked"
- else
- $DRY_RUN_CMD ln -s $NEOVIM_CONFIG $XDG_CONFIG_HOME_NVIM
- fi
- '';
# fixes hotpot cannot be found error after updates
- clearHotpotCache = home-manager.lib.hm.dag.entryAfter ["writeBoundary"] ''
+ 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"
@@ -25,6 +14,12 @@
'';
};
+ xdg = {
+ configFile = with config.lib.meta; {
+ "nvim".source = mkMutableSymlink ../neovim;
+ };
+ };
+
editorconfig = {
enable = true;
settings = {
diff --git a/home/packages.nix b/home/packages.nix
index 0d3cec1..02c5b8e 100644
--- a/home/packages.nix
+++ b/home/packages.nix
@@ -2,7 +2,6 @@
flake,
config,
pkgs,
- home-manager,
username,
...
}: let
@@ -29,6 +28,8 @@
inetutils
usbutils
gcc
+ pkgsi686Linux.glibc
+ gnumake
raylib
gdb
maim
@@ -37,6 +38,7 @@
file
lf
ueberzug
+ mypaint
lynx
pstree
pywal
diff --git a/installer b/installer
new file mode 120000
index 0000000..5743a7f
--- /dev/null
+++ b/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/lib/default.nix b/lib/default.nix
new file mode 100644
index 0000000..56348bb
--- /dev/null
+++ b/lib/default.nix
@@ -0,0 +1,15 @@
+lib: prev: with lib; {
+ modulesIn = dir: pipe dir [
+ builtins.readDir
+ (mapAttrsToList (name: type:
+ if type == "regular" && hasSuffix ".nix" name && name != "default.nix" then
+ [ { name = removeSuffix ".nix" name; value = dir + "/${name}"; } ]
+ else if type == "directory" && pathExists (dir + "/${name}/default.nix") then
+ [ { inherit name; value = dir + "/${name}"; } ]
+ else
+ []
+ ))
+ concatLists
+ listToAttrs
+ ];
+}
diff --git a/modules/nix.nix b/modules/nix.nix
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/modules/nix.nix
@@ -0,0 +1 @@
+{}
diff --git a/neovim/README.md b/neovim/README.md
new file mode 100644
index 0000000..3a441bd
--- /dev/null
+++ b/neovim/README.md
@@ -0,0 +1,2 @@
+# mike_neovim
+installs my neovim config on mac or linux
diff --git a/neovim/compiler/ansible-lint.vim b/neovim/compiler/ansible-lint.vim
new file mode 100644
index 0000000..9427092
--- /dev/null
+++ b/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 <args>
+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
new file mode 100644
index 0000000..61442e5
--- /dev/null
+++ b/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 <args>
+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
new file mode 100644
index 0000000..7e4b21d
--- /dev/null
+++ b/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 <args>
+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
new file mode 100644
index 0000000..1f98a41
--- /dev/null
+++ b/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 <args>
+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
new file mode 100644
index 0000000..54f94ef
--- /dev/null
+++ b/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 <args>
+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
new file mode 100644
index 0000000..6319340
--- /dev/null
+++ b/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/neovim/fnl/conf/diagnostic.fnl b/neovim/fnl/conf/diagnostic.fnl
new file mode 100644
index 0000000..7ef1dd3
--- /dev/null
+++ b/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 :<leader>ge (fn []
+ (vim.diagnostic.open_float)))
+
+(vim.diagnostic.config {:virtual_text false})
+
+(vim.keymap.set :n :<Leader>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
new file mode 100644
index 0000000..00d75d4
--- /dev/null
+++ b/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 <buffer> <C-p>")
+ :group "conf#events"})
diff --git a/neovim/fnl/conf/filetype.fnl b/neovim/fnl/conf/filetype.fnl
new file mode 100644
index 0000000..29f64b0
--- /dev/null
+++ b/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/neovim/fnl/conf/init.fnl b/neovim/fnl/conf/init.fnl
new file mode 100644
index 0000000..90bc20c
--- /dev/null
+++ b/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 :<c-s> "<c-\\><c-n>")
+ ;; pausing and continueing printing output is not necessary inside neovim terminal right?
+ (map :t :<c-q> "<c-\\><c-n>:q<cr>")
+ (map :n :<leader>qo ":copen<cr>")
+ (map :n :<leader>qc ":cclose<cr>")
+ (map :n :<leader>lo ":lopen<cr>")
+ (map :n :<leader>lc ":lclose<cr>")
+ (map :n "[q" ":cprevious<cr>")
+ (map :n "]q" ":cnext<cr>")
+ (map :n "[x" ":lprevious<cr>")
+ (map :n "]x" ":lnext<cr>")
+ (map :n :<c-p> ":Telescope find_files<cr>" {:noremap true})
+ (map :n "`<Backspace>" ":FocusDispatch ")
+ (map :n "`k" ":K9s ")
+ (map :n "`s" ":Ssh ")
+ (map :n :<leader>p ":NewTab<cr>")
+ (map :n :<leader>cf ":tabedit ~/flake|tc ~/flake|G<cr><c-w>o")
+ (map :n :<leader>cn ":tabedit ~/neovim|tc ~/neovim|G<cr><c-w>o"))
+
+(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] :<leader>w
+ (fn []
+ (vim.fn.feedkeys ":Worktree switch ")
+ (local cmp (require :cmp))
+ (vim.schedule (fn []
+ (cmp.close)
+ (cmp.complete)))))
+
+(vim.keymap.set [:n] :<leader>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
new file mode 100644
index 0000000..35fa34f
--- /dev/null
+++ b/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 :<leader>gr (lspdo :rename))
+ :signatureHelpProvider (bm :n :<leader>gs (lspdo :signature_help))
+ :definitionProvider (bm :n :<leader>gd (lspdo :definition))
+ :declaration (bm :n :<leader>gD (lspdo :declaration))
+ :implementationProvider (bm :n :<leader>gi (lspdo :implementation))
+ :referencesProvider (bm :n :<leader>gg (lspdo :references))
+ :documentSymbolProvider (bm :n :<leader>gds (lspdo :workspace_symbol))
+ :codeActionProvider (bm :n :<leader>ga (lspdo :code_action))
+ :codeLensProvider (bm :n :<leader>gl
+ (lambda []
+ (vim.lsp.codelens.run)))
+ :hoverProvider (bo :keywordprg ":LspHover")
+ :documentFormattingProvider (if format
+ ((fn []
+ (bo :formatexpr
+ "v:lua.vim.lsp.format()")
+ (bm :n :<leader>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
new file mode 100644
index 0000000..9ce8b26
--- /dev/null
+++ b/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/neovim/fnl/conf/newtab/init.fnl b/neovim/fnl/conf/newtab/init.fnl
new file mode 100644
index 0000000..fbf8e18
--- /dev/null
+++ b/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/neovim/fnl/conf/nix-develop/init.fnl b/neovim/fnl/conf/nix-develop/init.fnl
new file mode 100644
index 0000000..0983e06
--- /dev/null
+++ b/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/neovim/fnl/conf/pkgs.fnl b/neovim/fnl/conf/pkgs.fnl
new file mode 100644
index 0000000..1445454
--- /dev/null
+++ b/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/neovim/fnl/conf/pkgs/cmp.fnl b/neovim/fnl/conf/pkgs/cmp.fnl
new file mode 100644
index 0000000..76319f4
--- /dev/null
+++ b/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 {:<Tab> (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]))
+ :<S-Tab> (cmp.mapping (fn [fallback]
+ (if (cmp.visible)
+ (cmp.select_prev_item)
+ (luasnip.jumpable -1)
+ (luasnip.jump -1)
+ (fallback))
+ [:i :s]))
+ :<C-b> (cmp.mapping.scroll_docs -4)
+ :<C-f> (cmp.mapping.scroll_docs 4)
+ :<C-j> (cmp.mapping.complete)
+ :<CR> (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 {:<CR> {: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
new file mode 100644
index 0000000..c07a6f4
--- /dev/null
+++ b/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/neovim/fnl/conf/pkgs/dap.fnl b/neovim/fnl/conf/pkgs/dap.fnl
new file mode 100644
index 0000000..6476d3e
--- /dev/null
+++ b/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/neovim/fnl/conf/pkgs/gitsigns.fnl b/neovim/fnl/conf/pkgs/gitsigns.fnl
new file mode 100644
index 0000000..813d410
--- /dev/null
+++ b/neovim/fnl/conf/pkgs/gitsigns.fnl
@@ -0,0 +1,2 @@
+(local gitsigns (require :gitsigns))
+(gitsigns.setup)
diff --git a/neovim/fnl/conf/pkgs/harpoon.fnl b/neovim/fnl/conf/pkgs/harpoon.fnl
new file mode 100644
index 0000000..3f5fc48
--- /dev/null
+++ b/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/neovim/fnl/conf/pkgs/heirline.fnl b/neovim/fnl/conf/pkgs/heirline.fnl
new file mode 100644
index 0000000..c8d9c52
--- /dev/null
+++ b/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/neovim/fnl/conf/pkgs/lsp_lines.fnl b/neovim/fnl/conf/pkgs/lsp_lines.fnl
new file mode 100644
index 0000000..7194bd9
--- /dev/null
+++ b/neovim/fnl/conf/pkgs/lsp_lines.fnl
@@ -0,0 +1,2 @@
+(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
new file mode 100644
index 0000000..7fecc9e
--- /dev/null
+++ b/neovim/fnl/conf/pkgs/lsp_signature.fnl
@@ -0,0 +1,3 @@
+(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
new file mode 100644
index 0000000..accd001
--- /dev/null
+++ b/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/neovim/fnl/conf/pkgs/neotest.fnl b/neovim/fnl/conf/pkgs/neotest.fnl
new file mode 100644
index 0000000..251cdcb
--- /dev/null
+++ b/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/neovim/fnl/conf/pkgs/noice.fnl b/neovim/fnl/conf/pkgs/noice.fnl
new file mode 100644
index 0000000..58ac761
--- /dev/null
+++ b/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/neovim/fnl/conf/pkgs/null-ls.fnl b/neovim/fnl/conf/pkgs/null-ls.fnl
new file mode 100644
index 0000000..9908823
--- /dev/null
+++ b/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/neovim/fnl/conf/pkgs/test.fnl b/neovim/fnl/conf/pkgs/test.fnl
new file mode 100644
index 0000000..4f0bcc4
--- /dev/null
+++ b/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 :<leader>t ":TestNearest<CR>" {:silent true})
+(vim.keymap.set :n :<leader>C ":TestClass<CR>" {:silent true})
+(vim.keymap.set :n :<leader>T ":TestFile<CR>" {:silent true})
+(vim.keymap.set :n :<leader>a ":TestSuite<CR>" {:silent true})
+(vim.keymap.set :n :<leader>l ":TestLast<CR>" {:silent true})
+(vim.keymap.set :n :<leader>g ":TestVisit<CR>" {:silent true})
diff --git a/neovim/fnl/conf/pkgs/tree-sitter-context.fnl b/neovim/fnl/conf/pkgs/tree-sitter-context.fnl
new file mode 100644
index 0000000..12fedc6
--- /dev/null
+++ b/neovim/fnl/conf/pkgs/tree-sitter-context.fnl
@@ -0,0 +1,2 @@
+(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
new file mode 100644
index 0000000..c613be0
--- /dev/null
+++ b/neovim/fnl/conf/pkgs/treesitter.fnl
@@ -0,0 +1,2 @@
+(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
new file mode 100644
index 0000000..064e84e
--- /dev/null
+++ b/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 "<C-v>j:VBox<CR>" {:noremap true :buffer 0})
+ (vim.keymap.set [:n] :K "<C-v>k:VBox<CR>" {:noremap true :buffer 0})
+ (vim.keymap.set [:n] :L "<C-v>l:VBox<CR>" {:noremap true :buffer 0})
+ (vim.keymap.set [:n] :H "<C-v>h:VBox<CR>" {:noremap true :buffer 0}) ; draw a box by pres]sing "f" with visual selection)
+ (vim.keymap.set [:v] :f ":VBox<CR>" {:noremap true :buffer 0}))
+ (do
+ (vim.cmd "setlocal ve=")
+ (vim.cmd "mapclear <buffer>")
+ (set vim.b.venn_enabled nil))))
+
+; toggle keymappings for venn using <leader>v)
+(vim.keymap.set [:n] :<leader>v toggle-venn {:noremap true})
diff --git a/neovim/fnl/conf/settings.fnl b/neovim/fnl/conf/settings.fnl
new file mode 100644
index 0000000..ec68e6c
--- /dev/null
+++ b/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/neovim/fnl/conf/wict-nvim/builder.fnl b/neovim/fnl/conf/wict-nvim/builder.fnl
new file mode 100644
index 0000000..177b773
--- /dev/null
+++ b/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/neovim/fnl/conf/wict-nvim/effects.fnl b/neovim/fnl/conf/wict-nvim/effects.fnl
new file mode 100644
index 0000000..e4321da
--- /dev/null
+++ b/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/neovim/fnl/conf/wict-nvim/frames/frame.fnl b/neovim/fnl/conf/wict-nvim/frames/frame.fnl
new file mode 100644
index 0000000..d32c9b5
--- /dev/null
+++ b/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/neovim/fnl/conf/wict-nvim/frames/vec.fnl b/neovim/fnl/conf/wict-nvim/frames/vec.fnl
new file mode 100644
index 0000000..4a9515d
--- /dev/null
+++ b/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/neovim/fnl/conf/wict-nvim/init.fnl b/neovim/fnl/conf/wict-nvim/init.fnl
new file mode 100644
index 0000000..9e40fad
--- /dev/null
+++ b/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/neovim/fnl/conf/wictl-nvim/init.fnl b/neovim/fnl/conf/wictl-nvim/init.fnl
new file mode 100644
index 0000000..bd04182
--- /dev/null
+++ b/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/neovim/fnl/conf/wictl-nvim/resolvers.fnl b/neovim/fnl/conf/wictl-nvim/resolvers.fnl
new file mode 100644
index 0000000..df5f2ac
--- /dev/null
+++ b/neovim/fnl/conf/wictl-nvim/resolvers.fnl
@@ -0,0 +1,5 @@
+(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
new file mode 100644
index 0000000..51e263a
--- /dev/null
+++ b/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/neovim/init.fnl b/neovim/init.fnl
new file mode 100644
index 0000000..7e82675
--- /dev/null
+++ b/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/neovim/init.lua b/neovim/init.lua
new file mode 100644
index 0000000..3de4446
--- /dev/null
+++ b/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/home/fennel-language-server.nix b/neovim/test.py
index e69de29..e69de29 100644
--- a/home/fennel-language-server.nix
+++ b/neovim/test.py
diff --git a/overlays/#vimPlugins.nix# b/overlays/#vimPlugins.nix#
new file mode 100644
index 0000000..7933c5a
--- /dev/null
+++ b/overlays/#vimPlugins.nix#
@@ -0,0 +1,53 @@
+{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
new file mode 120000
index 0000000..92794ea
--- /dev/null
+++ b/overlays/.#vimPlugins.nix
@@ -0,0 +1 @@
+mike@lemptop.166922:1691484931 \ No newline at end of file
diff --git a/shell-scripts/notmuch-hook b/shell-scripts/notmuch-hook
index ac8a13f..da376b6 100644
--- a/shell-scripts/notmuch-hook
+++ b/shell-scripts/notmuch-hook
@@ -4,14 +4,14 @@ notmuch tag -new +unread +jobs -- 'tag:new and (from:jobs-listings* or from:jobs
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 and path:gmail/Inbox/**
+notmuch tag -new +inbox +unread -- tag:new
# Gmail + mbsync = a lot of duplicates due to the archive
-notmuch tag -new -inbox +archive -- 'path:gmail/Archive/** -path:gmail/Inbox/** -path:gmail/[Gmail]/** -path:gmail/FarDrafts/** -path:gmail/Important/** -path:gmail/Sent/**'
+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 -- path:gmail/Trash/**
+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 -- 'path:gmail/Inbox/** -tag:inbox' | grep Inbox | xargs >/dev/null 2>&1 rm
+notmuch search --output=files -- 'folder:/Inbox/ -tag:inbox' | grep Inbox | xargs >/dev/null 2>&1 rm
diff --git a/signed.txt b/signed.txt
new file mode 100644
index 0000000..e5ee920
--- /dev/null
+++ b/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/yubikey-installer.nix b/yubikey-installer.nix
new file mode 100644
index 0000000..7c8a428
--- /dev/null
+++ b/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 <nixpkgs/nixos/release.nix> {
+ 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;
+}