diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index 624d037..c8fb8ee 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -135,6 +135,7 @@ bind = , I, exec, hyprctl dispatch submap reset; ctl idle bind = , K, exec, hyprctl dispatch submap reset; ctl keyboard next bind = , M, exec, hyprctl dispatch submap reset; ctl media bind = , P, exec, hyprctl dispatch submap reset; ctl power +bind = , D, exec, hyprctl dispatch submap reset; ctl dictate bind = , T, exec, hyprctl dispatch submap reset; theme bind = , catchall, submap, reset diff --git a/config/nvim/.luacheckrc b/config/nvim/.luacheckrc index 9e07bfe..5fe6d46 100644 --- a/config/nvim/.luacheckrc +++ b/config/nvim/.luacheckrc @@ -1,18 +1,14 @@ --- Rerun tests only if their modification time changed. cache = true ignore = { - "122", -- Setting a read-only field of a global variable. - "212", -- Unused argument, In the case of callback function, _arg_name is easier to understand than _, so this option is set to off. - "631", -- max_line_length, vscode pkg URL is too long + "122", + "212", + "631", } --- Global objects defined by the C code read_globals = { "vim", } include_files = { "lua", "tests" } exclude_files = { ".luacheckrc", "tests/**/*_spec.lua" } - --- vim: ft=lua tw=80 diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index e17a686..7f9acee 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -1,10 +1,4 @@ { - "lazy.nvim": { - "branch": "main", - "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" - }, - "midnight.nvim": { - "branch": "main", - "commit": "fe062a6f2e5bd77cd8a260f61e6e12789eaf4f13" - } + "guard-collection": { "branch": "main", "commit": "edf6c86c06badc972964dadb7fd469022690cbf0" }, + "guard.nvim": { "branch": "main", "commit": "addb8d2f40662b8b62d60dd7d18f503beb2332e7" } } diff --git a/config/nvim/lua/config/lsp.lua b/config/nvim/lua/config/lsp.lua index 46aa994..525e310 100644 --- a/config/nvim/lua/config/lsp.lua +++ b/config/nvim/lua/config/lsp.lua @@ -2,65 +2,67 @@ local M = {} local Methods = vim.lsp.protocol.Methods +local function fzf_or(fzf_cmd, fallback) + return function() + pcall(require('lz.n').trigger_load, 'ibhagwan/fzf-lua') + if pcall(require, 'fzf-lua') then + vim.cmd('FzfLua ' .. fzf_cmd) + else + fallback() + end + end +end + function M.on_attach(client, bufnr) if client:supports_method(Methods.textDocument_hover) then vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = bufnr }) end - local ok, _ = pcall(require, 'fzf-lua') - local mappings = { { Methods.textDocument_codeAction, 'gra', - ok and 'FzfLua lsp_code_actions' - or vim.lsp.buf.code_action, + fzf_or('lsp_code_actions', vim.lsp.buf.code_action), }, { Methods.textDocument_declaration, 'gD', - ok and 'FzfLua lsp_declarations' - or vim.lsp.buf.declaration, + fzf_or('lsp_declarations', vim.lsp.buf.declaration), }, { Methods.textDocument_definition, 'gd', - ok and 'FzfLua lsp_definitions' or vim.lsp.buf.definition, + fzf_or('lsp_definitions', vim.lsp.buf.definition), }, { Methods.textDocument_implementation, 'gri', - ok and 'FzfLua lsp_implementations' - or vim.lsp.buf.implementation, + fzf_or('lsp_implementations', vim.lsp.buf.implementation), }, { Methods.textDocument_references, 'grr', - ok and 'FzfLua lsp_references' or vim.lsp.buf.references, + fzf_or('lsp_references', vim.lsp.buf.references), }, { Methods.textDocument_typeDefinition, 'grt', - ok and 'FzfLua lsp_typedefs' - or vim.lsp.buf.type_definition, + fzf_or('lsp_typedefs', vim.lsp.buf.type_definition), }, { Methods.textDocument_documentSymbol, 'gs', - ok and 'FzfLua lsp_document_symbols' - or vim.lsp.buf.document_symbol, + fzf_or('lsp_document_symbols', vim.lsp.buf.document_symbol), }, { Methods.workspace_diagnostic, 'gw', - ok and 'FzfLua lsp_workspace_diagnostics' - or vim.diagnostic.setqflist, + fzf_or('lsp_workspace_diagnostics', vim.diagnostic.setqflist), }, { Methods.workspace_symbol, 'gS', - ok and 'FzfLua lsp_workspace_symbols' - or vim.lsp.buf.workspace_symbol, + fzf_or('lsp_workspace_symbols', vim.lsp.buf.workspace_symbol), }, } diff --git a/config/nvim/lua/lsp/tinymist.lua b/config/nvim/lua/lsp/tinymist.lua index f40de0f..fc33b3a 100644 --- a/config/nvim/lua/lsp/tinymist.lua +++ b/config/nvim/lua/lsp/tinymist.lua @@ -2,7 +2,7 @@ return { filetypes = { 'typst' }, settings = { formatterMode = 'typstyle', - exportPdf = 'onSave', + -- exportPdf = 'onSave', semanticTokens = 'disable', lint = { enabled = true, diff --git a/config/nvim/lua/plugins/dev.lua b/config/nvim/lua/plugins/dev.lua index 4ac5a36..e9e73cc 100644 --- a/config/nvim/lua/plugins/dev.lua +++ b/config/nvim/lua/plugins/dev.lua @@ -60,6 +60,30 @@ local git_status = new_git_status() local synctex_pdf = {} return { + { + 'barrettruth/diffs.nvim', + enabled = true, + before = function() + vim.g.diffs = { + debug = false, + integrations = { fugitive = true }, + extra_filetypes = { 'diff' }, + hide_prefix = true, + highlights = { + gutter = true, + vim = { + enabled = true, + -- max_lines = 500, + }, + -- treesitter = { max_lines = 10 }, + intra = { + enabled = true, + max_lines = 500, + }, + }, + } + end, + }, { 'barrettruth/midnight.nvim', enabled = true, @@ -81,14 +105,14 @@ return { 'barrettruth/canola.nvim', enabled = true, after = function() - require('canola').setup({ + require('oil').setup({ skip_confirm_for_simple_edits = true, cleanup_buffers_on_delete = true, prompt_save_on_select_new_entry = false, float = { border = 'single' }, view_options = { is_hidden_file = function(name, bufnr) - local dir = require('canola').get_current_dir(bufnr) + local dir = require('oil').get_current_dir(bufnr) local is_dotfile = vim.startswith(name, '.') and name ~= '..' if not dir then @@ -121,7 +145,7 @@ return { end, }, }) - local refresh = require('canola.actions').refresh + local refresh = require('oil.actions').refresh local orig_refresh = refresh.callback refresh.callback = function(...) git_status = new_git_status() @@ -137,23 +161,37 @@ return { end end end, - group = vim.api.nvim_create_augroup( - 'ACanola', - { clear = true } - ), + group = vim.api.nvim_create_augroup('AOil', { clear = true }), }) end, event = 'DeferredUIEnter', keys = { { '-', 'e .' }, - { '_', 'Canola' }, + { '_', 'Oil' }, }, }, { 'barrettruth/pending.nvim', before = function() vim.g.pending = { + view = { + queue = { + sort = { + 'lol', + 'dne', + 'status', + 'due', + 'priority', + 'order', + 'id', + }, + }, + category = { hide_done_categories = true }, + }, debug = false, + sync = { + s3 = { bucket = 'pending.nvim', region = 'us-east-1' }, + }, data_path = ( os.getenv('XDG_STATE_HOME') or (os.getenv('HOME') .. '/.local/state') @@ -308,7 +346,7 @@ return { vim.filetype.add({ extension = { puml = 'plantuml', pu = 'plantuml' }, }) - vim.fn.serverstart('/tmp/nvim-preview.sock') + vim.api.nvim_create_autocmd('User', { pattern = 'PreviewCompileSuccess', callback = function(args) @@ -340,12 +378,31 @@ return { }) vim.g.preview = { debug = false, - github = true, + github = { + output = function(ctx) + return '/tmp/' + .. vim.fn.fnamemodify(ctx.file, ':t:r') + .. '.html' + end, + }, typst = { open = { 'sioyek', '--new-instance' } }, plantuml = true, mermaid = true, latex = { open = { 'sioyek', '--instance-name', 'preview' }, + args = function(ctx) + local dir = vim.fn.fnamemodify(ctx.file, ':h') + .. '/build' + vim.fn.mkdir(dir, 'p') + return { + '-pdf', + '-interaction=nonstopmode', + '-synctex=1', + '-output-directory=' .. dir, + '-pdflatex=pdflatex -file-line-error %O %S', + ctx.file, + } + end, output = function(ctx) return vim.fn.fnamemodify(ctx.file, ':h') .. '/build/' diff --git a/config/nvim/lua/plugins/fzf.lua b/config/nvim/lua/plugins/fzf.lua index ddbd713..53c4b5f 100644 --- a/config/nvim/lua/plugins/fzf.lua +++ b/config/nvim/lua/plugins/fzf.lua @@ -1,5 +1,5 @@ return { - 'barrettruth/fzf-lua', + 'ibhagwan/fzf-lua', after = function() local fzf = require('fzf-lua') local has_nonicons = pcall(require, 'nonicons') @@ -94,6 +94,7 @@ return { fzf_reload.reload() end end, + cmd = 'FzfLua', keys = { { '', diff --git a/config/nvim/lua/plugins/guard.lua b/config/nvim/lua/plugins/guard.lua index ce83b8a..4fb5755 100644 --- a/config/nvim/lua/plugins/guard.lua +++ b/config/nvim/lua/plugins/guard.lua @@ -25,7 +25,7 @@ return { args = { '--profile', 'black', '-' }, stdin = true, }) - :append('black') + :fmt('black') :lint('mypy') ft('lua'):fmt('stylua'):lint('selene') @@ -43,6 +43,8 @@ return { ft('sh,bash'):lint('shellcheck') ft('zsh'):lint('zsh') + ft('html'):fmt('prettierd') + ft('proto'):fmt('buf'):lint('buf') ft('dockerfile'):lint('hadolint') ft('tex'):fmt('latexindent') @@ -50,7 +52,7 @@ return { ft('cmake'):fmt('cmake-format') ft('make'):lint('checkmake') ft('cpp'):lint('cpplint') - ft('markdown'):fmt('cbfmt'):append('prettierd') + ft('markdown'):fmt('cbfmt'):fmt('prettierd') local lint = require('guard.lint') ft('nix') diff --git a/config/nvim/lua/plugins/git.lua b/config/nvim/plugin/git.lua similarity index 90% rename from config/nvim/lua/plugins/git.lua rename to config/nvim/plugin/git.lua index 7a08ede..077fb0d 100644 --- a/config/nvim/lua/plugins/git.lua +++ b/config/nvim/plugin/git.lua @@ -218,30 +218,3 @@ end) vim.keymap.set('n', 'gp', function() forge_picker('pr', 'all') end) - -return { - { - 'barrettruth/diffs.nvim', - enabled = true, - before = function() - vim.g.diffs = { - debug = false, - integrations = { fugitive = true }, - extra_filetypes = { 'diff' }, - hide_prefix = false, - highlights = { - -- blend_alpha = 0.9, - gutter = true, - vim = { - enabled = true, - max_lnes = 500, - }, - intra = { - enabled = true, - max_lines = 500, - }, - }, - } - end, - }, -} diff --git a/config/nvim/plugin/options.lua b/config/nvim/plugin/options.lua index f23f751..d9b0750 100644 --- a/config/nvim/plugin/options.lua +++ b/config/nvim/plugin/options.lua @@ -46,8 +46,9 @@ vim.o.number = true vim.o.relativenumber = true vim.o.signcolumn = 'no' -vim.o.statuscolumn = '%s%C %=%{v:relnum?v:relnum:v:lnum} ' -vim.o.statusline = " %{len(expand('%'))?expand('%:~').' ':''}%h%m%r%=%c:%l/%L %{&ft!=''?&ft:&bt} " +vim.o.statuscolumn = "%{%v:virtnum?'':'%s%C %=%{v:relnum?v:relnum:v:lnum} '%}" +vim.o.statusline = + " %{len(expand('%'))?expand('%:~').' ':''}%h%m%r%=%c:%l/%L %{&ft!=''?&ft:&bt} " vim.opt.path:append('**') diff --git a/flake.lock b/flake.lock index 80ae313..ba1cfa1 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1772841847, - "narHash": "sha256-Qre73BGBcw1YlhBTTT+T/rVoqVtlCgHYYExUreIJoYs=", + "lastModified": 1773106201, + "narHash": "sha256-p5JuCe5wywjp2oanroCOzH+kzKCFt7rpJDg+lVykSjw=", "owner": "ryoppippi", "repo": "claude-code-overlay", - "rev": "871c9fa0d37c0d6b3bdbf30341a8d08a75b1793b", + "rev": "a6293ea4b12f65545c21357c1df4dcb885f0de6e", "type": "github" }, "original": { @@ -18,6 +18,26 @@ "type": "github" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1773025010, + "narHash": "sha256-khlHllTsovXgT2GZ0WxT4+RvuMjNeR5OW0UYeEHPYQo=", + "owner": "nix-community", + "repo": "disko", + "rev": "7b9f7f88ab3b339f8142dc246445abb3c370d3d3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -46,11 +66,11 @@ ] }, "locked": { - "lastModified": 1772845525, - "narHash": "sha256-Dp5Ir2u4jJDGCgeMRviHvEQDe+U37hMxp6RSNOoMMPc=", + "lastModified": 1773179137, + "narHash": "sha256-EdW2bwzlfme0vbMOcStnNmKlOAA05Bp6su2O8VLGT0k=", "owner": "nix-community", "repo": "home-manager", - "rev": "27b93804fbef1544cb07718d3f0a451f4c4cd6c0", + "rev": "3f98e2bbc661ec0aaf558d8a283d6955f05f1d09", "type": "github" }, "original": { @@ -87,11 +107,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1772928300, - "narHash": "sha256-7WXA2vUlHNvCjjTDLsM0CGzTE52d8M8tXj+c4QOQnsk=", + "lastModified": 1773187529, + "narHash": "sha256-g+SvIUF9he6xFI5d3752wNAsOcbKBg6a0HpX16ggKY4=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "8df2141922896b7923ab78d624951f29531b5e8a", + "rev": "2c00dfe845f47f9cdab706372e82613d233e5c85", "type": "github" }, "original": { @@ -103,11 +123,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1772909350, - "narHash": "sha256-SOywFX51TumgEMzjRN8JBo2E59Dr9+13sye7qv20nR8=", + "lastModified": 1773186516, + "narHash": "sha256-IPthgh8IUiFme222fCPbFzxZHDmvDY9ibNZ4MS3v+PA=", "owner": "neovim", "repo": "neovim", - "rev": "e8e694d837427bd158d51dd62a25f165d49725c6", + "rev": "3a7ade847f10e22af6cecf92046eee238d6b21f6", "type": "github" }, "original": { @@ -118,11 +138,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1771969195, - "narHash": "sha256-qwcDBtrRvJbrrnv1lf/pREQi8t2hWZxVAyeMo7/E9sw=", + "lastModified": 1772972630, + "narHash": "sha256-mUJxsNOrBMNOUJzN0pfdVJ1r2pxeqm9gI/yIKXzVVbk=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "41c6b421bdc301b2624486e11905c9af7b8ec68e", + "rev": "3966ce987e1a9a164205ac8259a5fe8a64528f72", "type": "github" }, "original": { @@ -149,11 +169,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1772736753, - "narHash": "sha256-au/m3+EuBLoSzWUCb64a/MZq6QUtOV8oC0D9tY2scPQ=", + "lastModified": 1772956932, + "narHash": "sha256-M0yS4AafhKxPPmOHGqIV0iKxgNO8bHDWdl1kOwGBwRY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "917fec990948658ef1ccd07cef2a1ef060786846", + "rev": "608d0cadfed240589a7eea422407a547ad626a14", "type": "github" }, "original": { @@ -165,11 +185,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1772736753, - "narHash": "sha256-au/m3+EuBLoSzWUCb64a/MZq6QUtOV8oC0D9tY2scPQ=", + "lastModified": 1773110118, + "narHash": "sha256-mPAG8phMbCReKSiKAijjjd3v7uVcJOQ75gSjGJjt/Rk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "917fec990948658ef1ccd07cef2a1ef060786846", + "rev": "e607cb5360ff1234862ac9f8839522becb853bb9", "type": "github" }, "original": { @@ -198,6 +218,7 @@ "root": { "inputs": { "claude-code": "claude-code", + "disko": "disko", "home-manager": "home-manager", "neovim-nightly": "neovim-nightly", "nixos-hardware": "nixos-hardware", @@ -211,11 +232,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1772945022, - "narHash": "sha256-Fv14NttjL/7xfi6eVwrSEBAyBvDjI00RLiRNqA5apcw=", + "lastModified": 1773225617, + "narHash": "sha256-IT0n3jJgf4M7U0EuZJ2XJwXBmSJVVK3auqWDGeHGMzY=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "3a6a5ca7fb48cc8fd8183386506a06579d1d79dc", + "rev": "413a22ab7acf848ed4e20c3f47ea96ccd4788518", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 72312ec..b8b54b5 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,10 @@ zen-browser.url = "github:0xc000022070/zen-browser-flake"; claude-code.url = "github:ryoppippi/claude-code-overlay"; neovim-nightly.url = "github:nix-community/neovim-nightly-overlay"; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = @@ -21,6 +25,7 @@ zen-browser, claude-code, neovim-nightly, + disko, ... }: let @@ -129,6 +134,10 @@ "tailscale" "libfprint-2-tod1-goodix" "brgenml1lpr" + "cuda_cccl" + "cuda_cudart" + "libcublas" + "cuda_nvcc" ] ); } @@ -149,10 +158,12 @@ }; }; - homeConfigurations = { - "barrett@mac" = mkHome macConfig; - "barrett@mac-work" = mkHome macWorkConfig; - "barrett@linux-work" = mkHome linuxWorkConfig; + nixosConfigurations.netcup = nixpkgs.lib.nixosSystem { + modules = [ + disko.nixosModules.disko + ./hosts/netcup/configuration.nix + { nixpkgs.hostPlatform = "x86_64-linux"; } + ]; }; }; } diff --git a/home/home.nix b/home/home.nix index 1928b8c..d6ad5be 100644 --- a/home/home.nix +++ b/home/home.nix @@ -19,6 +19,7 @@ ++ lib.optionals hostConfig.isLinux [ ./modules/hyprland.nix ./modules/ui.nix + ./modules/dictation.nix ]; config = { diff --git a/home/modules/dictation.nix b/home/modules/dictation.nix new file mode 100644 index 0000000..92c5914 --- /dev/null +++ b/home/modules/dictation.nix @@ -0,0 +1,24 @@ +{ + lib, + pkgs, + config, + hostConfig, + ... +}: + +let + whisper = pkgs.whisper-cpp.override { cudaSupport = hostConfig.gpu == "nvidia"; }; + modelDir = "${config.home.homeDirectory}/.local/share/whisper-models"; + model = "ggml-large-v3-turbo.bin"; + modelUrl = "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/${model}"; +in +{ + home.packages = [ whisper ]; + + home.activation.downloadWhisperModel = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + if [ ! -f "${modelDir}/${model}" ]; then + run mkdir -p "${modelDir}" + run ${pkgs.curl}/bin/curl -L -o "${modelDir}/${model}" "${modelUrl}" + fi + ''; +} diff --git a/home/modules/packages.nix b/home/modules/packages.nix index 592d73e..940fe2d 100644 --- a/home/modules/packages.nix +++ b/home/modules/packages.nix @@ -161,7 +161,7 @@ in font_size 18 status_bar_font_size 18 - inverse_search_command nvim --server /tmp/nvim-preview.sock --remote-expr "execute('b +%2 %1 | normal! zz')" + inverse_search_command ${repoDir}/scripts/nvim-inverse-search %1 %2 ''; }; diff --git a/home/modules/shell.nix b/home/modules/shell.nix index 0fb8124..60a338f 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -130,16 +130,16 @@ in home.activation.awsConfig = lib.mkIf aws ( lib.hm.dag.entryAfter [ "writeBoundary" ] '' - dir="${config.xdg.configHome}/aws" - mkdir -p "$dir" - if [ ! -f "$dir/config" ]; then - cat > "$dir/config" << 'AWSEOF' -[default] -[profile barrett] -region = us-east-2 -output = json -AWSEOF - fi + dir="${config.xdg.configHome}/aws" + mkdir -p "$dir" + if [ ! -f "$dir/config" ]; then + cat > "$dir/config" << 'AWSEOF' + [default] + [profile barrett] + region = us-east-2 + output = json + AWSEOF + fi '' ); @@ -336,6 +336,7 @@ AWSEOF xdg.configFile."claude/settings.json" = lib.mkIf claude { text = builtins.toJSON { permissions.defaultMode = "acceptEdits"; + notifications.hints = "disabled"; network_access = true; allowed_domains = [ "github.com" diff --git a/home/modules/vcs.nix b/home/modules/vcs.nix index 73c9701..a5d4fcf 100644 --- a/home/modules/vcs.nix +++ b/home/modules/vcs.nix @@ -159,6 +159,12 @@ in ]; }; + home.packages = [ pkgs.tea ]; + + programs.ssh.matchBlocks."codeberg.org" = { + identityFile = "~/.ssh/id_ed25519"; + }; + programs.gh = { enable = true; settings = { diff --git a/hosts/netcup/configuration.nix b/hosts/netcup/configuration.nix new file mode 100644 index 0000000..dd98cf3 --- /dev/null +++ b/hosts/netcup/configuration.nix @@ -0,0 +1,126 @@ +{ pkgs, ... }: + +{ + imports = [ ./disk-config.nix ]; + + boot.loader.grub = { + enable = true; + efiSupport = true; + efiInstallAsRemovable = true; + device = "nodev"; + }; + + networking = { + hostName = "netcup"; + useDHCP = false; + interfaces.eth0 = { + ipv4.addresses = [ + { + address = "152.53.168.144"; + prefixLength = 22; + } + ]; + ipv6.addresses = [ + { + address = "2a0a:4cc0:2000:af7d:c8e4:dff:fe7f:c233"; + prefixLength = 64; + } + ]; + }; + defaultGateway = { + address = "152.53.168.1"; + interface = "eth0"; + }; + defaultGateway6 = { + address = "fe80::1"; + interface = "eth0"; + }; + nameservers = [ + "1.1.1.1" + "8.8.8.8" + ]; + firewall.allowedTCPPorts = [ + 22 + 80 + 443 + ]; + }; + + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "prohibit-password"; + PasswordAuthentication = false; + }; + }; + + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILA1pOJawzHtJqIn56AZT4IhPUh9vUEhLPLwndk5s3iM br.barrettruth@gmail.com" + ]; + + security.acme = { + acceptTerms = true; + defaults.email = "br.barrettruth@gmail.com"; + }; + + services.nginx = { + enable = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + virtualHosts."vault.barrettruth.com" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = "http://127.0.0.1:8222"; + }; + virtualHosts."git.barrettruth.com" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = "http://127.0.0.1:3000"; + }; + }; + + services.vaultwarden = { + enable = true; + backupDir = "/var/backup/vaultwarden"; + environmentFile = "/var/lib/vaultwarden/vaultwarden.env"; + config = { + DOMAIN = "https://vault.barrettruth.com"; + SIGNUPS_ALLOWED = false; + ROCKET_ADDRESS = "127.0.0.1"; + ROCKET_PORT = 8222; + }; + }; + + services.forgejo = { + enable = true; + settings = { + server = { + DOMAIN = "git.barrettruth.com"; + ROOT_URL = "https://git.barrettruth.com/"; + HTTP_PORT = 3000; + }; + service.DISABLE_REGISTRATION = true; + }; + }; + + environment.systemPackages = with pkgs; [ + vim + git + ]; + + nix.settings = { + auto-optimise-store = true; + experimental-features = [ + "nix-command" + "flakes" + ]; + }; + + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + + system.stateVersion = "24.11"; +} diff --git a/hosts/netcup/disk-config.nix b/hosts/netcup/disk-config.nix new file mode 100644 index 0000000..b99297e --- /dev/null +++ b/hosts/netcup/disk-config.nix @@ -0,0 +1,32 @@ +{ + disko.devices.disk.main = { + type = "disk"; + device = "/dev/vda"; + content = { + type = "gpt"; + partitions = { + boot = { + size = "1M"; + type = "EF02"; + }; + esp = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; +} diff --git a/new b/new new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/new @@ -0,0 +1 @@ + diff --git a/scripts/ctl b/scripts/ctl index 63694b7..317902a 100755 --- a/scripts/ctl +++ b/scripts/ctl @@ -126,6 +126,7 @@ audio) --mesg="$header" --mesg-mode=expand \ --font="monospace:size=12" --width="$fw") rc=$? + [ "$rc" = 10 ] && continue [ "$rc" = 11 ] && { wpctl set-volume "$node" 5%+ --limit 1.0 continue @@ -532,6 +533,50 @@ power) "$shutdown") systemctl poweroff ;; esac ;; +dictate) + require pw-record whisper-cli wl-copy notify-send + dtmp="${XDG_RUNTIME_DIR:-/tmp}/dictation" + mkdir -p "$dtmp" + dpid="$dtmp/rec_pid" + daudio="$dtmp/recording.wav" + dmodel="${DICTATE_MODEL:-large-v3-turbo}" + dmodel_dir="${XDG_DATA_HOME:-$HOME/.local/share}/whisper-models" + dmodel_file="$dmodel_dir/ggml-$dmodel.bin" + + if [ -f "$dpid" ] && kill -0 "$(cat "$dpid")" 2>/dev/null; then + kill "$(cat "$dpid")" 2>/dev/null + rm -f "$dpid" + sleep 0.2 + if [ ! -s "$daudio" ]; then + notify-send -a ctl -t 1250 "no audio" + exit 1 + fi + notify-send -a ctl -t 1250 "transcribing..." + text=$(whisper-cli \ + --model "$dmodel_file" \ + --language "${DICTATE_LANG:-en}" \ + --no-prints --no-timestamps \ + "$daudio" 2>/dev/null | tr '\n' ' ' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | tr -s ' ') + rm -f "$daudio" + if [ -z "$text" ]; then + notify-send -a ctl -t 1250 "no speech detected" + exit 1 + fi + printf '%s' "$text" | wl-copy + notify-send -a ctl -t 1250 "$text" + exit 0 + fi + + if [ ! -f "$dmodel_file" ]; then + notify-send -a ctl -t 1250 "downloading whisper $dmodel model..." + mkdir -p "$dmodel_dir" + curl -L -o "$dmodel_file" \ + "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-$dmodel.bin" + fi + notify-send -a ctl -t 1250 "recording..." + pw-record "$daudio" & + printf '%s' "$!" > "$dpid" + ;; idle) require notify-send if systemctl --user is-active --quiet hypridle.service; then @@ -545,7 +590,7 @@ idle) fi ;; *) - echo "Usage: ctl {screenshot|keyboard|audio|wifi|brightness|volume|media|wallpaper|power|idle|clip}" >&2 + echo "Usage: ctl {screenshot|keyboard|audio|wifi|brightness|volume|media|wallpaper|power|idle|clip|dictate}" >&2 exit 1 ;; esac diff --git a/scripts/nvim-inverse-search b/scripts/nvim-inverse-search new file mode 100755 index 0000000..2c8a0eb --- /dev/null +++ b/scripts/nvim-inverse-search @@ -0,0 +1,13 @@ +#!/bin/sh + +file="$1" +line="$2" + +for sock in /run/user/"$(id -u)"/nvim.*.0; do + [ -S "$sock" ] || continue + result=$(nvim --headless --server "$sock" --remote-expr "bufnr('$file')" 2>/dev/null) + if [ "$result" != "-1" ] && [ -n "$result" ]; then + nvim --headless --server "$sock" --remote-expr "execute('b +$line $file | normal! zz')" >/dev/null 2>&1 + exit 0 + fi +done