From 2bcc83c7d9edaa1c1e140c61ec30abacc06ae6fd Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 13 Mar 2026 08:16:08 -0400 Subject: [PATCH] feat: netcup host config --- config/nvim/.luacheckrc | 10 +-- config/nvim/lazy-lock.json | 10 +-- config/nvim/lua/plugins/dev.lua | 19 +++++ config/nvim/lua/plugins/guard.lua | 4 +- flake.lock | 21 +++++ flake.nix | 15 +++- hosts/netcup/configuration.nix | 126 ++++++++++++++++++++++++++++++ hosts/netcup/disk-config.nix | 32 ++++++++ new | 1 + scripts/nvim-inverse-search | 21 ++--- 10 files changed, 225 insertions(+), 34 deletions(-) create mode 100644 hosts/netcup/configuration.nix create mode 100644 hosts/netcup/disk-config.nix create mode 100644 new 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/plugins/dev.lua b/config/nvim/lua/plugins/dev.lua index 2250f2b..94e8a29 100644 --- a/config/nvim/lua/plugins/dev.lua +++ b/config/nvim/lua/plugins/dev.lua @@ -174,6 +174,12 @@ return { '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' }, @@ -376,6 +382,19 @@ return { 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/guard.lua b/config/nvim/lua/plugins/guard.lua index a7f002f..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') @@ -52,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/flake.lock b/flake.lock index e56aba1..ba1cfa1 100644 --- a/flake.lock +++ b/flake.lock @@ -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": [ @@ -198,6 +218,7 @@ "root": { "inputs": { "claude-code": "claude-code", + "disko": "disko", "home-manager": "home-manager", "neovim-nightly": "neovim-nightly", "nixos-hardware": "nixos-hardware", diff --git a/flake.nix b/flake.nix index 8f56f65..3f04b6c 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 @@ -153,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/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/nvim-inverse-search b/scripts/nvim-inverse-search index 8d87560..2c8a0eb 100755 --- a/scripts/nvim-inverse-search +++ b/scripts/nvim-inverse-search @@ -1,18 +1,13 @@ #!/bin/sh + file="$1" line="$2" -echo "$(date) file='$file' line='$line'" >> ~/.debug - -for sock in /run/user/$(id -u)/nvim.*.0; do - [ -S "$sock" ] || continue - result=$(nvim --server "$sock" --remote-expr "bufnr('$file')" 2>&1) - echo " sock='$sock' bufnr='$result'" >> ~/.debug - if [ "$result" != "-1" ] && [ -n "$result" ]; then - out=$(nvim --server "$sock" --remote-expr "execute('b +$line $file | normal! zz')" 2>&1) - echo " -> sent, result='$out'" >> ~/.debug - exit 0 - fi +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 - -echo " -> no match found" >> ~/.debug