summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <59492084+ivi-vink@users.noreply.github.com>2024-12-12 22:41:27 +0000
committerMike Vink <59492084+ivi-vink@users.noreply.github.com>2024-12-12 22:41:27 +0000
commitaa5794e7e70b63393043a09a49e16a5f1235aae3 (patch)
treef17a060cc36ae0f4e3d32cc6a17e77589b99170d
parent33e45ed710d478e01db665d4355e9f4b51ecc3c0 (diff)
push again for once
-rwxr-xr-xmut/bin/xdg-open2
-rwxr-xr-xmut/bin/xdg-open-pipe9
l---------mut/lf/icons2
-rw-r--r--mut/neovim/lua/my/events.lua39
-rw-r--r--mut/neovim/lua/my/init.lua176
-rw-r--r--mut/neovim/lua/my/lsp.lua47
-rw-r--r--mut/neovim/lua/my/packages/luasnip.lua5
-rw-r--r--profiles/core/home.nix209
-rw-r--r--profiles/core/neovim.nix6
-rw-r--r--profiles/homeserver/transmission.nix105
-rw-r--r--profiles/vmware-guest.nix88
11 files changed, 467 insertions, 221 deletions
diff --git a/mut/bin/xdg-open b/mut/bin/xdg-open
new file mode 100755
index 0000000..af5b213
--- /dev/null
+++ b/mut/bin/xdg-open
@@ -0,0 +1,2 @@
+#!/bin/bash
+echo "$@" | tee "$HOME/.xdg-open-pipe"
diff --git a/mut/bin/xdg-open-pipe b/mut/bin/xdg-open-pipe
new file mode 100755
index 0000000..7ae22e1
--- /dev/null
+++ b/mut/bin/xdg-open-pipe
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+pipe="$HOME/.xdg-open-pipe"
+rm "$pipe"
+mkfifo "$pipe"
+while true; do
+ {
+ /nix/store/zcw13r2mmpzlnv2yvfl13mcpky3hivq1-system-path/bin/xdg-open "$(cat "$pipe")"
+} >/dev/null 2>&1
+done
diff --git a/mut/lf/icons b/mut/lf/icons
index e313a59..9c21023 120000
--- a/mut/lf/icons
+++ b/mut/lf/icons
@@ -1 +1 @@
-/nix/store/bfam7g4dqxwxkg8lnar25n5b4497ir15-home-manager-files/.config/lf/icons \ No newline at end of file
+/nix/store/lzsjy22l8zq0gagapm0zwgia3di6l66j-home-manager-files/.config/lf/icons \ No newline at end of file
diff --git a/mut/neovim/lua/my/events.lua b/mut/neovim/lua/my/events.lua
index 599c3ae..933ba19 100644
--- a/mut/neovim/lua/my/events.lua
+++ b/mut/neovim/lua/my/events.lua
@@ -67,6 +67,8 @@ event(
})
end})
+-- filetypes
+
event(
"FileType", {
group="conf#events",
@@ -79,3 +81,40 @@ event(
})
end,
})
+
+event(
+ "FileType", {
+ group="conf#events",
+ pattern={ "python" },
+ callback=function(ev)
+ vim.lsp.start({
+ name="basedpyright",
+ cmd={ "basedpyright-langserver", "--stdio" },
+ settings={
+ basedpyright = {
+ analysis = {
+ autoSearchPaths = true,
+ diagnosticMode = "openFilesOnly",
+ useLibraryCodeForTypes = true,
+ autoImportCompletions = true,
+ inlayHints = {
+ variableTypes = true,
+ callArgumentNames = true,
+ functionReturnTypes = true,
+ genericTypes = true,
+ },
+ },
+ },
+ },
+ root_dir=vim.fs.root(ev.buf, {
+ 'pyproject.toml',
+ 'setup.py',
+ 'setup.cfg',
+ 'requirements.txt',
+ 'Pipfile',
+ 'pyrightconfig.json',
+ '.git',
+ })
+ })
+ end,
+ })
diff --git a/mut/neovim/lua/my/init.lua b/mut/neovim/lua/my/init.lua
index 9efb4c8..5be4952 100644
--- a/mut/neovim/lua/my/init.lua
+++ b/mut/neovim/lua/my/init.lua
@@ -211,7 +211,7 @@ end
vim.api.nvim_create_user_command(
"Sh",
function(cmd)
- local thunk = function() qfjob({ "zshcmd", cmd.args }, nil) end
+ local thunk = function() qfjob({ "nu", "--commands", cmd.args }, nil) end
last_job_thunk = thunk
thunk()
end,
@@ -242,6 +242,121 @@ vim.api.nvim_create_user_command(
end
end, {bang=true})
+local browse_git_remote = function(fugitive_data)
+ local path = fugitive_data.path
+ if not path then
+ local bufname = vim.fn.bufname("%")
+ if vim.startswith(bufname,"oil://") then
+ local d = "oil://" .. vim.fs.dirname(fugitive_data.git_dir) .. "/"
+ path = bufname:sub(d:len()+1, bufname:len())
+ end
+ end
+ assert(path)
+
+ local home, org, project, repo = "", ""
+ if vim.startswith(fugitive_data.remote, "git@") then
+ home, repo = fugitive_data.remote:match("git@([^:]+):(.*)%.git")
+ if not (home and repo) then
+ home, org, project, repo = fugitive_data.remote:match("git@([^:]+):.*/(.*)/(.*)/(.*)")
+ end
+ end
+ assert((home and org and project and repo) or (home and repo))
+
+-- (.. "https://" home "/" repo "/src/" commit "/" (or oilpath path ""))
+-- [path "blob"]
+-- (.. "https://" home "/" repo "/src/" commit "/" path)
+-- [path "commit"]
+-- (.. "https://" home "/" repo "/commits/" commit)
+-- [path "ref"]
+-- (.. "https://" home "/" repo "/commits/" commit)))
+ local urls = {
+ ["bitbucket.org"] = {
+ ["tree"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/src/" .. fugitive_data.commit .. "/" .. path
+ end,
+ ["blob"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/src/" .. fugitive_data.commit .. "/" .. path
+ end,
+ ["commit"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/commits/" .. fugitive_data.commit
+ end,
+ ["ref"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/commits/" .. fugitive_data.commit
+ end,
+ },
+-- (.. "https://" home "/" org "/_git/" repo "?version=GB" commit "&path=/" (or oilpath path ""))
+-- [path "blob"]
+-- (.. "https://" home "/" org "/_git/" repo "?version=GB" commit "&path=/" path)
+-- [path "commit"]
+-- (.. "https://" home "/" org "/_git/" repo "/commit/" commit)
+-- [path "ref"]
+-- (.. "https://" home "/" org "/_git/" repo "/commit/" commit)))
+ ["dev.azure.com"] = {
+ ["tree"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. org .. "/_git/" .. repo .. "?version=GB" .. fugitive_data.commit .. "&path=/" .. path
+ end,
+ ["blob"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. org .. "/_git/" .. repo .. "?version=GB" .. fugitive_data.commit .. "&path=/" .. path
+ end,
+ ["commit"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. org .. "/_git/" .. repo .. "/commit/" .. fugitive_data.commit
+ end,
+ ["ref"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. org .. "/_git/" .. repo .. "/commit/" .. fugitive_data.commit
+ end,
+ },
+-- (where ["gitlab.com" repo])
+-- (do
+-- (case [path type]
+-- ["" "tree"]
+-- (.. "https://" home "/" repo "/-/tree/" commit "/" (or oilpath ""))
+-- [path "commit"]
+-- (.. "https://" home "/" repo "/-/commit/" commit)
+-- [path "ref"]
+-- (.. "https://" home "/" repo "/-/commit/" commit)
+-- [path "blob"]
+-- (.. "https://" home "/" repo "/-/blob/" commit "/" path)))
+ ["gitlab.com"] = {
+ ["tree"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/-/tree/" .. fugitive_data.commit .. "/" .. path
+ end,
+ ["blob"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/-/blob/" .. fugitive_data.commit .. "/" .. path
+ end,
+ ["commit"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/-/commit/" .. fugitive_data.commit
+ end,
+ ["ref"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/-/commit/" .. fugitive_data.commit
+ end,
+ },
+-- ["" "tree"]
+-- (.. "https://" home "/" repo "/tree/" commit "/" (or oilpath ""))
+-- [path "blob"]
+-- (.. "https://" home "/" repo "/blob/" commit "/" path)))))
+-- [path "commit"]
+-- (.. "https://" home "/" repo "/commit/" commit)
+-- [path "ref"]
+-- (.. "https://" home "/" repo "/commit/" commit)
+ ["github.com"] = {
+ ["tree"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/tree/" .. fugitive_data.commit .. "/" .. path
+ end,
+ ["blob"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/blob/" .. fugitive_data.commit .. "/" .. path
+ end,
+ ["commit"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/commit/" .. fugitive_data.commit
+ end,
+ ["ref"] = function(home, org, project, repo)
+ return "https://" .. home .. "/" .. repo .. "/commit/" .. fugitive_data.commit
+ end,
+ },
+ }
+
+ return urls[home][fugitive_data.type](home, org, project, repo)
+end
+
-- (fn browse_git_remote
-- [data]
-- (P data)
@@ -329,6 +444,8 @@ vim.api.nvim_create_user_command(
-- (fn [{: args}] (vim.system ["xdg-open" args] {} (fn [])))
-- {:nargs 1})
--
+vim.g.fugitive_browse_handlers = { browse_git_remote }
+
-- (set vim.g.fugitive_browse_handlers
-- [browse_git_remote])
@@ -357,8 +474,7 @@ function paste()
}
end
function xclip(lines)
- vim.system({"xclip"}, {text= true, stdin=lines}, function(exit) end)
- vim.system({"xclip", "-selection", "clipboard"}, {text= true, stdin=lines}, function(exit) end)
+ vim.system({ "nu", "--commands", "xclip -f -sel c | xclip"}, {stdin=lines, text=true}, nil)
end
vim.g.clipboard = {
name = "OSC 52",
@@ -372,6 +488,60 @@ vim.g.clipboard = {
require("my.events")
require("my.packages")
+-- require('render-markdown').setup ({
+-- opts = {
+-- file_types = { "markdown", "Avante" },
+-- },
+-- ft = { "markdown", "Avante" },})
+require('avante_lib').load()
+-- require('copilot').setup {}
+require('avante').setup ({
+ provider = "openai",
+ openai = {
+ model = "gpt-4o",
+ },
+ behaviour = {
+ auto_suggestions = false,
+ auto_set_highlight_group = true,
+ auto_set_keymaps = true,
+ auto_apply_diff_after_generation = false,
+ support_paste_from_clipboard = false,
+ },
+ mappings = {
+ --- @class AvanteConflictMappings
+ diff = {
+ ours = "co",
+ theirs = "ct",
+ all_theirs = "ca",
+ both = "cb",
+ cursor = "cc",
+ next = "]x",
+ prev = "[x",
+ },
+ suggestion = {
+ accept = "<M-l>",
+ next = "<M-]>",
+ prev = "<M-[>",
+ dismiss = "<C-]>",
+ },
+ jump = {
+ next = "]]",
+ prev = "[[",
+ },
+ submit = {
+ normal = "<CR>",
+ insert = "<C-s>",
+ },
+ sidebar = {
+ apply_all = "A",
+ apply_cursor = "a",
+ switch_windows = "<Tab>",
+ reverse_switch_windows = "<S-Tab>",
+ },
+ },
+})
+
+
-- (local
-- draw
-- (fn [toggle]
diff --git a/mut/neovim/lua/my/lsp.lua b/mut/neovim/lua/my/lsp.lua
index ff09277..3097c58 100644
--- a/mut/neovim/lua/my/lsp.lua
+++ b/mut/neovim/lua/my/lsp.lua
@@ -34,43 +34,6 @@ local capability_map = {
local M = {}
--- (fn map-to-capabilities [{: client : buf}]
--- (fn use [cpb]
--- (match cpb
---
--- (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 false
--- :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}
--- (vim.api.nvim_create_autocmd
--- :BufWritePre
--- {:group
--- (vim.api.nvim_create_augroup :format-events {:clear true})
--- :buffer buf
--- :callback #(if format-on-save (vim.lsp.buf.format))})))
-
M.attach = function (ev)
vim.iter(ev.client.server_capabilities)
:each(function(c)
@@ -79,14 +42,4 @@ M.attach = function (ev)
end)
end
--- (fn attach [cb]
--- (-> cb
--- (register-handlers)
--- (map-to-capabilities)
--- (events)))
--- (fn lsp-attach-event [ev]
--- (local client (vim.lsp.get_client_by_id ev.data.client_id))
--- (local buf ev.buf)
--- (attach {: client : buf}))
- -- {: attach : lsp-attach-event}
return M
diff --git a/mut/neovim/lua/my/packages/luasnip.lua b/mut/neovim/lua/my/packages/luasnip.lua
index 0362d94..338b343 100644
--- a/mut/neovim/lua/my/packages/luasnip.lua
+++ b/mut/neovim/lua/my/packages/luasnip.lua
@@ -37,5 +37,8 @@ end, {silent=true})
ls.add_snippets(
"go", {
- s("echo", { t("fmt.Println("), i(1), t(")"), i(2) })
+ s("echo", { t("fmt.Println("), i(1), t(")"), i(2) }),
+ s("echof", { t("fmt.Printf(\"%v\\n\", "), i(1), t(")"), i(2) }),
+ s("log", { t("fmt.Println("), i(1), t(")"), i(2) }),
+ s("logf", { t("fmt.Printf(\"%v\\n\", "), i(1), t(")"), i(2) }),
})
diff --git a/profiles/core/home.nix b/profiles/core/home.nix
index f3a2500..7aed1db 100644
--- a/profiles/core/home.nix
+++ b/profiles/core/home.nix
@@ -4,7 +4,8 @@
config,
pkgs,
...
-}: with lib; {
+}:
+with lib; {
programs.tmux = {
enable = true;
extraConfig = ''
@@ -58,35 +59,68 @@
mimeApps = optionalAttrs (!machine.isDarwin) {
enable = true;
defaultApplications = {
- "text/x-shellscript" = ["text.desktop"];
- "application/x-bittorrent" = ["torrent.desktop"];
- "text/plain" = ["text.desktop"];
- "application/postscript" = ["pdf.desktop"];
- "application/pdf" = ["pdf.desktop"];
- "image/png" = ["img.desktop"];
- "image/jpeg" = ["img.desktop"];
- "image/gif" = ["img.desktop"];
- "application/rss+xml" = ["rss.desktop"];
- "video/x-matroska" = ["video.desktop"];
- "video/mp4" = ["video.desktop"];
- "x-scheme-handler/lbry" = ["lbry.desktop"];
- "inode/directory" = ["file.desktop"];
- "application/x-ica" = ["wfica.desktop"];
- "x-scheme-handler/magnet" = ["torrent.desktop"];
- "x-scheme-handler/mailto" = ["mail.desktop"];
- "x-scheme-handler/msteams" = ["teams.desktop"];
+ "text/x-shellscript" = ["text.desktop"];
+ "application/x-bittorrent" = ["torrent.desktop"];
+ "text/plain" = ["text.desktop"];
+ "application/postscript" = ["pdf.desktop"];
+ "application/pdf" = ["pdf.desktop"];
+ "image/png" = ["img.desktop"];
+ "image/jpeg" = ["img.desktop"];
+ "image/gif" = ["img.desktop"];
+ "application/rss+xml" = ["rss.desktop"];
+ "video/x-matroska" = ["video.desktop"];
+ "video/mp4" = ["video.desktop"];
+ "x-scheme-handler/lbry" = ["lbry.desktop"];
+ "inode/directory" = ["file.desktop"];
+ "application/x-ica" = ["wfica.desktop"];
+ "x-scheme-handler/magnet" = ["torrent.desktop"];
+ "x-scheme-handler/mailto" = ["mail.desktop"];
+ "x-scheme-handler/msteams" = ["teams.desktop"];
};
};
- desktopEntries = with pkgs; optionalAttrs (!machine.isDarwin) {
- text = { type = "Application"; name = "Text editor"; exec = "${st}/bin/st -e nvim %u"; };
- file = { type = "Application"; name = "File Manager"; exec = "${st}/bin/st -e lfub %u"; };
- torrent = { type = "Application"; name = "Torrent"; exec = "${coreutils}/bin/env transadd %U"; };
- img = { type = "Application"; name = "Image Viewer"; exec = "${sxiv}/bin/sxiv -a %u"; };
- video = { type = "Application"; name = "Video Viewer"; exec = "${mpv}/bin/mpv -quiet %f"; };
- mail = { type = "Application"; name = "Mail"; exec = "${st}/bin/st -e neomutt %u"; };
- pdf = { type = "Application"; name = "PDF reader"; exec = "${zathura}/bin/zathura %u"; };
- rss = { type = "Application"; name = "RSS feed addition"; exec = "${coreutils}/bin/env rssadd %u"; };
- };
+ desktopEntries = with pkgs;
+ optionalAttrs (!machine.isDarwin) {
+ text = {
+ type = "Application";
+ name = "Text editor";
+ exec = "${st}/bin/st -e nvim %u";
+ };
+ file = {
+ type = "Application";
+ name = "File Manager";
+ exec = "${st}/bin/st -e lfub %u";
+ };
+ torrent = {
+ type = "Application";
+ name = "Torrent";
+ exec = "${coreutils}/bin/env transadd %U";
+ };
+ img = {
+ type = "Application";
+ name = "Image Viewer";
+ exec = "${sxiv}/bin/sxiv -a %u";
+ };
+ video = {
+ type = "Application";
+ name = "Video Viewer";
+ exec = "${mpv}/bin/mpv -quiet %f";
+ };
+ mail = {
+ type = "Application";
+ name = "Mail";
+ exec = "${st}/bin/st -e neomutt %u";
+ };
+ pdf = {
+ type = "Application";
+ name = "PDF reader";
+ exec = "${zathura}/bin/zathura %u";
+ };
+ rss = {
+ type = "Application";
+ name = "RSS feed addition";
+ exec = "${coreutils}/bin/env rssadd %u";
+ };
+ };
};
# programs.ssh = {
@@ -111,17 +145,17 @@
programs.readline = {
enable = true;
extraConfig = ''
- $if mode=vi
+ $if mode=vi
- set keymap vi-command
- # these are for vi-command mode
- Control-l: clear-screen
+ set keymap vi-command
+ # these are for vi-command mode
+ Control-l: clear-screen
- set keymap vi-insert
- # these are for vi-insert mode
- Control-l: clear-screen
- $endif
- '';
+ set keymap vi-insert
+ # these are for vi-insert mode
+ Control-l: clear-screen
+ $endif
+ '';
};
programs = {
@@ -161,6 +195,12 @@
echo "Pnsh exited badly :("
}
fi
+ export MANPAGER='nvim +Man!'
+ export EDITOR="nvim"
+ export TERMINAL="st"
+ export PATH="''${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
+ export PASSWORD_STORE_GPG_OPTS='--no-throw-keyids'
+
export GNUPGHOME="''${HOME}/.gnupg"
export LOCALE_ARCHIVE_2_27="/nix/store/l8hm9q8ndlg2rvav47y7549llh6npznf-glibc-locales-2.39-52/lib/locale/locale-archive"
export PASSWORD_STORE_DIR="''${HOME}/sync/password-store"
@@ -168,6 +208,9 @@
export XDG_CONFIG_HOME="''${HOME}/.config"
export XDG_DATA_HOME="''${HOME}/.local/share"
export XDG_STATE_HOME="''${HOME}/.local/state"
+ export PATH="$PATH:$HOME/.local/bin:/opt/homebrew/bin:${config.my.home}/.krew/bin:${config.my.home}/.cargo/bin:${pkgs.ncurses}/bin"
+ export STARSHIP_CONFIG="''${HOME}/.config/starship.toml"
+ command -v nu >/dev/null 2>&1 && exec nu --login
# Use vim keys in tab complete menu:
export ZLE_REMOVE_SUFFIX_CHARS=$' ,=\t\n;&|/@'
@@ -178,7 +221,6 @@
bindkey -M menuselect 'j' vi-down-line-or-history
set -o emacs
-
# Use lf to switch directories and bind it to ctrl-o
lfcd () {
tmp="$(mktemp -uq)"
@@ -316,11 +358,6 @@
}
export ZLE_REMOVE_SUFFIX_CHARS=$' ,=\t\n;&|/@'
- export MANPAGER='nvim +Man!'
- export EDITOR="nvim"
- export TERMINAL="st"
- export PATH="''${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
- export PASSWORD_STORE_GPG_OPTS='--no-throw-keyids'
# Workarounds for completion here...
command -v zoxide >/dev/null 2>&1 && eval "$(zoxide init zsh)"
@@ -339,8 +376,6 @@
[[ -f ~/.cache/wal/sequences ]] && (cat ~/.cache/wal/sequences &)
unset LD_PRELOAD
- export PATH="$PATH:$HOME/.local/bin:/opt/homebrew/bin:${config.my.home}/.krew/bin:${config.my.home}/.cargo/bin:${pkgs.ncurses}/bin"
-
alias g="git "
alias t="terraform "
alias c="xclip -f | xclip -sel c -f "
@@ -348,7 +383,11 @@
alias k="kubectl "
alias d="docker "
alias l="ls --color=auto"
- alias s="${if machine.isDarwin then "sudo darwin-rebuild switch --flake ~/nix-config" else "sudo nixos-rebuild switch --flake /nix-config"}"
+ alias s="${
+ if machine.isDarwin
+ then "sudo darwin-rebuild switch --flake ~/nix-config"
+ else "sudo nixos-rebuild switch --flake /nix-config"
+ }"
alias b="/run/current-system/bin/switch-to-configuration boot"
alias v="vi "
alias e="vi "
@@ -365,45 +404,49 @@
bash = {
enable = false;
bashrcExtra = ''
- export EDITOR="nvim"
- export TERMINAL="st"
- ( command -v brew ) &>/dev/null && eval "$(/opt/homebrew/bin/brew shellenv)"
- ( command -v docker ) &>/dev/null && eval "$(docker completion bash)"
- ( command -v kubectl ) &>/dev/null && eval "$(kubectl completion bash)"
- ( command -v zoxide ) &>/dev/null && eval "$(zoxide init bash)"
- export PATH="$PATH:$HOME/.local/bin:/opt/homebrew/bin:${config.my.home}/.krew/bin:${config.my.home}/.cargo/bin:${pkgs.ncurses}/bin"
- [[ -f ~/.cache/wal/sequences ]] && (cat ~/.cache/wal/sequences &)
- unset LD_PRELOAD
- # include nix.sh if it exists
-
- export COLORTERM=truecolor
- export GPG_TTY="$(tty)"
- gpgconf --launch gpg-agent
-
- if [ ! -S ~/.ssh/ssh_auth_sock ]; then
- eval `ssh-agent`
- ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
- fi
- export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
- ssh-add -l > /dev/null || ssh-add ~/.ssh/id_ed25519_sk
- '';
+ export EDITOR="nvim"
+ export TERMINAL="st"
+ ( command -v brew ) &>/dev/null && eval "$(/opt/homebrew/bin/brew shellenv)"
+ ( command -v docker ) &>/dev/null && eval "$(docker completion bash)"
+ ( command -v kubectl ) &>/dev/null && eval "$(kubectl completion bash)"
+ ( command -v zoxide ) &>/dev/null && eval "$(zoxide init bash)"
+ export PATH="$PATH:$HOME/.local/bin:/opt/homebrew/bin:${config.my.home}/.krew/bin:${config.my.home}/.cargo/bin:${pkgs.ncurses}/bin"
+ [[ -f ~/.cache/wal/sequences ]] && (cat ~/.cache/wal/sequences &)
+ unset LD_PRELOAD
+ # include nix.sh if it exists
+
+ export COLORTERM=truecolor
+ export GPG_TTY="$(tty)"
+ gpgconf --launch gpg-agent
+
+ if [ ! -S ~/.ssh/ssh_auth_sock ]; then
+ eval `ssh-agent`
+ ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
+ fi
+ export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
+ ssh-add -l > /dev/null || ssh-add ~/.ssh/id_ed25519_sk
+ '';
shellAliases = {
- k9s = "k9s ";
- k = "kubectl ";
- d = "docker ";
- ls = "ls --color=auto";
- s = "${if machine.isDarwin then "darwin-rebuild" else "sudo nixos-rebuild"} switch --flake ${config.my.home}/flake#${config.networking.hostName}";
- b = "/run/current-system/bin/switch-to-configuration boot";
- v = "nvim";
- M = "xrandr --output HDMI1 --auto --output eDP1 --off";
- m = "xrandr --output eDP1 --auto --output HDMI1 --off";
- mM = "xrandr --output eDP1 --auto --output HDMI1 --off";
- newflake = "nix flake new -t ~/flake ";
+ k9s = "k9s ";
+ k = "kubectl ";
+ d = "docker ";
+ ls = "ls --color=auto";
+ s = "${
+ if machine.isDarwin
+ then "darwin-rebuild"
+ else "sudo nixos-rebuild"
+ } switch --flake ${config.my.home}/flake#${config.networking.hostName}";
+ b = "/run/current-system/bin/switch-to-configuration boot";
+ v = "nvim";
+ M = "xrandr --output HDMI1 --auto --output eDP1 --off";
+ m = "xrandr --output eDP1 --auto --output HDMI1 --off";
+ mM = "xrandr --output eDP1 --auto --output HDMI1 --off";
+ newflake = "nix flake new -t ~/flake ";
ansible-flake = "nix flake new -t ~/flake#ansible ";
- go-flake = "nix flake new -t ~/flake#go ";
- lock-pass = "gpgconf --kill gpg-agent";
- use-gpg-ssh = "export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)";
- use-fido-ssh = "export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock";
+ go-flake = "nix flake new -t ~/flake#go ";
+ lock-pass = "gpgconf --kill gpg-agent";
+ use-gpg-ssh = "export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)";
+ use-fido-ssh = "export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock";
};
};
};
diff --git a/profiles/core/neovim.nix b/profiles/core/neovim.nix
index 894d11c..e3a141d 100644
--- a/profiles/core/neovim.nix
+++ b/profiles/core/neovim.nix
@@ -45,7 +45,6 @@
plugins = with pkgs.vimPlugins; [
# highlighting
nvim-treesitter.withAllGrammars
- avante-nvim
playground
gruvbox-material
kanagawa-nvim
@@ -94,6 +93,11 @@
conjure
vim-racket
nvim-parinfer
+
+ # ai :(
+ render-markdown
+ avante-nvim
+ nui-nvim
];
};
};
diff --git a/profiles/homeserver/transmission.nix b/profiles/homeserver/transmission.nix
index 4be0d1b..8d047d7 100644
--- a/profiles/homeserver/transmission.nix
+++ b/profiles/homeserver/transmission.nix
@@ -1,34 +1,47 @@
-{ config, lib, ... }: with lib; let
- multimediaUsernames = [
- "prowlarr"
- "sonarr"
- "radarr"
- "bazarr"
- "jellyfin"
- "transmission"
- ];
- mkMultimediaUsers = names: mergeAttrsList (imap0 (i: name: {${name} = {
- uid = 2007 + i;
- isSystemUser = true;
- group = name;
- createHome = false;
- };}) names);
- mkMultimediaGroups = names: mergeAttrsList (map (name: {${name} = { };}) names);
- in {
+{
+ config,
+ lib,
+ ...
+}:
+with lib; let
+ multimediaUsernames = [
+ "prowlarr"
+ "sonarr"
+ "radarr"
+ "bazarr"
+ "jellyfin"
+ "transmission"
+ ];
+ mkMultimediaUsers = names:
+ mergeAttrsList (imap0 (i: name: {
+ ${name} = {
+ uid = 2007 + i;
+ isSystemUser = true;
+ group = name;
+ createHome = false;
+ };
+ })
+ names);
+ mkMultimediaGroups = names: mergeAttrsList (map (name: {${name} = {};}) names);
+in {
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
- users.groups = {
- multimedia = {
- gid = 1994;
- members = multimediaUsernames;
- };
- } // mkMultimediaGroups multimediaUsernames;
- users.users = {
- ${my.username}.extraGroups = [ "multimedia" ];
- } // mkMultimediaUsers multimediaUsernames;
+ users.groups =
+ {
+ multimedia = {
+ gid = 1994;
+ members = multimediaUsernames;
+ };
+ }
+ // mkMultimediaGroups multimediaUsernames;
+ users.users =
+ {
+ ${my.username}.extraGroups = ["multimedia"];
+ }
+ // mkMultimediaUsers multimediaUsernames;
systemd.tmpfiles.rules = [
"d /data 0770 - multimedia - -"
@@ -36,13 +49,13 @@
services.nginx = {
virtualHosts = {
- "sonarr.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:8989"; }; };
- "radarr.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:7878"; }; };
- "bazarr.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:${toString config.services.bazarr.listenPort}"; }; };
+ "sonarr.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:8989";};};
+ "radarr.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:7878";};};
+ "bazarr.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:${toString config.services.bazarr.listenPort}";};};
# "readarr.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:8787"; }; };
- "prowlarr.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:9696"; }; };
- "transmission.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:9091"; }; };
- "jellyfin.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:8096"; }; };
+ "prowlarr.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:9696";};};
+ "transmission.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:9091";};};
+ "jellyfin.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:8096";};};
};
};
# services = {
@@ -53,6 +66,8 @@
# readarr = { enable = true; group = "multimedia"; };
# prowlarr = { enable = true; };
# };
+
+ # TODO: use one shared data drive
virtualisation.oci-containers = {
backend = "docker";
containers = {
@@ -64,7 +79,8 @@
PGID = "${toString config.users.groups.multimedia.gid}";
};
volumes = [
- "/data/config/prowlarr/data:/config"
+ # "/data/config/prowlarr/data:/config"
+ "/data:/data"
];
};
bazarr = {
@@ -75,8 +91,9 @@
PGID = "${toString config.users.groups.multimedia.gid}";
};
volumes = [
- "/data/media:/data"
- "/data/config/bazarr/data:/config"
+ # "/data/media:/data"
+ # "/data/config/bazarr/data:/config"
+ "/data:/data"
];
};
radarr = {
@@ -87,8 +104,8 @@
PGID = "${toString config.users.groups.multimedia.gid}";
};
volumes = [
+ # "/data/config/radarr/data:/config"
"/data:/data"
- "/data/config/radarr/data:/config"
];
};
sonarr = {
@@ -99,8 +116,8 @@
PGID = "${toString config.users.groups.multimedia.gid}";
};
volumes = [
+ # "/data/config/sonarr/data:/config"
"/data:/data"
- "/data/config/sonarr/data:/config"
];
};
jellyfin = {
@@ -108,18 +125,20 @@
extraOptions = ["--net=host"];
user = "${toString config.users.users.jellyfin.uid}:${toString config.users.groups.multimedia.gid}";
volumes = [
- "/data/media:/media"
- "/data/config/jellyfin/config:/config"
- "/data/config/jellyfin/cache:/cache"
+ # "/data/media:/media"
+ # "/data/config/jellyfin/config:/config"
+ # "/data/config/jellyfin/cache:/cache"
+ "/data:/data"
];
};
transmission = {
image = "haugene/transmission-openvpn";
extraOptions = ["--cap-add=NET_ADMIN" "--group-add=${toString config.users.groups.multimedia.gid}"];
volumes = [
- "/data/config/ovpn:/etc/openvpn/custom"
- "/data/config/transmission:/config"
- "/data/torrents:/data/torrents"
+ # "/data/config/ovpn:/etc/openvpn/custom"
+ # "/data/config/transmission:/config"
+ # "/data/torrents:/data/torrents"
+ "/data:/data"
];
ports = [
"9091:9091"
diff --git a/profiles/vmware-guest.nix b/profiles/vmware-guest.nix
index 7dc8ef2..5f1d7af 100644
--- a/profiles/vmware-guest.nix
+++ b/profiles/vmware-guest.nix
@@ -2,18 +2,21 @@
# for aarch64 to disable certain features and add support. I'm unsure
# how to upstream this because I just don't use certain features... maybe
# making them toggle-able? I'm not sure.
-
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-let
- cfg = config.virtualisation.vmware.guest;
- open-vm-tools = if cfg.headless then pkgs.open-vm-tools-headless else pkgs.open-vm-tools;
-in
{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+with lib; let
+ cfg = config.virtualisation.vmware.guest;
+ open-vm-tools =
+ if cfg.headless
+ then pkgs.open-vm-tools-headless
+ else pkgs.open-vm-tools;
+in {
imports = [
- (mkRenamedOptionModule [ "services" "vmwareGuest" ] [ "virtualisation" "vmware" "guest" ])
+ (mkRenamedOptionModule ["services" "vmwareGuest"] ["virtualisation" "vmware" "guest"])
];
options.virtualisation.vmware.guest = {
@@ -26,44 +29,46 @@ in
};
config = mkIf cfg.enable {
- assertions = [ {
- assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 || pkgs.stdenv.isAarch64;
- message = "VMWare guest is not currently supported on ${pkgs.stdenv.hostPlatform.system}";
- } ];
+ assertions = [
+ {
+ assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 || pkgs.stdenv.isAarch64;
+ message = "VMWare guest is not currently supported on ${pkgs.stdenv.hostPlatform.system}";
+ }
+ ];
- boot.initrd.availableKernelModules = [ "mptspi" ];
+ boot.initrd.availableKernelModules = ["mptspi"];
# boot.initrd.kernelModules = [ "vmw_pvscsi" ];
- environment.systemPackages = [ open-vm-tools ];
+ environment.systemPackages = [open-vm-tools];
- systemd.services.vmware =
- { description = "VMWare Guest Service";
- wantedBy = [ "multi-user.target" ];
- after = [ "display-manager.service" ];
- unitConfig.ConditionVirtualization = "vmware";
- serviceConfig.ExecStart = "${open-vm-tools}/bin/vmtoolsd";
- };
+ systemd.services.vmware = {
+ description = "VMWare Guest Service";
+ wantedBy = ["multi-user.target"];
+ after = ["display-manager.service"];
+ unitConfig.ConditionVirtualization = "vmware";
+ serviceConfig.ExecStart = "${open-vm-tools}/bin/vmtoolsd";
+ };
# Mount the vmblock for drag-and-drop and copy-and-paste.
systemd.mounts = [
{
description = "VMware vmblock fuse mount";
- documentation = [ "https://github.com/vmware/open-vm-tools/blob/master/open-vm-tools/vmblock-fuse/design.txt" ];
+ documentation = ["https://github.com/vmware/open-vm-tools/blob/master/open-vm-tools/vmblock-fuse/design.txt"];
unitConfig.ConditionVirtualization = "vmware";
what = "${open-vm-tools}/bin/vmware-vmblock-fuse";
where = "/run/vmblock-fuse";
type = "fuse";
options = "subtype=vmware-vmblock,default_permissions,allow_other";
- wantedBy = [ "multi-user.target" ];
+ wantedBy = ["multi-user.target"];
}
];
- security.wrappers.vmware-user-suid-wrapper =
- { setuid = true;
- owner = "root";
- group = "root";
- source = "${open-vm-tools}/bin/vmware-user-suid-wrapper";
- };
+ security.wrappers.vmware-user-suid-wrapper = {
+ setuid = true;
+ owner = "root";
+ group = "root";
+ source = "${open-vm-tools}/bin/vmware-user-suid-wrapper";
+ };
environment.etc.vmware-tools.source = "${open-vm-tools}/etc/vmware-tools/*";
@@ -72,20 +77,19 @@ in
# modules = [ xf86inputvmmouse ];
config = ''
- Section "InputClass"
- Identifier "VMMouse"
- MatchDevicePath "/dev/input/event*"
- MatchProduct "ImPS/2 Generic Wheel Mouse"
- Driver "vmmouse"
- EndSection
- '';
+ Section "InputClass"
+ Identifier "VMMouse"
+ MatchDevicePath "/dev/input/event*"
+ MatchProduct "ImPS/2 Generic Wheel Mouse"
+ Driver "vmmouse"
+ EndSection
+ '';
displayManager.sessionCommands = ''
- ${open-vm-tools}/bin/vmware-user-suid-wrapper
- '';
+ ${open-vm-tools}/bin/vmware-user-suid-wrapper
+ '';
};
- services.udev.packages = [ open-vm-tools ];
+ services.udev.packages = [open-vm-tools];
};
}
-