From 11d1d4679427ea64b787392a2297afc4b6b92143 Mon Sep 17 00:00:00 2001 From: dawn <90008@klbr.net> Date: Mon, 8 Jun 2026 00:36:21 +0300 Subject: [PATCH] awa --- _sources/generated.json | 8 +- _sources/generated.nix | 8 +- dns/dnsconfig.js | 5 +- hosts/chernobog/modules/llm.nix | 20 +++-- .../modules/bobbin.nix | 7 +- hosts/{volsinii => trimounts}/modules/plc.nix | 16 +--- .../{volsinii => trimounts}/modules/relay.nix | 14 ++-- .../modules/slingshot.nix | 2 +- hosts/trimounts/modules/website.nix | 40 +++++----- .../{wisp-random.nix => wisp-random.disabled} | 0 pkgs-set/exported.nix | 1 + pkgs-set/pkgs/llama-cpp-rocm.nix | 76 +++++++++++++++++++ pkgs-set/pkgs/llama-cpp.nix | 44 ++++++----- users/modules/git/default.nix | 2 +- 14 files changed, 160 insertions(+), 83 deletions(-) rename hosts/{volsinii => trimounts}/modules/bobbin.nix (95%) rename hosts/{volsinii => trimounts}/modules/plc.nix (58%) rename hosts/{volsinii => trimounts}/modules/relay.nix (81%) rename hosts/{volsinii => trimounts}/modules/slingshot.nix (97%) rename hosts/trimounts/modules/{wisp-random.nix => wisp-random.disabled} (100%) create mode 100644 pkgs-set/pkgs/llama-cpp-rocm.nix diff --git a/_sources/generated.json b/_sources/generated.json index 7ea0968..b57c74d 100644 --- a/_sources/generated.json +++ b/_sources/generated.json @@ -246,7 +246,7 @@ }, "hydrant": { "cargoLock": null, - "date": "2026-05-30", + "date": "2026-06-07", "extract": null, "name": "hydrant", "passthru": null, @@ -256,13 +256,13 @@ "fetchSubmodules": false, "leaveDotGit": false, "name": null, - "rev": "0fd0b621ef7bf4e5bf2636c67f96e84fa3926295", - "sha256": "sha256-nVgbZByDrhyFU0NB/gfHkG8ZW/da1ZwQ/sVtAFHQguI=", + "rev": "fce50c7782152ac36dd12a4121f92c5eae819f0c", + "sha256": "sha256-TSoHRcAB4Lca7ieRxqtWEHoSptSW19kPb36mRLzZxsk=", "sparseCheckout": [], "type": "git", "url": "https://tangled.org/@ptr.pet/hydrant" }, - "version": "0fd0b621ef7bf4e5bf2636c67f96e84fa3926295" + "version": "fce50c7782152ac36dd12a4121f92c5eae819f0c" }, "limbusart": { "cargoLock": null, diff --git a/_sources/generated.nix b/_sources/generated.nix index d83f6fa..2792292 100644 --- a/_sources/generated.nix +++ b/_sources/generated.nix @@ -166,17 +166,17 @@ }; hydrant = { pname = "hydrant"; - version = "0fd0b621ef7bf4e5bf2636c67f96e84fa3926295"; + version = "fce50c7782152ac36dd12a4121f92c5eae819f0c"; src = fetchgit { url = "https://tangled.org/@ptr.pet/hydrant"; - rev = "0fd0b621ef7bf4e5bf2636c67f96e84fa3926295"; + rev = "fce50c7782152ac36dd12a4121f92c5eae819f0c"; fetchSubmodules = false; deepClone = false; leaveDotGit = false; sparseCheckout = [ ]; - sha256 = "sha256-nVgbZByDrhyFU0NB/gfHkG8ZW/da1ZwQ/sVtAFHQguI="; + sha256 = "sha256-TSoHRcAB4Lca7ieRxqtWEHoSptSW19kPb36mRLzZxsk="; }; - date = "2026-05-30"; + date = "2026-06-07"; }; limbusart = { pname = "limbusart"; diff --git a/dns/dnsconfig.js b/dns/dnsconfig.js index 9322c7e..28c166d 100644 --- a/dns/dnsconfig.js +++ b/dns/dnsconfig.js @@ -95,9 +95,9 @@ D( "klbr.net", REG_NONE, DnsProvider(DSP_PRIMARY), - TRIMOUNTS(["api.compare.plc", "api.spool", "bsky", "drop"]), + TRIMOUNTS(["api.compare.plc", "api.spool", "bsky", "drop", "bobbin", "plc", "relay", "sl"]), DZWONEK("vpn"), - VOLSINII(["bobbin", "plc", "relay", "sl"]), + // VOLSINII(["bobbin", "plc", "relay", "sl"]), TXT("@", "data endpoint for services and projects that fall under klbr.net."), TXT( "@", @@ -146,6 +146,7 @@ D( TXT("@", "v=spf1 -all"), TXT("_dmarc", "v=DMARC1; p=reject;"), TXT("_atproto", "did=did:plc:dumbmutt4po52ept2tczimje", TTL(60)), + TXT("_atproto.a", "did=did:plc:dumbmutt4po52ept2tczimje", TTL(60)), IGNORE_ACME(), ); diff --git a/hosts/chernobog/modules/llm.nix b/hosts/chernobog/modules/llm.nix index 1cbf55e..22bff97 100644 --- a/hosts/chernobog/modules/llm.nix +++ b/hosts/chernobog/modules/llm.nix @@ -1,14 +1,18 @@ -{pkgs, terra, ...}: +{terra, ...}: let - llama = (terra.llama-cpp.override { - blasSupport = true; - vulkanSupport = true; - cudaSupport = false; - rocmSupport = false; - }).overrideAttrs (old: { + llama = (terra.llama-cpp-rocm).overrideAttrs (old: { doCheck = false; cmakeFlags = (old.cmakeFlags or []) ++ ["-DGGML_AVX2=ON" "-DGGML_FMA=ON" "-DGGML_F16C=ON"]; }); + # llama = (terra.llama-cpp.override { + # vulkanSupport = true; + # blasSupport = true; + # rocmSupport = false; + # cudaSupport = false; + # }).overrideAttrs (old: { + # doCheck = false; + # cmakeFlags = (old.cmakeFlags or []) ++ ["-DGGML_AVX2=ON" "-DGGML_FMA=ON" "-DGGML_F16C=ON"]; + # }); in { hardware.amdgpu.opencl.enable = true; @@ -26,4 +30,4 @@ in { # }; environment.systemPackages = [llama]; -} \ No newline at end of file +} diff --git a/hosts/volsinii/modules/bobbin.nix b/hosts/trimounts/modules/bobbin.nix similarity index 95% rename from hosts/volsinii/modules/bobbin.nix rename to hosts/trimounts/modules/bobbin.nix index 0de23e5..c8c6bd4 100644 --- a/hosts/volsinii/modules/bobbin.nix +++ b/hosts/trimounts/modules/bobbin.nix @@ -41,15 +41,16 @@ in ]; environment = { HYDRANT_API_BIND = "127.0.0.1:${toString hydrantPort}"; + # HYDRANT_RELAY_HOSTS = "http://127.0.0.1:13579"; + HYDRANT_RELAY_HOSTS = "https://bsky.network"; # HYDRANT_PLC_URL = "http://127.0.0.1:8000"; - HYDRANT_RELAY_HOSTS = "http://127.0.0.1:13579"; HYDRANT_PLC_URL = "https://plc.directory"; HYDRANT_FILTER_SIGNALS = "sh.tangled.actor.profile,sh.tangled.feed.reaction,sh.tangled.feed.star,sh.tangled.git.refUpdate,sh.tangled.graph.follow,sh.tangled.graph.vouch,sh.tangled.knot,sh.tangled.knot.member,sh.tangled.label.definition,sh.tangled.label.op,sh.tangled.pipeline,sh.tangled.pipeline.status,sh.tangled.publicKey,sh.tangled.repo,sh.tangled.repo.artifact,sh.tangled.repo.collaborator,sh.tangled.repo.issue,sh.tangled.repo.issue.comment,sh.tangled.repo.issue.state,sh.tangled.repo.pull,sh.tangled.repo.pull.comment,sh.tangled.repo.pull.status,sh.tangled.spindle,sh.tangled.spindle.member,sh.tangled.string"; HYDRANT_FILTER_COLLECTIONS = "sh.tangled.*"; HYDRANT_VERIFY_SIGNATURES = "none"; HYDRANT_REPO_FETCH_TIMEOUT = "1h"; - HYDRANT_FIREHOSE_WORKERS = "24"; - HYDRANT_BACKFILL_CONCURRENCY_LIMIT = "64"; + HYDRANT_FIREHOSE_WORKERS = "8"; + HYDRANT_BACKFILL_CONCURRENCY_LIMIT = "32"; }; serviceConfig = { Type = "simple"; diff --git a/hosts/volsinii/modules/plc.nix b/hosts/trimounts/modules/plc.nix similarity index 58% rename from hosts/volsinii/modules/plc.nix rename to hosts/trimounts/modules/plc.nix index 465cf68..4d385da 100644 --- a/hosts/volsinii/modules/plc.nix +++ b/hosts/trimounts/modules/plc.nix @@ -1,15 +1,5 @@ { - services.nginx.virtualHosts."plc.gaze.systems" = { - useACMEHost = "plc.gaze.systems"; - forceSSL = true; - quic = true; - kTLS = true; - locations."/" = { - proxyPass = "http://localhost:8000"; - proxyWebsockets = true; - }; - }; - + security.acme.certs."plc.klbr.net" = {}; services.nginx.virtualHosts."plc.klbr.net" = { useACMEHost = "plc.klbr.net"; forceSSL = true; @@ -28,8 +18,8 @@ environment = { RUST_LOG="allegedly=debug"; }; serviceConfig = { Type = "simple"; - WorkingDirectory = "/root/allegedly2"; - ExecStart = "/root/allegedly2/target/release/allegedly mirror --wrap-fjall /root/plc3"; + WorkingDirectory = "/root/allegedly"; + ExecStart = "/root/allegedly/target/release/allegedly mirror --wrap-fjall /root/plc3"; Restart = "on-failure"; RestartSec = "5s"; }; diff --git a/hosts/volsinii/modules/relay.nix b/hosts/trimounts/modules/relay.nix similarity index 81% rename from hosts/volsinii/modules/relay.nix rename to hosts/trimounts/modules/relay.nix index 4b5fe88..5f641a4 100644 --- a/hosts/volsinii/modules/relay.nix +++ b/hosts/trimounts/modules/relay.nix @@ -3,7 +3,7 @@ let port = "13579"; pkg = terra.hydrant.overrideAttrs (old: { cargoBuildNoDefaultFeatures = true; - cargoBuildFeatures = ["relay" "jetstream"]; + cargoBuildFeatures = ["relay" "jetstream" "firehose-diagnostics"]; doCheck = false; }); in @@ -15,20 +15,22 @@ in }; users.groups.hydrant = { }; - systemd.services.hydrant = { + systemd.services.relay = { description = "hydrant atproto relay"; wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; environment = { HYDRANT_API_BIND = "0.0.0.0:${port},[::]:${port}"; - HYDRANT_CURSOR_SAVE_INTERVAL = "1sec"; - HYDRANT_SEED_HOSTS = "https://relay.bas.sh,https://bsky.network"; + HYDRANT_CURSOR_SAVE_INTERVAL = "3sec"; + HYDRANT_SEED_HOSTS = "https://relay.bas.sh"; + # HYDRANT_PLC_URL = "http://127.0.0.1:8000"; HYDRANT_PLC_URL = "https://plc.directory"; HYDRANT_DATA_COMPRESSION = "zstd"; HYDRANT_JOURNAL_COMPRESSION = "zstd"; HYDRANT_RATE_TIERS = "default:5000/10.0/18000000/432000000/10000000"; HYDRANT_EPHEMERAL = "true"; HYDRANT_EPHEMERAL_TTL = "1d"; + RUST_LOG="info,hydrant::ingest::firehose=debug,hydrant::control::firehose=debug,hydrant::control::seed=info"; }; serviceConfig = { Type = "simple"; @@ -63,9 +65,9 @@ in } ]; - security.acme.certs."plc.klbr.net".extraDomainNames = [ "relay.klbr.net" ]; + security.acme.certs."relay.klbr.net" = {}; services.nginx.virtualHosts."relay.klbr.net" = { - useACMEHost = "plc.klbr.net"; + useACMEHost = "relay.klbr.net"; forceSSL = true; quic = true; kTLS = true; diff --git a/hosts/volsinii/modules/slingshot.nix b/hosts/trimounts/modules/slingshot.nix similarity index 97% rename from hosts/volsinii/modules/slingshot.nix rename to hosts/trimounts/modules/slingshot.nix index c3c1f24..c02b60b 100644 --- a/hosts/volsinii/modules/slingshot.nix +++ b/hosts/trimounts/modules/slingshot.nix @@ -33,7 +33,7 @@ in --cache-dir /var/lib/slingshot/cache \ --bind 127.0.0.1:${toString port} \ --record-cache-memory-mb 1024 \ - --record-cache-disk-gb 72 \ + --record-cache-disk-gb 8 \ --identity-cache-memory-mb 1024 \ --identity-cache-disk-gb 8 \ --collect-metrics \ diff --git a/hosts/trimounts/modules/website.nix b/hosts/trimounts/modules/website.nix index c7f5741..e7d5985 100644 --- a/hosts/trimounts/modules/website.nix +++ b/hosts/trimounts/modules/website.nix @@ -16,20 +16,20 @@ let port = 3003; vhostConfig = { locations."/".proxyPass = "http://localhost:${toString port}"; - locations."/annoy/ws/" = { - proxyWebsockets = true; - proxyPass = "http://100.64.0.9:3111/"; - extraConfig = '' - rewrite ^/annoy/ws/(.*) /$1 break; - ''; - }; - locations."/annoy/ws" = { - proxyWebsockets = true; - proxyPass = "http://100.64.0.9:3111/"; - extraConfig = '' - rewrite ^/annoy/ws(.*) /$1 break; - ''; - }; + # locations."/annoy/ws/" = { + # proxyWebsockets = true; + # proxyPass = "http://100.64.0.9:3111/"; + # extraConfig = '' + # rewrite ^/annoy/ws/(.*) /$1 break; + # ''; + # }; + # locations."/annoy/ws" = { + # proxyWebsockets = true; + # proxyPass = "http://100.64.0.9:3111/"; + # extraConfig = '' + # rewrite ^/annoy/ws(.*) /$1 break; + # ''; + # }; extraConfig = '' if ($http_user_agent ~* "Synapse") { return 403; @@ -83,14 +83,8 @@ in # Unit = "annoy-keep-alive.service"; # }; - services.nginx.virtualHosts."gaze.systems" = vhostConfig; services.nginx.virtualHosts."ptr.pet" = vhostConfig; - services.nginx.virtualHosts."poor.dog" = vhostConfig; - - # services.nginx.virtualHosts."poor.dog" = { - # locations."=/".return = "301 https://gaze.systems$request_uri"; - # }; - # services.nginx.virtualHosts."ptr.pet" = { - # locations."=/".return = "301 https://gaze.systems$request_uri"; - # }; + services.nginx.virtualHosts."gaze.systems" = { + locations."=/".return = "301 https://ptr.pet$request_uri"; + }; } diff --git a/hosts/trimounts/modules/wisp-random.nix b/hosts/trimounts/modules/wisp-random.disabled similarity index 100% rename from hosts/trimounts/modules/wisp-random.nix rename to hosts/trimounts/modules/wisp-random.disabled diff --git a/pkgs-set/exported.nix b/pkgs-set/exported.nix index 37693df..0f2cfbf 100644 --- a/pkgs-set/exported.nix +++ b/pkgs-set/exported.nix @@ -2,5 +2,6 @@ "comic-mono" "ik-llama-cpp" "llama-cpp-mtp" + "llama-cpp-rocm" "percli" ] diff --git a/pkgs-set/pkgs/llama-cpp-rocm.nix b/pkgs-set/pkgs/llama-cpp-rocm.nix new file mode 100644 index 0000000..0c0a644 --- /dev/null +++ b/pkgs-set/pkgs/llama-cpp-rocm.nix @@ -0,0 +1,76 @@ +{ + lib, + fetchurl, + makeWrapper, + nix-update-script, + patchelf, + stdenv, + stdenvNoCC, + unzip, + + releaseTag ? "b1290", + gpuVariant ? "gfx110X", + assetHash ? "sha256-yA5JhGn6uc7CVSwsFc+IwpGOKvCVmKIItfr3/LmBtGc=", + ... +}: + +let + assetName = "llama-${releaseTag}-ubuntu-rocm-${gpuVariant}-x64.zip"; + runtimeLibPath = lib.makeLibraryPath [ stdenv.cc.cc ]; +in +stdenvNoCC.mkDerivation { + pname = "llama-cpp-rocm"; + version = lib.removePrefix "b" releaseTag; + + src = fetchurl { + url = "https://github.com/lemonade-sdk/llamacpp-rocm/releases/download/${releaseTag}/${assetName}"; + hash = assetHash; + }; + + nativeBuildInputs = [ + makeWrapper + patchelf + unzip + ]; + + dontUnpack = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + unzip -q "$src" -d "$out/bin" + + find "$out/bin" -maxdepth 1 -type f -name 'lib*.so*' -exec chmod 0644 {} + + find "$out/bin" -maxdepth 1 -type f ! -name 'lib*.so*' -exec chmod 0755 {} + + + find "$out/bin" -maxdepth 1 -type f -executable | while read -r prog; do + patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" "$prog" + wrapProgram "$prog" \ + --prefix LD_LIBRARY_PATH : "$out/bin:${runtimeLibPath}" \ + --set-default ROCBLAS_TENSILE_LIBPATH "$out/bin/rocblas/library" \ + --set-default HIPBLASLT_TENSILE_LIBPATH "$out/bin/hipblaslt/library" + done + + runHook postInstall + ''; + + passthru = { + updateScript = nix-update-script { + attrPath = "llama-cpp-rocm"; + extraArgs = [ + "--version-regex" + "b(.*)" + ]; + }; + }; + + meta = { + description = "Prebuilt llama.cpp ROCm binaries repackaged from lemonade-sdk releases"; + homepage = "https://github.com/lemonade-sdk/llamacpp-rocm"; + license = lib.licenses.mit; + mainProgram = "llama"; + platforms = lib.platforms.linux; + }; +} diff --git a/pkgs-set/pkgs/llama-cpp.nix b/pkgs-set/pkgs/llama-cpp.nix index f805258..39f0115 100644 --- a/pkgs-set/pkgs/llama-cpp.nix +++ b/pkgs-set/pkgs/llama-cpp.nix @@ -15,6 +15,8 @@ rocmPackages ? { }, rocmGpuTargets ? rocmPackages.clr.localGpuTargets or rocmPackages.clr.gpuTargets, + cpuArchDynamicDispatch ? true, + openclSupport ? false, clblast, @@ -40,11 +42,8 @@ shaderc, vulkan-headers, vulkan-loader, + spirv-headers, ninja, - - # -march=native is non-deterministic; override with platform-specific flags if needed - native ? false, - ... }: @@ -83,7 +82,7 @@ let in effectiveStdenv.mkDerivation (finalAttrs: { pname = "llama-cpp"; - version = "9095"; + version = "9493"; outputs = [ "out" @@ -91,11 +90,12 @@ effectiveStdenv.mkDerivation (finalAttrs: { ]; src = fetchFromGitHub { - owner = "ggml-org"; + # owner = "ggml-org"; + owner = "am17an"; repo = "llama.cpp"; - tag = "b${finalAttrs.version}"; - # rev = "b8635075ffe27b135c49afb9a8b5c434bd42c502"; - hash = "sha256-BVRp+T4eKZYS0aT4SGx/M/k9HJ7V74M1z5OTOasFl8E="; + # tag = "b${finalAttrs.version}"; + rev = "efd651a8ef2cd13d6c7bb22358659fb64f9e3b18"; + hash = "sha256-azzi78+aTVuXES7JZ/HTUNmJgC6vo4fozhmPbOEsGoU="; leaveDotGit = true; postFetch = '' git -C "$out" rev-parse --short HEAD > $out/COMMIT @@ -105,10 +105,6 @@ effectiveStdenv.mkDerivation (finalAttrs: { patches = [ ]; - postPatch = '' - find tools/server/public -type f -not -name loading.html -delete - ''; - nativeBuildInputs = [ cmake installShellFiles @@ -116,6 +112,7 @@ effectiveStdenv.mkDerivation (finalAttrs: { nodejs npmHooks.npmConfigHook pkg-config + spirv-headers ] ++ optionals cudaSupport [ cudaPackages.cuda_nvcc @@ -130,8 +127,8 @@ effectiveStdenv.mkDerivation (finalAttrs: { ++ optionals vulkanSupport vulkanBuildInputs ++ [ openssl ]; - npmRoot = "tools/server/webui"; - npmDepsHash = "sha256-RAFtsbBGBjteCt5yXhrmHL39rIDJMCFBETgzId2eRRk="; + npmRoot = "tools/ui"; + npmDepsHash = "sha256-pjdbI6NcZRlJVd62xhgbLhWrwFYwgsIwjORqvo1+VD8="; npmDeps = fetchNpmDeps { name = "${finalAttrs.pname}-${finalAttrs.version}-npm-deps"; inherit (finalAttrs) src patches; @@ -149,7 +146,7 @@ effectiveStdenv.mkDerivation (finalAttrs: { ''; cmakeFlags = [ - (cmakeBool "GGML_NATIVE" native) + (cmakeBool "GGML_NATIVE" false) # -march=native would make builds non-deterministic (cmakeBool "LLAMA_BUILD_EXAMPLES" false) (cmakeBool "LLAMA_BUILD_SERVER" true) (cmakeBool "LLAMA_BUILD_TESTS" (finalAttrs.finalPackage.doCheck or false)) @@ -164,6 +161,18 @@ effectiveStdenv.mkDerivation (finalAttrs: { (cmakeBool "GGML_VULKAN" vulkanSupport) (cmakeFeature "LLAMA_BUILD_NUMBER" finalAttrs.version) ] + ++ optionals cpuArchDynamicDispatch [ + # Build all CPU backend variants for runtime dynamic dispatch. + # This avoids illegal instructions on older CPUs and gives optimal performance + # on newer ones without needing separate builds. + # Enabling AVX2 can make CPU inference 13x faster compared to NixOS's x86_64 defaults. + # Note it is not a bug that the CPU variant .so files are placed in `bin/` + # (as opposed to `lib/`) alongside the executables by upstream's `CMakeLists.txt` design: + # * https://github.com/ggml-org/llama.cpp/blob/b46812de78f8fbcb6cf0154947e8633ebc78d9ac/ggml/src/CMakeLists.txt#L249-L252 + # * https://github.com/ggml-org/llama.cpp/blob/b46812de78f8fbcb6cf0154947e8633ebc78d9ac/ggml/src/ggml-backend-reg.cpp#L480-L486 + (cmakeBool "GGML_CPU_ALL_VARIANTS" true) + (cmakeBool "GGML_BACKEND_DL" true) + ] ++ optionals cudaSupport [ (cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cudaPackages.flags.cmakeCudaArchitecturesString) ] @@ -219,7 +228,6 @@ effectiveStdenv.mkDerivation (finalAttrs: { mainProgram = "llama"; maintainers = with lib.maintainers; [ booxter - dit7ya philiptaron xddxdd yuannan @@ -228,4 +236,4 @@ effectiveStdenv.mkDerivation (finalAttrs: { badPlatforms = optionals (cudaSupport || openclSupport) lib.platforms.darwin; broken = metalSupport && !effectiveStdenv.hostPlatform.isDarwin; }; -}) +}) \ No newline at end of file diff --git a/users/modules/git/default.nix b/users/modules/git/default.nix index 551128c..25dd13c 100644 --- a/users/modules/git/default.nix +++ b/users/modules/git/default.nix @@ -1,7 +1,7 @@ { pkgs, ... }: let name = "dawn"; - email = "90008@gaze.systems"; + email = "90008@klbr.net"; in { programs.git = { -- 2.51.2