Compare commits

..

2 commits

Author SHA1 Message Date
Hari
d482eb01e4
feat" diffkit self host" (#72)
Some checks are pending
quality / changes (push) Waiting to run
quality / Flake Check (push) Blocked by required conditions
quality / Nix Format Check (push) Blocked by required conditions
quality / Deploy netty (push) Blocked by required conditions
2026-04-14 12:44:16 -04:00
Hari
fa2260d8d5
feat: autocomplete (#71) 2026-04-14 12:43:57 -04:00
8 changed files with 108 additions and 5 deletions

View file

@ -44,7 +44,7 @@ return {
},
},
},
ghost_text = { enabled = true },
ghost_text = { enabled = false },
},
fuzzy = { implementation = "lua" },
sources = {

View file

@ -0,0 +1,19 @@
vim.pack.add({
"https://github.com/monkoose/neocodeium",
}, { load = function() end })
return {
"monkoose/neocodeium",
event = "InsertEnter",
after = function()
local neocodeium = require "neocodeium"
neocodeium.setup()
vim.keymap.set("i", "<Right>", neocodeium.accept)
vim.keymap.set("i", "<A-w>", neocodeium.accept_word)
vim.keymap.set("i", "<A-a>", neocodeium.accept_line)
vim.keymap.set("i", "<A-e>", neocodeium.cycle_or_complete)
vim.keymap.set("i", "<A-r>", function() neocodeium.cycle_or_complete(-1) end)
vim.keymap.set("i", "<A-c>", neocodeium.clear)
end,
}

View file

@ -17,4 +17,6 @@ map("x", "p", '"_dP')
map("n", "<Esc>", "<cmd>nohlsearch<cr>")
map("n", "<leader>t", "<cmd>setlocal wrap!<cr>")
map("n", "<C-W>]", "<cmd>vert winc ]<cr>")
map("t", "<Esc>", "<C-\\><C-n>")

View file

@ -51,9 +51,9 @@ in
stylua
tree-sitter
vscode-langservers-extracted
nodePackages.bash-language-server
nodePackages.typescript
nodePackages.typescript-language-server
bash-language-server
typescript
typescript-language-server
];
};

View file

@ -17,6 +17,7 @@ in
./nginx.nix
./vaultwarden.nix
./forgejo.nix
./diffkit.nix
./betternas.nix
./hermes-gateway.nix
./forgejo-runner.nix

71
hosts/netty/diffkit.nix Normal file
View file

@ -0,0 +1,71 @@
{
pkgs,
username,
...
}:
let
diffkitPort = "3200";
stateDir = "/var/lib/diffkit";
repoDir = "/home/${username}/Documents/GitHub/diffkit";
envFile = "${stateDir}/diffkit.env";
dbPath = "${stateDir}/diffkit.db";
migrationsDir = "${repoDir}/apps/dashboard/drizzle";
migrationScript = pkgs.writeShellScript "diffkit-migrate" ''
set -euo pipefail
DB="${dbPath}"
MIGRATIONS="${migrationsDir}"
${pkgs.sqlite}/bin/sqlite3 "$DB" "SELECT 1;" > /dev/null 2>&1 || true
${pkgs.sqlite}/bin/sqlite3 "$DB" \
"CREATE TABLE IF NOT EXISTS __drizzle_migrations (tag TEXT PRIMARY KEY, applied_at INTEGER NOT NULL);"
for sql_file in "$MIGRATIONS"/[0-9]*.sql; do
[ -f "$sql_file" ] || continue
tag=$(basename "$sql_file" .sql)
applied=$(${pkgs.sqlite}/bin/sqlite3 "$DB" "SELECT COUNT(*) FROM __drizzle_migrations WHERE tag='$tag';")
if [ "$applied" = "0" ]; then
echo "Applying migration: $tag"
${pkgs.gnused}/bin/sed 's/--> statement-breakpoint/;/g' "$sql_file" \
| ${pkgs.sqlite}/bin/sqlite3 "$DB"
${pkgs.sqlite}/bin/sqlite3 "$DB" \
"INSERT INTO __drizzle_migrations (tag, applied_at) VALUES ('$tag', strftime('%s','now'));"
fi
done
echo "Migrations complete."
'';
in
{
systemd.tmpfiles.rules = [
"d ${stateDir} 0750 ${username} users -"
"z ${envFile} 0600 ${username} users -"
];
systemd.services.diffkit = {
description = "diffkit GitHub Diff Viewer";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
environment = {
NODE_ENV = "production";
HOST = "127.0.0.1";
PORT = diffkitPort;
DATABASE_PATH = dbPath;
BETTER_AUTH_URL = "https://diffs.harivan.sh";
GITHUB_APP_PRIVATE_KEY_FILE = "${stateDir}/github-app-key.pem";
};
serviceConfig = {
Type = "simple";
User = username;
Group = "users";
WorkingDirectory = "${repoDir}/apps/dashboard";
ExecStartPre = migrationScript;
ExecStart = "${pkgs.nodejs_22}/bin/node node-server.mjs";
EnvironmentFile = "-${envFile}";
Restart = "on-failure";
RestartSec = 5;
};
};
}

View file

@ -6,6 +6,7 @@ let
forgejoDomain = "git.harivan.sh";
vaultDomain = "vault.harivan.sh";
betternasDomain = "api.betternas.com";
diffkitDomain = "diffs.harivan.sh";
in
{
security.acme = {
@ -43,6 +44,15 @@ in
locations."/".proxyPass = "http://127.0.0.1:8222";
};
virtualHosts.${diffkitDomain} = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:3200";
proxyWebsockets = true;
};
};
virtualHosts.${betternasDomain} = {
enableACME = true;
forceSSL = true;

View file

@ -11,7 +11,7 @@
git
just
nixfmt-tree
nodePackages.prettier
prettier
pre-commit
selene
shfmt