From 652c34791de753286726d5d6732447a1f320d740 Mon Sep 17 00:00:00 2001 From: OCbwoy3 Date: Thu, 21 Aug 2025 14:40:22 +0300 Subject: [PATCH] knot --- flake.lock | 208 +++++++++++++++++++++++++++++++-- flake.nix | 2 + hosts/server/configuration.nix | 16 ++- hosts/server/modules/knot.nix | 15 +++ 4 files changed, 227 insertions(+), 14 deletions(-) create mode 100644 hosts/server/modules/knot.nix diff --git a/flake.lock b/flake.lock index 9bfce9d..51b55b5 100644 --- a/flake.lock +++ b/flake.lock @@ -197,6 +197,24 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_6" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "ghostty": { "inputs": { "flake-compat": "flake-compat", @@ -241,6 +259,28 @@ "type": "github" } }, + "gomod2nix": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "tangled", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1754078208, + "narHash": "sha256-YVoIFDCDpYuU3riaDEJ3xiGdPOtsx4sR5eTzHTytPV8=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "7f963246a71626c7fc70b431a315c4388a0c95cf", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": "nixpkgs_3" @@ -280,6 +320,30 @@ "type": "github" } }, + "htmx-src": { + "flake": false, + "locked": { + "narHash": "sha256-nm6avZuEBg67SSyyZUhjpXVNstHHgUxrtBHqJgowU08=", + "type": "file", + "url": "https://unpkg.com/htmx.org@2.0.4/dist/htmx.min.js" + }, + "original": { + "type": "file", + "url": "https://unpkg.com/htmx.org@2.0.4/dist/htmx.min.js" + } + }, + "htmx-ws-src": { + "flake": false, + "locked": { + "narHash": "sha256-2fg6KyEJoO24q0fQqbz9RMaYNPQrMwpZh29tkSqdqGY=", + "type": "file", + "url": "https://cdn.jsdelivr.net/npm/htmx-ext-ws@2.0.2" + }, + "original": { + "type": "file", + "url": "https://cdn.jsdelivr.net/npm/htmx-ext-ws@2.0.2" + } + }, "hyprcursor": { "inputs": { "hyprlang": [ @@ -801,6 +865,61 @@ "type": "github" } }, + "ibm-plex-mono-src": { + "flake": false, + "locked": { + "lastModified": 1731402384, + "narHash": "sha256-OwUmrPfEehLDz0fl2ChYLK8FQM2p0G1+EMrGsYEq+6g=", + "type": "tarball", + "url": "https://github.com/IBM/plex/releases/download/@ibm/plex-mono@1.1.0/ibm-plex-mono.zip" + }, + "original": { + "type": "tarball", + "url": "https://github.com/IBM/plex/releases/download/@ibm/plex-mono@1.1.0/ibm-plex-mono.zip" + } + }, + "indigo": { + "flake": false, + "locked": { + "lastModified": 1753693716, + "narHash": "sha256-DMIKnCJRODQXEHUxA+7mLzRALmnZhkkbHlFT2rCQYrE=", + "owner": "oppiliappan", + "repo": "indigo", + "rev": "5f170569da9360f57add450a278d73538092d8ca", + "type": "github" + }, + "original": { + "owner": "oppiliappan", + "repo": "indigo", + "type": "github" + } + }, + "inter-fonts-src": { + "flake": false, + "locked": { + "lastModified": 1731687360, + "narHash": "sha256-5vdKKvHAeZi6igrfpbOdhZlDX2/5+UvzlnCQV6DdqoQ=", + "type": "tarball", + "url": "https://github.com/rsms/inter/releases/download/v4.1/Inter-4.1.zip" + }, + "original": { + "type": "tarball", + "url": "https://github.com/rsms/inter/releases/download/v4.1/Inter-4.1.zip" + } + }, + "lucide-src": { + "flake": false, + "locked": { + "lastModified": 1754044466, + "narHash": "sha256-+exBR2OToB1iv7ZQI2S4B0lXA/QRvC9n6U99UxGpJGs=", + "type": "tarball", + "url": "https://github.com/lucide-icons/lucide/releases/download/0.536.0/lucide-icons-0.536.0.zip" + }, + "original": { + "type": "tarball", + "url": "https://github.com/lucide-icons/lucide/releases/download/0.536.0/lucide-icons-0.536.0.zip" + } + }, "mnw": { "locked": { "lastModified": 1748710831, @@ -864,6 +983,22 @@ "type": "github" } }, + "nixpkgs_10": { + "locked": { + "lastModified": 1743448293, + "narHash": "sha256-bmEPmSjJakAp/JojZRrUvNcDX2R5/nuX6bm+seVaGhs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "77b584d61ff80b4cef9245829a6f1dfad5afdfa3", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1748189127, @@ -959,11 +1094,11 @@ }, "nixpkgs_8": { "locked": { - "lastModified": 1754725699, - "narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=", + "lastModified": 1751984180, + "narHash": "sha256-LwWRsENAZJKUdD3SpLluwDmdXY9F45ZEgCb0X+xgOL0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "85dbfc7aaf52ecb755f87e577ddbe6dbbdbc1054", + "rev": "9807714d6944a957c2e036f84b0ff8caf9930bc0", "type": "github" }, "original": { @@ -975,11 +1110,11 @@ }, "nixpkgs_9": { "locked": { - "lastModified": 1743448293, - "narHash": "sha256-bmEPmSjJakAp/JojZRrUvNcDX2R5/nuX6bm+seVaGhs=", + "lastModified": 1754725699, + "narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=", "owner": "nixos", "repo": "nixpkgs", - "rev": "77b584d61ff80b4cef9245829a6f1dfad5afdfa3", + "rev": "85dbfc7aaf52ecb755f87e577ddbe6dbbdbc1054", "type": "github" }, "original": { @@ -1046,10 +1181,24 @@ "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_6", "nvf": "nvf", + "tangled": "tangled", "tuxstrap": "tuxstrap", "zen-browser": "zen-browser" } }, + "sqlite-lib-src": { + "flake": false, + "locked": { + "lastModified": 1706631843, + "narHash": "sha256-bJoMjirsBjm2Qk9KPiy3yV3+8b/POlYe76/FQbciHro=", + "type": "tarball", + "url": "https://sqlite.org/2024/sqlite-amalgamation-3450100.zip" + }, + "original": { + "type": "tarball", + "url": "https://sqlite.org/2024/sqlite-amalgamation-3450100.zip" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -1140,6 +1289,47 @@ "type": "github" } }, + "systems_7": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "tangled": { + "inputs": { + "gomod2nix": "gomod2nix", + "htmx-src": "htmx-src", + "htmx-ws-src": "htmx-ws-src", + "ibm-plex-mono-src": "ibm-plex-mono-src", + "indigo": "indigo", + "inter-fonts-src": "inter-fonts-src", + "lucide-src": "lucide-src", + "nixpkgs": "nixpkgs_8", + "sqlite-lib-src": "sqlite-lib-src" + }, + "locked": { + "lastModified": 1755765999, + "narHash": "sha256-qEsmMjglgA58Z9lfZZdSXUiQxTjBxbJhbzWMqLckPTs=", + "ref": "refs/heads/master", + "rev": "c48c7f1dbb3080e8d90af5808394129c45a9f6c4", + "revCount": 1189, + "type": "git", + "url": "https://tangled.sh/@tangled.sh/core" + }, + "original": { + "type": "git", + "url": "https://tangled.sh/@tangled.sh/core" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -1165,8 +1355,8 @@ "tuxstrap": { "inputs": { "bun2nix": "bun2nix", - "nixpkgs": "nixpkgs_8", - "systems": "systems_6" + "nixpkgs": "nixpkgs_9", + "systems": "systems_7" }, "locked": { "lastModified": 1755268726, @@ -1227,7 +1417,7 @@ "zen-browser": { "inputs": { "home-manager": "home-manager_2", - "nixpkgs": "nixpkgs_9" + "nixpkgs": "nixpkgs_10" }, "locked": { "lastModified": 1752716941, diff --git a/flake.nix b/flake.nix index c19e492..95630dd 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,8 @@ nvf.url = "github:notashelf/nvf"; + tangled.url = "git+https://tangled.sh/@tangled.sh/core"; + # quickshell = { # url = "git+https://git.outfoxxed.me/outfoxxed/quickshell"; # # inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index a7ea394..7583020 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -4,6 +4,7 @@ imports = [ ./modules/atproto-pds.nix ./modules/cloudflare.nix + ./modules/knot.nix ../../modules/force.nix ]; @@ -16,16 +17,21 @@ after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { - Type = "oneshot"; - ExecStart = "${pkgs.pm2}/bin/pm2 ping"; + Type = "forking"; User = "ocbwoy3"; - Group = "wheel"; + LimitNOFILE = "infinity"; + LimitNPROC = "infinity"; + LimitCORE = "infinity"; + Environment = "PM2_HOME=/home/ocbwoy3/.pm2"; + PIDFile = "/home/ocbwoy3/.pm2/pm2.pid"; Restart = "on-failure"; - RestartSec = "5s"; + + ExecStart = "${pkgs.pm2}/bin/pm2 resurrect"; + ExecReload = "${pkgs.pm2}/bin/pm2 reload all"; + ExecStop = "${pkgs.pm2}/bin/pm2 kill"; }; }; - services.openssh.settings = { PubkeyAuthentication = "yes"; TrustedUserCAKeys = "/etc/ssh/ca.pub"; diff --git a/hosts/server/modules/knot.nix b/hosts/server/modules/knot.nix new file mode 100644 index 0000000..2db502b --- /dev/null +++ b/hosts/server/modules/knot.nix @@ -0,0 +1,15 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + inputs.tangled.nixosModules.knot + ]; + + services.tangled-knot = { + enable = true; + listenAddr = "0.0.0.0:3003"; + dataDir = "/var/lib/knot"; + secretFile = "/private/tangled.env"; + hostname = "knot.ocbwoy3.dev"; + }; +}