From 3eb8b50d886f197ec5b842aadb022b026c9b2bfd Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Mon, 3 Nov 2025 17:08:57 +0800 Subject: [PATCH 01/33] override zlog with pkgconf data --- default.nix | 4 ++++ pkgs/z/zlog/package.nix | 51 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 pkgs/z/zlog/package.nix diff --git a/default.nix b/default.nix index 7831c2c..cf604a5 100644 --- a/default.nix +++ b/default.nix @@ -8,9 +8,13 @@ let cedro = cedro; capnpc = capnpc; }; + zlog_with_pkgconf = callPackage ./pkgs/z/zlog/package.nix { + with_pkgconf = true; + }; in { xbuild = xbuild; capnpc = capnpc; cedro = cedro; + zlog_with_pkgconf = zlog_with_pkgconf; } diff --git a/pkgs/z/zlog/package.nix b/pkgs/z/zlog/package.nix new file mode 100644 index 0000000..af28034 --- /dev/null +++ b/pkgs/z/zlog/package.nix @@ -0,0 +1,51 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + with_pkgconf? false, +}: + +let + meta = with lib; { + description = "Reliable, high-performance, thread safe, flexible, clear-model, pure C logging library"; + homepage = "https://hardysimpson.github.io/zlog/"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ matthiasbeyer ]; + mainProgram = "zlog-chk-conf"; + platforms = lib.platforms.unix; + }; + pname = "zlog"; + version = "1.2.18"; +in +stdenv.mkDerivation (finalAttrs: { + pname = pname; + version = version; + + src = fetchFromGitHub { + owner = "HardySimpson"; + repo = "zlog"; + tag = finalAttrs.version; + hash = "sha256-79yyOGKgqUR1KI2+ngZd7jfVcz4Dw1IxaYfBJyjsxYc="; + }; + + nativeBuildInputs = [ cmake ]; + + postInstall = '' + mkdir -p $out/lib/pkgconfig + cat >$out/lib/pkgconfig/zlog.pc < Date: Tue, 4 Nov 2025 15:20:57 +0800 Subject: [PATCH 02/33] add tiny log & unity-test --- default.nix | 2 ++ pkgs/t/tinylog/package.nix | 51 +++++++++++++++++++++++++++++++++++ pkgs/u/unity-test/package.nix | 28 +++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 pkgs/t/tinylog/package.nix create mode 100644 pkgs/u/unity-test/package.nix diff --git a/default.nix b/default.nix index cf604a5..4b2cec1 100644 --- a/default.nix +++ b/default.nix @@ -11,10 +11,12 @@ let zlog_with_pkgconf = callPackage ./pkgs/z/zlog/package.nix { with_pkgconf = true; }; + tinylog = callPackage ./pkgs/t/tinylog/package.nix {}; in { xbuild = xbuild; capnpc = capnpc; cedro = cedro; zlog_with_pkgconf = zlog_with_pkgconf; + tinylog = tinylog; } diff --git a/pkgs/t/tinylog/package.nix b/pkgs/t/tinylog/package.nix new file mode 100644 index 0000000..6d2be9e --- /dev/null +++ b/pkgs/t/tinylog/package.nix @@ -0,0 +1,51 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + with_pkgconf? false, +}: + +let + meta = with lib; { + description = "Tinylog is a lightweight C-language high performance log component for UNIX environment, It is high performance, asynchronized, thread-safe and process-safe log library for C/C++."; + homepage = "https://github.com/pymumu/tinylog"; + license = lib.licenses.mit; +# maintainers = with lib.maintainers; [ matthiasbeyer ]; +# mainProgram = "zlog-chk-conf"; + platforms = lib.platforms.unix; + }; + pname = "tlog"; + version = "1.0.0"; +in +stdenv.mkDerivation (finalAttrs: { + pname = pname; + version = version; + + src = fetchFromGitHub { + owner = "shen390s"; + repo = "tinylog"; + rev = "master"; + hash = "sha256-hyr9enK/ClO1v6dlGKTBKUvlXX5f166+CS0RyvYBRWI="; + }; + + nativeBuildInputs = [ cmake ]; + + postInstall = '' + mkdir -p $out/lib/pkgconfig + cat >$out/lib/pkgconfig/tinylog.pc < Date: Tue, 4 Nov 2025 15:55:38 +0800 Subject: [PATCH 03/33] use enhanced tinylog --- pkgs/t/tinylog/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/t/tinylog/package.nix b/pkgs/t/tinylog/package.nix index 6d2be9e..ee5daf7 100644 --- a/pkgs/t/tinylog/package.nix +++ b/pkgs/t/tinylog/package.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "shen390s"; repo = "tinylog"; rev = "master"; - hash = "sha256-hyr9enK/ClO1v6dlGKTBKUvlXX5f166+CS0RyvYBRWI="; + hash = "sha256-EvLoi4Yew7hE8wnogh7nJxoDsZbjphsHCCxuWzbWysA="; }; nativeBuildInputs = [ cmake ]; From 4dc03b821ea3eb388492866821689275ef51d251 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Tue, 4 Nov 2025 16:27:15 +0800 Subject: [PATCH 04/33] enable unity-test with color output --- default.nix | 2 ++ pkgs/u/unity-test/package.nix | 1 + 2 files changed, 3 insertions(+) diff --git a/default.nix b/default.nix index 4b2cec1..be69bc2 100644 --- a/default.nix +++ b/default.nix @@ -12,6 +12,7 @@ let with_pkgconf = true; }; tinylog = callPackage ./pkgs/t/tinylog/package.nix {}; + unity_test_with_color = callPackage ./pkgs/u/unity-test/package.nix {}; in { xbuild = xbuild; @@ -19,4 +20,5 @@ in cedro = cedro; zlog_with_pkgconf = zlog_with_pkgconf; tinylog = tinylog; + unity_test_with_color = unity_test_with_color; } diff --git a/pkgs/u/unity-test/package.nix b/pkgs/u/unity-test/package.nix index 4b0d280..4e80a92 100644 --- a/pkgs/u/unity-test/package.nix +++ b/pkgs/u/unity-test/package.nix @@ -17,6 +17,7 @@ stdenv.mkDerivation (finalAttrs: { }; nativeBuildInputs = [ cmake ]; + makeFlags = [ "UNITY_OUTPUT_COLOR=1" ]; doCheck = true; meta = { From da33929aab76dcc26871ca4c80efdeca99088bf3 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Tue, 4 Nov 2025 16:40:51 +0800 Subject: [PATCH 05/33] use colored unity-test --- flake.lock | 6 +++--- pkgs/u/unity-test/package.nix | 37 +++++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index 0c4da0f..b161c00 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1755615617, - "narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=", + "lastModified": 1762111121, + "narHash": "sha256-4vhDuZ7OZaZmKKrnDpxLZZpGIJvAeMtK6FKLJYUtAdw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "20075955deac2583bb12f07151c2df830ef346b4", + "rev": "b3d51a0365f6695e7dd5cdf3e180604530ed33b4", "type": "github" }, "original": { diff --git a/pkgs/u/unity-test/package.nix b/pkgs/u/unity-test/package.nix index 4e80a92..1f95e70 100644 --- a/pkgs/u/unity-test/package.nix +++ b/pkgs/u/unity-test/package.nix @@ -5,10 +5,20 @@ cmake, }: -stdenv.mkDerivation (finalAttrs: { +let pname = "unity-test"; version = "2.6.1"; - + meta = { + description = "Unity Unit Testing Framework"; + homepage = "https://www.throwtheswitch.org/unity"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.i01011001 ]; + }; +in +stdenv.mkDerivation (finalAttrs: { + pname = pname; + version = version; + src = fetchFromGitHub { owner = "ThrowTheSwitch"; repo = "Unity"; @@ -20,10 +30,21 @@ stdenv.mkDerivation (finalAttrs: { makeFlags = [ "UNITY_OUTPUT_COLOR=1" ]; doCheck = true; - meta = { - description = "Unity Unit Testing Framework"; - homepage = "https://www.throwtheswitch.org/unity"; - license = lib.licenses.mit; - maintainers = [ lib.maintainers.i01011001 ]; - }; + postInstall = '' + mkdir -p $out/lib/pkgconfig + cat >$out/lib/pkgconfig/unity.pc < Date: Tue, 4 Nov 2025 16:48:28 +0800 Subject: [PATCH 06/33] update min cmake version --- pkgs/t/tinylog/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/t/tinylog/package.nix b/pkgs/t/tinylog/package.nix index ee5daf7..f02ea0f 100644 --- a/pkgs/t/tinylog/package.nix +++ b/pkgs/t/tinylog/package.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "shen390s"; repo = "tinylog"; rev = "master"; - hash = "sha256-EvLoi4Yew7hE8wnogh7nJxoDsZbjphsHCCxuWzbWysA="; + hash = "sha256-ZPyzHe8kRSg1Z3MWtsYeIy4ifziWfYf+lnByrTAgqr4="; }; nativeBuildInputs = [ cmake ]; From f7244c7e451310b6440b4aedcf84b5f239939d1d Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Wed, 5 Nov 2025 11:07:14 +0800 Subject: [PATCH 07/33] unity --- default.nix | 4 ++++ pkgs/u/uem/package.nix | 35 +++++++++++++++++++++++++++++++++++ pkgs/u/unity-test/package.nix | 3 ++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 pkgs/u/uem/package.nix diff --git a/default.nix b/default.nix index be69bc2..d0f57cd 100644 --- a/default.nix +++ b/default.nix @@ -13,6 +13,9 @@ let }; tinylog = callPackage ./pkgs/t/tinylog/package.nix {}; unity_test_with_color = callPackage ./pkgs/u/unity-test/package.nix {}; + uem = callPackage ./pkgs/u/uem/package.nix { + pkgs = pkgs; + }; in { xbuild = xbuild; @@ -21,4 +24,5 @@ in zlog_with_pkgconf = zlog_with_pkgconf; tinylog = tinylog; unity_test_with_color = unity_test_with_color; + uem = uem; } diff --git a/pkgs/u/uem/package.nix b/pkgs/u/uem/package.nix new file mode 100644 index 0000000..4d607de --- /dev/null +++ b/pkgs/u/uem/package.nix @@ -0,0 +1,35 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, +}: + +let + pname = "uem"; + version = "0.1"; + meta = { + description = "Universal Emacs Manager"; + homepage = "https://github.com/shen390s/uem"; + license = lib.licenses.bsd3; + maintainers = [ lib.maintainers.i01011001 ]; + }; +in +stdenv.mkDerivation (finalAttrs: { + pname = pname; + version = version; + + src = fetchFromGitHub { + owner = "shen390s"; + repo = "uem"; + tag = "v${finalAttrs.version}"; +# hash = "sha256-g0ubq7RxGQmL1R6vz9RIGJpVWYsgrZhsTWSrL1ySEug="; + }; + + nativeBuildInputs = [ roswell ]; + doCheck = true; + + buildPhase = '' + ros build roswell/uem.ros + ''; +}) diff --git a/pkgs/u/unity-test/package.nix b/pkgs/u/unity-test/package.nix index 1f95e70..053feff 100644 --- a/pkgs/u/unity-test/package.nix +++ b/pkgs/u/unity-test/package.nix @@ -27,7 +27,8 @@ stdenv.mkDerivation (finalAttrs: { }; nativeBuildInputs = [ cmake ]; - makeFlags = [ "UNITY_OUTPUT_COLOR=1" ]; + # makeFlags = [ "UNITY_OUTPUT_COLOR=1" ]; + env.NIX_CFLAGS_COMPILE = "-DUNITY_OUTPUT_COLOR=1"; doCheck = true; postInstall = '' From c28b44152f39cabd4c16a34cd9e73bad24685de7 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Wed, 5 Nov 2025 16:42:06 +0800 Subject: [PATCH 08/33] cetcd --- default.nix | 2 ++ flake.lock | 34 ++++++++++++++++++++++++++++++++++ flake.nix | 26 +++++++++++++++++--------- pkgs/c/cetcd/package.nix | 40 ++++++++++++++++++++++++++++++++++++++++ pkgs/u/uem/package.nix | 25 +++++++++++++++++++++---- 5 files changed, 114 insertions(+), 13 deletions(-) create mode 100644 pkgs/c/cetcd/package.nix diff --git a/default.nix b/default.nix index d0f57cd..6c5d401 100644 --- a/default.nix +++ b/default.nix @@ -16,6 +16,7 @@ let uem = callPackage ./pkgs/u/uem/package.nix { pkgs = pkgs; }; + cetcd = callPackage ./pkgs/cetcd/package.nix {}; in { xbuild = xbuild; @@ -25,4 +26,5 @@ in tinylog = tinylog; unity_test_with_color = unity_test_with_color; uem = uem; + cetcd = cetcd; } diff --git a/flake.lock b/flake.lock index b161c00..171c4ba 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1762111121, @@ -18,8 +36,24 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index b680291..ff47767 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,29 @@ { - description = "A very basic flake"; + description = "Flake for some special packages"; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs}: + outputs = { self, nixpkgs, flake-utils}: let supportedSystems = [ "x86_64-linux" ]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; in - { - packages = forAllSystems (system: let - pkgs = nixpkgs.legacyPackages.${system}; - in - import ./default.nix { inherit pkgs; }); - }; + flake-utils.lib.eachSystem supportedSystems ( + system: let + pkgs = nixpkgs.legacyPackages.${system}; + xpkgs = import ./default.nix { inherit pkgs; }; + in rec { + packages = xpkgs; + defaultPackage = xpkgs.uem; + devShells.default = pkgs.mkShell { + nativeBuildInputs = xpkgs.uem.nativeBuildInputs; + }; + + devShell = self.devShells.${system}.default; + } + ); } diff --git a/pkgs/c/cetcd/package.nix b/pkgs/c/cetcd/package.nix new file mode 100644 index 0000000..a4dba99 --- /dev/null +++ b/pkgs/c/cetcd/package.nix @@ -0,0 +1,40 @@ +{ + lib, + stdenv, + fetchFromGitHub, + pkgs, + ... +}: + +stdenv.mkDerivation { + pname = "cetcd"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "shen390s"; + repo = "cetcd"; + rev = "master"; +# sha256 = "sha256-9dzSc3w+yxYzsF/rZe3qIarKOpjt2zvIyjuS5FXngIM="; + }; + + nativeBuildInputs = [ + pkgs.make + pkgs.curl + pkgs.pkg-config + pkgs.yajl + ]; + + configurePhase = '' + true + ''; + + buildPhase = '' + make prefix=$out + ''; + + installPhase = '' + runHook preInstall + make install prefix=$out + runHook postInstall + ''; +} diff --git a/pkgs/u/uem/package.nix b/pkgs/u/uem/package.nix index 4d607de..fc7e9ac 100644 --- a/pkgs/u/uem/package.nix +++ b/pkgs/u/uem/package.nix @@ -3,6 +3,7 @@ stdenv, fetchFromGitHub, cmake, + pkgs, }: let @@ -22,14 +23,30 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "shen390s"; repo = "uem"; - tag = "v${finalAttrs.version}"; -# hash = "sha256-g0ubq7RxGQmL1R6vz9RIGJpVWYsgrZhsTWSrL1ySEug="; + rev = "develop"; + hash = "sha256-WLQak+5dbD4Zo3EgnW5YVhj5tNPJlkXYdd4lNLzRlq0="; }; - nativeBuildInputs = [ roswell ]; + nativeBuildInputs = [ pkgs.roswell ]; doCheck = true; buildPhase = '' - ros build roswell/uem.ros + set +e + export HOME=/build + env + ros version + find . + mkdir -p $HOME/.roswell + cat >$HOME/.roswell/init.lisp < Date: Wed, 5 Nov 2025 16:50:23 +0800 Subject: [PATCH 09/33] cetcd --- default.nix | 2 +- pkgs/c/cetcd/package.nix | 32 +++++++++++++++++++++++++++++--- pkgs/u/uem/package.nix | 33 ++++++++++++++++++--------------- 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/default.nix b/default.nix index 6c5d401..97998cf 100644 --- a/default.nix +++ b/default.nix @@ -16,7 +16,7 @@ let uem = callPackage ./pkgs/u/uem/package.nix { pkgs = pkgs; }; - cetcd = callPackage ./pkgs/cetcd/package.nix {}; + cetcd = callPackage ./pkgs/c/cetcd/package.nix {}; in { xbuild = xbuild; diff --git a/pkgs/c/cetcd/package.nix b/pkgs/c/cetcd/package.nix index a4dba99..bf347be 100644 --- a/pkgs/c/cetcd/package.nix +++ b/pkgs/c/cetcd/package.nix @@ -6,19 +6,28 @@ ... }: -stdenv.mkDerivation { +let pname = "cetcd"; version = "1.0.0"; + meta = with lib; { + description = "c binding of etcd client api"; + homepage = "https://github.com/shafreeck/cetcd"; + license = lib.license.apsl20; + }; +in +stdenv.mkDerivation { + pname = pname; + version = version; src = fetchFromGitHub { owner = "shen390s"; repo = "cetcd"; rev = "master"; -# sha256 = "sha256-9dzSc3w+yxYzsF/rZe3qIarKOpjt2zvIyjuS5FXngIM="; + sha256 = "sha256-BTJXrJyjPp5ynHH5Ct91PFiWATzBal4rsnX84wJ0nCg="; }; nativeBuildInputs = [ - pkgs.make + pkgs.gnumake pkgs.curl pkgs.pkg-config pkgs.yajl @@ -37,4 +46,21 @@ stdenv.mkDerivation { make install prefix=$out runHook postInstall ''; + + postInstall = '' + mkdir -p $out/lib/pkgconfig + cat >$out/lib/pkgconfig/cetcd.pc <.roswell/init.lisp <$HOME/.roswell/init.lisp < Date: Sat, 15 Nov 2025 15:26:03 +0800 Subject: [PATCH 10/33] save --- pkgs/u/uem/package.nix | 48 ++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/pkgs/u/uem/package.nix b/pkgs/u/uem/package.nix index d336302..3000562 100644 --- a/pkgs/u/uem/package.nix +++ b/pkgs/u/uem/package.nix @@ -27,29 +27,45 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-WLQak+5dbD4Zo3EgnW5YVhj5tNPJlkXYdd4lNLzRlq0="; }; - nativeBuildInputs = [ pkgs.roswell ]; - doCheck = true; + buildInputs = with pkgs; [ + roswell + patchelf + zstd +# asdf-vm + ]; + + propagatedBuildInputs = with pkgs; [ + zstd + ]; + + doCheck = true; configurePhase = '' - mkdir -p .roswell - cat >.roswell/init.lisp <$ROSWELL_HOME/init.lisp < Date: Sun, 16 Nov 2025 16:46:31 +0800 Subject: [PATCH 11/33] uem --- pkgs/u/uem/package.nix | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/pkgs/u/uem/package.nix b/pkgs/u/uem/package.nix index 3000562..b2143b8 100644 --- a/pkgs/u/uem/package.nix +++ b/pkgs/u/uem/package.nix @@ -30,8 +30,8 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = with pkgs; [ roswell patchelf + sbcl zstd -# asdf-vm ]; propagatedBuildInputs = with pkgs; [ @@ -39,33 +39,29 @@ stdenv.mkDerivation (finalAttrs: { ]; doCheck = true; + dontStrip = true; configurePhase = '' - true + export ROSWELL_HOME=$PWD/.roswell + export HOME=$TMP + ros setup + ros use sbcl-bin/system ''; buildPhase = '' set +e set -x - export ROSWELL_HOME=$PWD/.roswell - export HOME=$TMP - ros setup - ros use sbcl-bin/system - export ASDF_CENTRAL_REGISTRY="$src" cat >$ROSWELL_HOME/init.lisp < Date: Mon, 17 Nov 2025 15:16:48 +0800 Subject: [PATCH 12/33] fix uem build --- pkgs/u/uem/package.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/u/uem/package.nix b/pkgs/u/uem/package.nix index b2143b8..294fa81 100644 --- a/pkgs/u/uem/package.nix +++ b/pkgs/u/uem/package.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "shen390s"; repo = "uem"; rev = "develop"; - hash = "sha256-WLQak+5dbD4Zo3EgnW5YVhj5tNPJlkXYdd4lNLzRlq0="; + hash = "sha256-+r7pqow/JHH7i3+2Q2KHldErfigm6nnImGtpsdCWfaQ="; }; buildInputs = with pkgs; [ @@ -49,13 +49,11 @@ stdenv.mkDerivation (finalAttrs: { ''; buildPhase = '' - set +e - set -x + set -e cat >$ROSWELL_HOME/init.lisp < Date: Mon, 17 Nov 2025 15:20:20 +0800 Subject: [PATCH 13/33] fix uem build --- pkgs/u/uem/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/u/uem/package.nix b/pkgs/u/uem/package.nix index 294fa81..604641d 100644 --- a/pkgs/u/uem/package.nix +++ b/pkgs/u/uem/package.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "shen390s"; repo = "uem"; rev = "develop"; - hash = "sha256-+r7pqow/JHH7i3+2Q2KHldErfigm6nnImGtpsdCWfaQ="; + hash = "sha256-lfw4WLRyKv2tJbLuc21UoKZueyWgFkxcgVXTKVLT5ow="; }; buildInputs = with pkgs; [ From 289154e2bb5d7610545e10d5a0175a39cd4d0b4a Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Mon, 17 Nov 2025 15:27:47 +0800 Subject: [PATCH 14/33] fix uem theme --- pkgs/u/uem/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/u/uem/package.nix b/pkgs/u/uem/package.nix index 604641d..a523c11 100644 --- a/pkgs/u/uem/package.nix +++ b/pkgs/u/uem/package.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "shen390s"; repo = "uem"; rev = "develop"; - hash = "sha256-lfw4WLRyKv2tJbLuc21UoKZueyWgFkxcgVXTKVLT5ow="; + hash ="sha256-v6vtPUVfQ+W4/sZKPxKyuqAGaXda47FZEM4/XdXR63o="; }; buildInputs = with pkgs; [ From 056fd0c05d683a3606fe358c8b47ad1777082c5f Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Wed, 19 Nov 2025 14:59:57 +0800 Subject: [PATCH 15/33] use overideAttrs --- default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 97998cf..3b4f9f2 100644 --- a/default.nix +++ b/default.nix @@ -12,7 +12,9 @@ let with_pkgconf = true; }; tinylog = callPackage ./pkgs/t/tinylog/package.nix {}; - unity_test_with_color = callPackage ./pkgs/u/unity-test/package.nix {}; + unity_test_with_color = pkgs.unity-test.overrideAttrs { + env.NIX_CFLAGS_COMPILE = "-DUNITY_OUTPUT_COLOR=1"; + }; uem = callPackage ./pkgs/u/uem/package.nix { pkgs = pkgs; }; From 3c727ec4b409a84313e0d18140d980172c57a765 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Sat, 29 Nov 2025 17:49:09 +0800 Subject: [PATCH 16/33] update uem version --- pkgs/u/uem/package.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/u/uem/package.nix b/pkgs/u/uem/package.nix index a523c11..1ff4df1 100644 --- a/pkgs/u/uem/package.nix +++ b/pkgs/u/uem/package.nix @@ -24,7 +24,8 @@ stdenv.mkDerivation (finalAttrs: { owner = "shen390s"; repo = "uem"; rev = "develop"; - hash ="sha256-v6vtPUVfQ+W4/sZKPxKyuqAGaXda47FZEM4/XdXR63o="; +# hash ="sha256-v6vtPUVfQ+W4/sZKPxKyuqAGaXda47FZEM4/XdXR63o="; + hash = "sha256-c8BqYIfDHica6AhJsWEQY0mMEo5Oj3/VuLKx1s1kO9w="; }; buildInputs = with pkgs; [ From 386e3f23cfd5c415e059567cb3fb51fbd3652ebc Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Tue, 2 Dec 2025 11:14:16 +0800 Subject: [PATCH 17/33] add packcc@master --- default.nix | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/default.nix b/default.nix index 3b4f9f2..2e174a8 100644 --- a/default.nix +++ b/default.nix @@ -15,6 +15,58 @@ let unity_test_with_color = pkgs.unity-test.overrideAttrs { env.NIX_CFLAGS_COMPILE = "-DUNITY_OUTPUT_COLOR=1"; }; + libcello_debug = pkgs.libcello.overrideAttrs (prevAttrs: { + separateDebugInfo = true; + postInstall = '' + mkdir -p $out/lib/pkgconfig + cat >$out/lib/pkgconfig/libcello.pc < Date: Tue, 2 Dec 2025 17:30:46 +0800 Subject: [PATCH 18/33] add extralib --- default.nix | 4 ++++ pkgs/e/extralib/package.nix | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 pkgs/e/extralib/package.nix diff --git a/default.nix b/default.nix index 2e174a8..c9fdcd3 100644 --- a/default.nix +++ b/default.nix @@ -71,6 +71,9 @@ let pkgs = pkgs; }; cetcd = callPackage ./pkgs/c/cetcd/package.nix {}; + extralib = callPackage ./pkgs/e/extralib/package.nix { + pkgs = pkgs; + }; in { xbuild = xbuild; @@ -83,4 +86,5 @@ in cetcd = cetcd; libcello_debug = libcello_debug; packcc = packcc_main; + extralib = extralib; } diff --git a/pkgs/e/extralib/package.nix b/pkgs/e/extralib/package.nix new file mode 100644 index 0000000..038b8d5 --- /dev/null +++ b/pkgs/e/extralib/package.nix @@ -0,0 +1,46 @@ +{ + lib, + stdenv, + pkgs +}: + +let + meta = with lib; { + description = "Extralib for build X cloud Engine"; + platforms = lib.platforms.unix; + }; + pname = "extralib"; + version = "0.0.1"; +in +stdenv.mkDerivation (finalAttrs: { + pname = pname; + version = version; + + src = builtins.fetchGit { + url = "ssh://forgejo@gitea.shenrs.eu/nexa/extralibs.git"; + rev = "9bd63d624b18049f68acddfd14a64e6d98bbb9fe"; + }; + + nativeBuildInputs = [ + pkgs.meson + pkgs.ninja + ]; + + postInstall = '' + mkdir -p $out/lib/pkgconfig + cat >$out/lib/pkgconfig/extralibs.pc < Date: Tue, 2 Dec 2025 17:41:27 +0800 Subject: [PATCH 19/33] fix lib name --- pkgs/e/extralib/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/e/extralib/package.nix b/pkgs/e/extralib/package.nix index 038b8d5..394928c 100644 --- a/pkgs/e/extralib/package.nix +++ b/pkgs/e/extralib/package.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation (finalAttrs: { Name: ${pname} Description: ${meta.description} Version: ${version} - Libs: -L\''${libdir} -lzlog + Libs: -L\''${libdir} -lextra Cflags: -I\''${includedir} EOF ''; From 3bc72b826a5d38120df24ee7910bb991eae4d3e7 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Wed, 3 Dec 2025 11:44:49 +0800 Subject: [PATCH 20/33] remove extralib --- default.nix | 4 ---- pkgs/e/extralib/package.nix | 46 ------------------------------------- 2 files changed, 50 deletions(-) delete mode 100644 pkgs/e/extralib/package.nix diff --git a/default.nix b/default.nix index c9fdcd3..2e174a8 100644 --- a/default.nix +++ b/default.nix @@ -71,9 +71,6 @@ let pkgs = pkgs; }; cetcd = callPackage ./pkgs/c/cetcd/package.nix {}; - extralib = callPackage ./pkgs/e/extralib/package.nix { - pkgs = pkgs; - }; in { xbuild = xbuild; @@ -86,5 +83,4 @@ in cetcd = cetcd; libcello_debug = libcello_debug; packcc = packcc_main; - extralib = extralib; } diff --git a/pkgs/e/extralib/package.nix b/pkgs/e/extralib/package.nix deleted file mode 100644 index 394928c..0000000 --- a/pkgs/e/extralib/package.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - lib, - stdenv, - pkgs -}: - -let - meta = with lib; { - description = "Extralib for build X cloud Engine"; - platforms = lib.platforms.unix; - }; - pname = "extralib"; - version = "0.0.1"; -in -stdenv.mkDerivation (finalAttrs: { - pname = pname; - version = version; - - src = builtins.fetchGit { - url = "ssh://forgejo@gitea.shenrs.eu/nexa/extralibs.git"; - rev = "9bd63d624b18049f68acddfd14a64e6d98bbb9fe"; - }; - - nativeBuildInputs = [ - pkgs.meson - pkgs.ninja - ]; - - postInstall = '' - mkdir -p $out/lib/pkgconfig - cat >$out/lib/pkgconfig/extralibs.pc < Date: Fri, 5 Dec 2025 17:12:02 +0800 Subject: [PATCH 21/33] add struct2json --- default.nix | 4 ++++ flake.lock | 6 +++--- pkgs/s/struct2json/package.nix | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 pkgs/s/struct2json/package.nix diff --git a/default.nix b/default.nix index 2e174a8..38a8ea3 100644 --- a/default.nix +++ b/default.nix @@ -71,6 +71,9 @@ let pkgs = pkgs; }; cetcd = callPackage ./pkgs/c/cetcd/package.nix {}; + struct2json = callPackage ./pkgs/s/struct2json/package.nix { + pkgs = pkgs; + }; in { xbuild = xbuild; @@ -83,4 +86,5 @@ in cetcd = cetcd; libcello_debug = libcello_debug; packcc = packcc_main; + struct2json = struct2json; } diff --git a/flake.lock b/flake.lock index 171c4ba..cb8f9c1 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1762111121, - "narHash": "sha256-4vhDuZ7OZaZmKKrnDpxLZZpGIJvAeMtK6FKLJYUtAdw=", + "lastModified": 1764667669, + "narHash": "sha256-7WUCZfmqLAssbDqwg9cUDAXrSoXN79eEEq17qhTNM/Y=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b3d51a0365f6695e7dd5cdf3e180604530ed33b4", + "rev": "418468ac9527e799809c900eda37cbff999199b6", "type": "github" }, "original": { diff --git a/pkgs/s/struct2json/package.nix b/pkgs/s/struct2json/package.nix new file mode 100644 index 0000000..fb57172 --- /dev/null +++ b/pkgs/s/struct2json/package.nix @@ -0,0 +1,37 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + pkgs, +}: + +let + meta = with lib; { + description = "convert c struct to json"; + homepage = "https://github.com/armink/struct2json"; + license = lib.licenses.mit; + platforms = lib.platforms.unix; + }; + pname = "struct2json"; + version = "1.0.0"; +in +stdenv.mkDerivation (finalAttrs: { + pname = pname; + version = version; + + src = fetchFromGitHub { + owner = "shen390s"; + repo = "struct2json"; + rev = "master"; + hash = "sha256-2J3JFrUc0FSX5U+vmyc5Ccmb7ONqiRprZj+QoRtwius="; + }; + + nativeBuildInputs = [ + pkgs.meson + pkgs.ninja + pkgs.pkgconf + ]; + + inherit meta; +}) From 6cd85782d948aaa7dbe40499e0230b816efa8795 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Fri, 5 Dec 2025 17:15:42 +0800 Subject: [PATCH 22/33] update struct2json --- pkgs/s/struct2json/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/s/struct2json/package.nix b/pkgs/s/struct2json/package.nix index fb57172..38d0b7b 100644 --- a/pkgs/s/struct2json/package.nix +++ b/pkgs/s/struct2json/package.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "shen390s"; repo = "struct2json"; rev = "master"; - hash = "sha256-2J3JFrUc0FSX5U+vmyc5Ccmb7ONqiRprZj+QoRtwius="; + hash = "sha256-oPMHKCbEuh0Z2zHHmSEec/m2nBv+CwGz9E6Sc5vfMbM="; }; nativeBuildInputs = [ From 597aa03bdb99a95853744acd349f113a9cd2b3cd Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Fri, 5 Dec 2025 17:17:44 +0800 Subject: [PATCH 23/33] update struct2json --- pkgs/s/struct2json/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/s/struct2json/package.nix b/pkgs/s/struct2json/package.nix index 38d0b7b..b26f60b 100644 --- a/pkgs/s/struct2json/package.nix +++ b/pkgs/s/struct2json/package.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "shen390s"; repo = "struct2json"; rev = "master"; - hash = "sha256-oPMHKCbEuh0Z2zHHmSEec/m2nBv+CwGz9E6Sc5vfMbM="; + hash = "sha256-ZCJC6NmdL4EASlJYlWym3rjPK6qaKGtZMQhY0GIqTTU="; }; nativeBuildInputs = [ From 27e9f00c690adea74266a58cdb9d2174bc7b2780 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Wed, 24 Dec 2025 15:34:48 +0800 Subject: [PATCH 24/33] enable debug for capnpc --- pkgs/c/capnpc/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/c/capnpc/package.nix b/pkgs/c/capnpc/package.nix index d91de40..e7d9a76 100644 --- a/pkgs/c/capnpc/package.nix +++ b/pkgs/c/capnpc/package.nix @@ -29,7 +29,7 @@ stdenv.mkDerivation { ''; configurePhase = '' - cmake --preset=ci-linux_x86_64 -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=$out + cmake --preset=ci-linux_x86_64 -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$out ''; buildPhase = '' From 828497661dbef0721ca1aceb0b76fd71086a720b Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Wed, 24 Dec 2025 15:46:35 +0800 Subject: [PATCH 25/33] enable debug for capnpc --- pkgs/c/capnpc/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/c/capnpc/package.nix b/pkgs/c/capnpc/package.nix index e7d9a76..48bb58e 100644 --- a/pkgs/c/capnpc/package.nix +++ b/pkgs/c/capnpc/package.nix @@ -29,7 +29,7 @@ stdenv.mkDerivation { ''; configurePhase = '' - cmake --preset=ci-linux_x86_64 -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$out + cmake --preset=ci-linux_x86_64 -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$out ''; buildPhase = '' From d6e6711f401446ebfec291ad1a3fbb58fd33720d Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Thu, 22 Jan 2026 14:42:49 +0800 Subject: [PATCH 26/33] fix ttf fonts --- default.nix | 2 ++ pkgs/f/fonts/package.nix | 61 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 pkgs/f/fonts/package.nix diff --git a/default.nix b/default.nix index 38a8ea3..63ec7a0 100644 --- a/default.nix +++ b/default.nix @@ -74,6 +74,7 @@ let struct2json = callPackage ./pkgs/s/struct2json/package.nix { pkgs = pkgs; }; + my-ttf-fonts = callPackage ./pkgs/f/fonts/package.nix {}; in { xbuild = xbuild; @@ -87,4 +88,5 @@ in libcello_debug = libcello_debug; packcc = packcc_main; struct2json = struct2json; + my-ttf-fonts = my-ttf-fonts; } diff --git a/pkgs/f/fonts/package.nix b/pkgs/f/fonts/package.nix new file mode 100644 index 0000000..3f02acd --- /dev/null +++ b/pkgs/f/fonts/package.nix @@ -0,0 +1,61 @@ +{ + lib, + stdenv, +# fetchFromGitea, +# fetchFromGitHub, +# fetchgit, + pkgs? import {}, + pkg-config, +}: + +let + meta = with lib; { + description = "Some true type fonts"; + homepage = "https://github.com/shen390s/my-ttf-fonts"; + license = lib.licenses.asl20; + platforms = lib.platforms.unix; + }; + pname = "my-ttf-fonts"; + version = "1.0"; + mysource = pkgs.runCommand "download-fonts" { + nativeBuiltInputs = [ pkgs.curl ]; + outputHash = "sha256-JMWxG0lCkzXhuBoBtEk8N0g6qrLRJo0WGki9A+yTbhU="; + outputHashAlgo = "sha256"; + outputHashMode = "flat"; + } '' + ${pkgs.curl}/bin/curl --output $out \ + --location \ + --max-redirs 20 \ + --retry 3 \ + --disable-epsv \ + --cookie-jar cookies \ + --insecure \ + --user-agent curl/8.17.0 -C - --fail \ + https://gitee.com/shen390s/my-ttf-fonts/archive/refs/tags/v1.0.tar.gz + ''; +in +stdenv.mkDerivation (finalAttrs: { + pname = pname; + version = version; + + src = mysource; + + unpackPhase = '' + tar -zxvf $src + ''; + + installPhase = '' + mkdir -p $out/share/fonts/truetype + _fontdir="${pname}-v${version}" + if [ -d $_fontdir/fonts/truetype ]; then + ls $_fontdir/fonts/truetype/* + cp -r $_fontdir/fonts/truetype/*.ttf $out/share/fonts/truetype/ + cp -r $_fontdir/fonts/truetype/*.ttc $out/share/fonts/truetype/ + else + echo "No fonts found in $_fontdir/fonts/truetype" + exit 0 + fi + ''; + + inherit meta; +}) From 7eb8e54aeac0203eba66dc0b7fc8d55c2a68944c Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Tue, 3 Feb 2026 10:52:33 +0800 Subject: [PATCH 27/33] fix packcc hash --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 63ec7a0..9be3b31 100644 --- a/default.nix +++ b/default.nix @@ -39,7 +39,7 @@ let owner = "arithy"; repo = "packcc"; rev = "main"; - hash = "sha256-oE9rdZmEEd8op5jkAzqEyD5rcZatn3IKIIJiQhGsqoc="; + hash = "sha256-zkrpPGLylgPpV1iyXosVbsbn2qt8/+WnBeK/w1WtwBk="; }; nativeBuildInputs = [ From 0286e0d6454dec4c00815085022f19d4c0ebe73b Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Fri, 27 Mar 2026 11:35:17 +0800 Subject: [PATCH 28/33] add gost-ctl --- default.nix | 2 + pkgs/g/gost-ctl/gost-ctl | 174 ++++++++++++++++++++++++++++++++++++ pkgs/g/gost-ctl/package.nix | 28 ++++++ 3 files changed, 204 insertions(+) create mode 100755 pkgs/g/gost-ctl/gost-ctl create mode 100644 pkgs/g/gost-ctl/package.nix diff --git a/default.nix b/default.nix index 9be3b31..31019c3 100644 --- a/default.nix +++ b/default.nix @@ -3,6 +3,7 @@ with pkgs; let cedro = callPackage ./pkgs/c/cedro/package.nix {}; capnpc = callPackage ./pkgs/c/capnpc/package.nix {}; + gost-ctl = callPackage ./pkgs/g/gost-ctl/package.nix {}; xbuild = callPackage ./pkgs/x/xbuild/package.nix { pkgs = pkgs; cedro = cedro; @@ -80,6 +81,7 @@ in xbuild = xbuild; capnpc = capnpc; cedro = cedro; + gost-ctl = gost-ctl; zlog_with_pkgconf = zlog_with_pkgconf; tinylog = tinylog; unity_test_with_color = unity_test_with_color; diff --git a/pkgs/g/gost-ctl/gost-ctl b/pkgs/g/gost-ctl/gost-ctl new file mode 100755 index 0000000..dc69718 --- /dev/null +++ b/pkgs/g/gost-ctl/gost-ctl @@ -0,0 +1,174 @@ +#!/bin/bash +# gost-ctl — manage the GOST proxy tunnel and container network attachments +# +# Usage: gost-ctl [args] +# +# Commands: +# start Start gost-tunnel service and watcher +# stop Stop gost-tunnel service and watcher +# restart Restart gost-tunnel service +# attach Attach a container to the bridge (idempotent) +# detach Detach a container from the bridge +# status Show tunnel, bridge, and container status +# +# Config resolution (first match wins): +# $GOST_TUNNEL_CONFIG env var → /etc/gost-tunnel/env → .env in script dir + +set -e + +# ─── Config ───────────────────────────────────────────────────────────────── + +CONFIG_FILE="${GOST_TUNNEL_CONFIG:-/etc/gost-tunnel/env}" +if [ ! -f "$CONFIG_FILE" ]; then + CONFIG_FILE="$(dirname "$(realpath "$0")")/.env" +fi +if [ ! -f "$CONFIG_FILE" ]; then + echo "ERROR: config not found. Set GOST_TUNNEL_CONFIG or place .env next to gost-ctl" + exit 1 +fi +# shellcheck source=/dev/null +source "$CONFIG_FILE" + +# ─── Helpers ──────────────────────────────────────────────────────────────── + +log() { echo "[$(date '+%H:%M:%S')] $*"; } + +require_root() { + [ "$(id -u)" -eq 0 ] || { echo "ERROR: gost-ctl must be run as root"; exit 1; } +} + +# ─── Commands ─────────────────────────────────────────────────────────────── + +cmd_start() { + systemctl start gost-tunnel gost-tunnel-watcher + log "gost-tunnel started" +} + +cmd_stop() { + systemctl stop gost-tunnel-watcher gost-tunnel + log "gost-tunnel stopped" +} + +cmd_restart() { + systemctl restart gost-tunnel + log "gost-tunnel restarted" +} + +cmd_attach() { + require_root + local cname="$1" cip="$2" + [ -n "$cname" ] && [ -n "$cip" ] \ + || { echo "Usage: gost-ctl attach "; exit 1; } + + local veth_h="veth-${cname}-h" veth_c="veth-${cname}-c" + + # Idempotency: skip if already attached + if ip link show "$veth_h" >/dev/null 2>&1; then + log "$cname already attached (veth exists), skipping." + return 0 + fi + + # Wait for container PID + local pid + for i in $(seq 1 30); do + pid=$(docker inspect -f '{{.State.Pid}}' "$cname" 2>/dev/null) + [[ "$pid" =~ ^[0-9]+$ ]] && [ "$pid" -gt 0 ] && break + log "Waiting for $cname PID... ($i/30)"; sleep 1 + done + [[ "$pid" =~ ^[0-9]+$ ]] && [ "$pid" -gt 0 ] \ + || { log "ERROR: $cname PID not found"; docker logs "$cname"; exit 1; } + + log "$cname PID: $pid" + mkdir -p /var/run/netns + ln -sfT "/proc/$pid/ns/net" "/var/run/netns/$cname" + + ip link add "$veth_h" type veth peer name "$veth_c" + ip link set "$veth_h" master "$BRIDGE_NAME" + ip link set "$veth_h" up + ip link set "$veth_c" netns "$cname" + ip netns exec "$cname" ip link set "$veth_c" name eth0 + ip netns exec "$cname" ip link set lo up + ip netns exec "$cname" ip link set eth0 up + ip netns exec "$cname" ip addr add "${cip}/24" dev eth0 + ip netns exec "$cname" ip route add default via "$BRIDGE_IP" + log "$cname attached at $cip via $BRIDGE_IP" +} + +cmd_detach() { + require_root + local cname="$1" + [ -n "$cname" ] || { echo "Usage: gost-ctl detach "; exit 1; } + + local veth_h="veth-${cname}-h" + if ip link del "$veth_h" 2>/dev/null; then + log "$cname veth removed" + else + log "$cname veth not found (already detached?)" + fi + rm -f "/var/run/netns/$cname" + log "$cname detached" +} + +cmd_status() { + echo "" + local svc_state watcher_state + svc_state=$(systemctl is-active gost-tunnel 2>/dev/null || echo "inactive") + watcher_state=$(systemctl is-active gost-tunnel-watcher 2>/dev/null || echo "inactive") + echo "Service: $svc_state" + echo "Watcher: $watcher_state" + + if ip link show "$TUN_NAME" >/dev/null 2>&1; then + local tun_addr + tun_addr=$(ip -4 addr show "$TUN_NAME" | awk '/inet /{print $2}' | head -1) + echo "TUN: $TUN_NAME UP ${tun_addr:-}" + else + echo "TUN: $TUN_NAME DOWN" + fi + + if ip link show "$BRIDGE_NAME" >/dev/null 2>&1; then + local br_addr + br_addr=$(ip -4 addr show "$BRIDGE_NAME" | awk '/inet /{print $2}' | head -1) + echo "Bridge: $BRIDGE_NAME UP ${br_addr:-}" + else + echo "Bridge: $BRIDGE_NAME DOWN" + fi + + echo "" + echo "Attached containers:" + local found=0 + for veth in $(ip link show 2>/dev/null | grep -oP 'veth-\S+-h' | sort -u); do + local cname="${veth#veth-}"; cname="${cname%-h}" + local cip + cip=$(ip netns exec "$cname" ip -4 addr show eth0 2>/dev/null \ + | awk '/inet /{print $2}' | head -1 || echo "") + local link_state + link_state=$(ip link show "$veth" 2>/dev/null | grep -oP '(?<=state )\S+' | head -1) + printf " %-16s %-18s %s\n" "$cname" "$cip" "$veth ${link_state:-?}" + found=1 + done + [ "$found" -eq 0 ] && echo " (none)" + echo "" +} + +# ─── Dispatch ─────────────────────────────────────────────────────────────── + +case "${1:-}" in + start) cmd_start ;; + stop) cmd_stop ;; + restart) cmd_restart ;; + attach) shift; cmd_attach "$@" ;; + detach) shift; cmd_detach "$@" ;; + status) cmd_status ;; + *) + echo "Usage: gost-ctl [args]" + echo "" + echo "Commands:" + echo " start Start gost-tunnel service and watcher" + echo " stop Stop gost-tunnel service and watcher" + echo " restart Restart gost-tunnel service" + echo " attach Attach container to bridge" + echo " detach Detach container from bridge" + echo " status Show tunnel and container status" + exit 1 + ;; +esac diff --git a/pkgs/g/gost-ctl/package.nix b/pkgs/g/gost-ctl/package.nix new file mode 100644 index 0000000..4c6df37 --- /dev/null +++ b/pkgs/g/gost-ctl/package.nix @@ -0,0 +1,28 @@ +# xbuild.nix +{ + lib, + stdenv, + pkgs, + ... +}: + +let + gost-ctl=stdenv.mkDerivation { + pname = "gost-ctl"; + version = "0.0.1"; + + src = ./.; + + nativeBuildInputs = [ + pkgs.gost + ]; + + installPhase = '' + mkdir -p $out/bin + cp gost-ctl $out/bin + chmod +x $out/bin/gost-ctl + ''; + }; + +in + gost-ctl From d14037ffd66887ce83a68a565c6010901817118c Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Fri, 27 Mar 2026 21:04:40 +0800 Subject: [PATCH 29/33] add norouter --- .gitignore | 1 + default.nix | 2 ++ pkgs/n/norouter/package.nix | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 .gitignore create mode 100644 pkgs/n/norouter/package.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/default.nix b/default.nix index 31019c3..8223628 100644 --- a/default.nix +++ b/default.nix @@ -4,6 +4,7 @@ let cedro = callPackage ./pkgs/c/cedro/package.nix {}; capnpc = callPackage ./pkgs/c/capnpc/package.nix {}; gost-ctl = callPackage ./pkgs/g/gost-ctl/package.nix {}; + norouter = callPackage ./pkgs/n/norouter/package.nix {}; xbuild = callPackage ./pkgs/x/xbuild/package.nix { pkgs = pkgs; cedro = cedro; @@ -82,6 +83,7 @@ in capnpc = capnpc; cedro = cedro; gost-ctl = gost-ctl; + norouter = norouter; zlog_with_pkgconf = zlog_with_pkgconf; tinylog = tinylog; unity_test_with_color = unity_test_with_color; diff --git a/pkgs/n/norouter/package.nix b/pkgs/n/norouter/package.nix new file mode 100644 index 0000000..e2cf540 --- /dev/null +++ b/pkgs/n/norouter/package.nix @@ -0,0 +1,25 @@ +{ stdenvNoCC, lib, fetchurl, autoPatchelfHook, zlib, openssl }: + +stdenvNoCC.mkDerivation rec { + pname = "norouter"; + version = "0.6.5"; + + src = fetchurl { + url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-Linux-x86_64.tgz"; + hash = "sha256-kNAzGBuYLLHITGJAerH27kj8MjmxjII63ORym//rJEk="; + }; + + nativeBuildInputs = [ autoPatchelfHook ]; + buildInputs = [ zlib openssl ]; # Add required libraries + + dontUnpack = true; + + configurePhase = '' + cat $src |gzip -dc |tar xf - + ''; + + installPhase = '' + mkdir -p $out/bin + cp norouter $out/bin + ''; +} From 82f1a75c9831c9a1edf3a2c2103cca67f7eeef87 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Sat, 4 Apr 2026 17:10:38 +0800 Subject: [PATCH 30/33] add claude-gate --- default.nix | 4 ++++ pkgs/c/claude-gate/package.nix | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 pkgs/c/claude-gate/package.nix diff --git a/default.nix b/default.nix index 8223628..9b0e833 100644 --- a/default.nix +++ b/default.nix @@ -72,6 +72,9 @@ let uem = callPackage ./pkgs/u/uem/package.nix { pkgs = pkgs; }; + claude-gate = callPackage ./pkgs/c/claude-gate/package.nix { + pkgs = pkgs; + }; cetcd = callPackage ./pkgs/c/cetcd/package.nix {}; struct2json = callPackage ./pkgs/s/struct2json/package.nix { pkgs = pkgs; @@ -93,4 +96,5 @@ in packcc = packcc_main; struct2json = struct2json; my-ttf-fonts = my-ttf-fonts; + claude-gate = claude-gate; } diff --git a/pkgs/c/claude-gate/package.nix b/pkgs/c/claude-gate/package.nix new file mode 100644 index 0000000..8a89b53 --- /dev/null +++ b/pkgs/c/claude-gate/package.nix @@ -0,0 +1,43 @@ +# claude-gate +{ + lib, + stdenv, + fetchFromGitHub, + pkgs, + ... +}: + +stdenv.mkDerivation { + pname = "claude-gate"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "shen390s"; + repo = "claude-gate"; + rev = "master"; + sha256 = "sha256-StvSYsWLbGQCXpzlOaXjd7VRn/8l+u3CVIiK1nyVGqU="; + }; + + nativeBuildInputs = [ + pkgs.go + pkgs.gcc + pkgs.gnumake + ]; + + env = { + GOPROXY = "https://goproxy.cn"; + }; + + buildPhase = '' + HOME=$TMPDIR + GOCACHE=$TMPDIR/gocache + GOPATH=$TMPDIR/go + export HOME GOCACHE GOPATH + make build + ''; + + installPhase = '' + mkdir -p $out/bin + cp claude-gate $out/bin + ''; +} From 04a44a149342e03837adcba083e0a133ee088fc1 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Fri, 8 May 2026 23:53:59 +0800 Subject: [PATCH 31/33] add deepseek-tui --- default.nix | 4 ++ pkgs/d/deepseek-tui/package.nix | 34 ++++++++++++ pkgs/k/kiro-account-manager/package.nix | 71 +++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 pkgs/d/deepseek-tui/package.nix create mode 100644 pkgs/k/kiro-account-manager/package.nix diff --git a/default.nix b/default.nix index 3b4f9f2..811e4f2 100644 --- a/default.nix +++ b/default.nix @@ -19,6 +19,8 @@ let pkgs = pkgs; }; cetcd = callPackage ./pkgs/c/cetcd/package.nix {}; + deepseek-tui = callPackage ./pkgs/d/deepseek-tui/package.nix {}; + kiro-account-manager = callPackage ./pkgs/k/kiro-account-manager/package.nix {}; in { xbuild = xbuild; @@ -29,4 +31,6 @@ in unity_test_with_color = unity_test_with_color; uem = uem; cetcd = cetcd; + deepseek-tui = deepseek-tui; + kiro-account-manager = kiro-account-manager; } diff --git a/pkgs/d/deepseek-tui/package.nix b/pkgs/d/deepseek-tui/package.nix new file mode 100644 index 0000000..f87781f --- /dev/null +++ b/pkgs/d/deepseek-tui/package.nix @@ -0,0 +1,34 @@ +{ + lib, + rustPlatform, + fetchFromGitHub, + pkg-config, + dbus, + openssl, +}: + +rustPlatform.buildRustPackage { + pname = "deepseek-tui"; + version = "0.8.20"; + + src = fetchFromGitHub { + owner = "shen390s"; + repo = "DeepSeek-TUI"; + rev = "f183501fbd2199d9d10040e1a63392de604f172c"; + hash = "sha256-E621hEtWjdr5c9MZsifaYgdjyFvXcMvKLFmiyC4+Hr8="; + }; + + cargoHash = "sha256-7Atb+VhGHk1RtNJl+7kJOimpc/4sZs/pTKDRWmUzoSI="; + + doCheck = false; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ dbus openssl ]; + + meta = { + description = "A TUI client for DeepSeek AI"; + homepage = "https://github.com/shen390s/DeepSeek-TUI"; + license = lib.licenses.mit; + mainProgram = "deepseek"; + }; +} diff --git a/pkgs/k/kiro-account-manager/package.nix b/pkgs/k/kiro-account-manager/package.nix new file mode 100644 index 0000000..6e8926d --- /dev/null +++ b/pkgs/k/kiro-account-manager/package.nix @@ -0,0 +1,71 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, buildNpmPackage +, pkg-config +, openssl +, glib +, gtk3 +, libsoup_3 +, webkitgtk_4_1 +, dbus +, libayatana-appindicator +}: + +let + pname = "kiro-account-manager"; + version = "1.8.5"; + + src = fetchFromGitHub { + owner = "hj01857655"; + repo = "kiro-account-manager"; + rev = "2e2d4b09d3ad3b028dab719958707d9e19923261"; + hash = ""; + }; + + frontend = buildNpmPackage { + pname = "${pname}-frontend"; + inherit version src; + + npmDepsHash = ""; + + installPhase = '' + runHook preInstall + cp -r dist $out + runHook postInstall + ''; + }; + +in rustPlatform.buildRustPackage { + inherit pname version src; + + sourceRoot = "${src.name}/src-tauri"; + + cargoHash = ""; + + preBuild = '' + cp -r ${frontend} ../dist + ''; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ + openssl + glib + gtk3 + dbus + libsoup_3 + webkitgtk_4_1 + libayatana-appindicator + ]; + + doCheck = false; + + meta = { + description = "Kiro IDE account manager with multi-account switching and quota monitoring"; + homepage = "https://github.com/hj01857655/kiro-account-manager"; + license = lib.licenses.cc-by-nc-sa-40; + mainProgram = "kiro-account-manager"; + platforms = lib.platforms.linux; + }; +} From e6a8a34661db84e3fb248ce056e7829fa8889585 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Sat, 9 May 2026 07:47:53 +0800 Subject: [PATCH 32/33] kiro-account-manager: fill in hashes and fix frontend path via postPatch --- pkgs/k/kiro-account-manager/package.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/k/kiro-account-manager/package.nix b/pkgs/k/kiro-account-manager/package.nix index 6e8926d..a1d0308 100644 --- a/pkgs/k/kiro-account-manager/package.nix +++ b/pkgs/k/kiro-account-manager/package.nix @@ -20,14 +20,14 @@ let owner = "hj01857655"; repo = "kiro-account-manager"; rev = "2e2d4b09d3ad3b028dab719958707d9e19923261"; - hash = ""; + hash = "sha256-d1TOjpzVNM+qKW12Ny6FeVfxdipY0ZUbs6Xg9TKeinI="; }; frontend = buildNpmPackage { pname = "${pname}-frontend"; inherit version src; - npmDepsHash = ""; + npmDepsHash = "sha256-BI0lxemB7qcu1o7bp6kOZrl1/YTVPa8jNUFpZIMZB1I="; installPhase = '' runHook preInstall @@ -41,10 +41,11 @@ in rustPlatform.buildRustPackage { sourceRoot = "${src.name}/src-tauri"; - cargoHash = ""; + cargoHash = "sha256-GXoNqhwvK9A5zPt0Wb8+hJA+N1nm2DvOb2FfaurLq2Q="; - preBuild = '' - cp -r ${frontend} ../dist + postPatch = '' + substituteInPlace tauri.conf.json \ + --replace-fail '"frontendDist": "../dist"' '"frontendDist": "${frontend}"' ''; nativeBuildInputs = [ pkg-config ]; From cc2dfc8747694ccb202b8fbf8b8f42ca82f9ffa3 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Sat, 9 May 2026 17:06:20 +0800 Subject: [PATCH 33/33] pkgs/h/hermes-agent: add hermes-agent 0.13.0 --- default.nix | 9 +- flake.lock | 162 +++++++++++++++++++++++++++++++- flake.nix | 25 ++++- pkgs/h/hermes-agent/package.nix | 54 +++++++++++ 4 files changed, 241 insertions(+), 9 deletions(-) create mode 100644 pkgs/h/hermes-agent/package.nix diff --git a/default.nix b/default.nix index a099027..0e6782f 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,4 @@ -{pkgs,...}: +{pkgs, uv2nix ? null, pyproject-nix ? null, pyproject-build-systems ? null, npm-lockfile-fix-pkg ? null, ...}: with pkgs; let cedro = callPackage ./pkgs/c/cedro/package.nix {}; @@ -78,6 +78,12 @@ let cetcd = callPackage ./pkgs/c/cetcd/package.nix {}; deepseek-tui = callPackage ./pkgs/d/deepseek-tui/package.nix {}; kiro-account-manager = callPackage ./pkgs/k/kiro-account-manager/package.nix {}; + hermes-agent = callPackage ./pkgs/h/hermes-agent/package.nix { + uv2nix = uv2nix; + pyproject-nix = pyproject-nix; + pyproject-build-systems = pyproject-build-systems; + npm-lockfile-fix = npm-lockfile-fix-pkg; + }; struct2json = callPackage ./pkgs/s/struct2json/package.nix { pkgs = pkgs; }; @@ -96,6 +102,7 @@ in cetcd = cetcd; deepseek-tui = deepseek-tui; kiro-account-manager = kiro-account-manager; + hermes-agent = hermes-agent; libcello_debug = libcello_debug; packcc = packcc_main; struct2json = struct2json; diff --git a/flake.lock b/flake.lock index cb8f9c1..53c8a1a 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1764667669, - "narHash": "sha256-7WUCZfmqLAssbDqwg9cUDAXrSoXN79eEEq17qhTNM/Y=", + "lastModified": 1777954456, + "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "418468ac9527e799809c900eda37cbff999199b6", + "rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1", "type": "github" }, "original": { @@ -34,10 +34,118 @@ "type": "github" } }, + "npm-lockfile-fix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775903712, + "narHash": "sha256-2GV79U6iVH4gKAPWYrxUReB0S41ty/Y3dBLquU8AlaA=", + "owner": "jeslie0", + "repo": "npm-lockfile-fix", + "rev": "c6093acb0c0548e0f9b8b3d82918823721930fe8", + "type": "github" + }, + "original": { + "owner": "jeslie0", + "repo": "npm-lockfile-fix", + "type": "github" + } + }, + "pyproject-build-systems": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "pyproject-nix": "pyproject-nix", + "uv2nix": "uv2nix" + }, + "locked": { + "lastModified": 1776659114, + "narHash": "sha256-qapCOQmR++yZSY43dzrp3wCrkOTLpod+ONtJWBk6iKU=", + "owner": "pyproject-nix", + "repo": "build-system-pkgs", + "rev": "ffaa2161dd5d63e0e94591f86b54fc239660fb2e", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "build-system-pkgs", + "type": "github" + } + }, + "pyproject-nix": { + "inputs": { + "nixpkgs": [ + "pyproject-build-systems", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776317425, + "narHash": "sha256-5iPq7MxKwAhKu76uGkRo/7RWfu9GCtsMdeacetTFINI=", + "owner": "nix-community", + "repo": "pyproject.nix", + "rev": "1b0021e93fa281f694510321514731086dbedd13", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "pyproject.nix", + "type": "github" + } + }, + "pyproject-nix_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776715674, + "narHash": "sha256-Gs1VnEkCkkRZxJQAC/Dhz0Jbfi22mFXChbtNg9w/Ybg=", + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "rev": "69f57f27e52a87c54e28138a75ec741cd46663c9", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "type": "github" + } + }, + "pyproject-nix_3": { + "inputs": { + "nixpkgs": [ + "uv2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776715674, + "narHash": "sha256-Gs1VnEkCkkRZxJQAC/Dhz0Jbfi22mFXChbtNg9w/Ybg=", + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "rev": "69f57f27e52a87c54e28138a75ec741cd46663c9", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "npm-lockfile-fix": "npm-lockfile-fix", + "pyproject-build-systems": "pyproject-build-systems", + "pyproject-nix": "pyproject-nix_2", + "uv2nix": "uv2nix_2" } }, "systems": { @@ -54,6 +162,52 @@ "repo": "default", "type": "github" } + }, + "uv2nix": { + "inputs": { + "nixpkgs": [ + "pyproject-build-systems", + "nixpkgs" + ], + "pyproject-nix": [ + "pyproject-build-systems", + "pyproject-nix" + ] + }, + "locked": { + "lastModified": 1776317509, + "narHash": "sha256-nSriomT9IJvyVY/mzyFz4Un6DHSjCfrVitcIfV+VHnY=", + "owner": "pyproject-nix", + "repo": "uv2nix", + "rev": "56cfeb9813150e1f900f13e4d6fe46e2845f82d5", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "uv2nix", + "type": "github" + } + }, + "uv2nix_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "pyproject-nix": "pyproject-nix_3" + }, + "locked": { + "lastModified": 1777895960, + "narHash": "sha256-KebDsQd+A7pm++Tp0744EjULttHvz1wbKqNKkMA/088=", + "owner": "pyproject-nix", + "repo": "uv2nix", + "rev": "5ad90d48b80ecc920ca2247d53f46beba302e186", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "uv2nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index ff47767..555325e 100644 --- a/flake.nix +++ b/flake.nix @@ -4,16 +4,35 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; + pyproject-nix = { + url = "github:pyproject-nix/pyproject.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + uv2nix = { + url = "github:pyproject-nix/uv2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + pyproject-build-systems = { + url = "github:pyproject-nix/build-system-pkgs"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + npm-lockfile-fix = { + url = "github:jeslie0/npm-lockfile-fix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, flake-utils}: + outputs = { self, nixpkgs, flake-utils, uv2nix, pyproject-nix, pyproject-build-systems, npm-lockfile-fix }: let supportedSystems = [ "x86_64-linux" ]; in flake-utils.lib.eachSystem supportedSystems ( system: let pkgs = nixpkgs.legacyPackages.${system}; - xpkgs = import ./default.nix { inherit pkgs; }; + xpkgs = import ./default.nix { + inherit pkgs uv2nix pyproject-nix pyproject-build-systems; + npm-lockfile-fix-pkg = npm-lockfile-fix.packages.${system}.default; + }; in rec { packages = xpkgs; defaultPackage = xpkgs.uem; @@ -25,5 +44,3 @@ } ); } - - diff --git a/pkgs/h/hermes-agent/package.nix b/pkgs/h/hermes-agent/package.nix new file mode 100644 index 0000000..c239ecd --- /dev/null +++ b/pkgs/h/hermes-agent/package.nix @@ -0,0 +1,54 @@ +{ + lib, + stdenv, + makeWrapper, + callPackage, + fetchFromGitHub, + python312, + nodejs_22, + ripgrep, + git, + openssh, + ffmpeg, + uv2nix, + pyproject-nix, + pyproject-build-systems, + npm-lockfile-fix, +}: +let + rev = "96dc2726232fc02c836b29968550d7dc5af03e36"; + + src = fetchFromGitHub { + owner = "NousResearch"; + repo = "hermes-agent"; + inherit rev; + hash = "sha256-pyqKp9gQLhHz0F8Gsw482CB6M8lRF5mW+Jvxj8sYP7k="; + }; + + # tirith is an optional security scanner that auto-downloads itself at runtime + # if not found on PATH; provide a stub so the nix package builds cleanly. + tirith = stdenv.mkDerivation { + pname = "tirith-stub"; + version = "0"; + dontUnpack = true; + installPhase = "mkdir -p $out/bin"; + }; +in + callPackage "${src}/nix/hermes-agent.nix" { + inherit + lib + stdenv + makeWrapper + python312 + nodejs_22 + ripgrep + git + openssh + ffmpeg + tirith + uv2nix + pyproject-nix + pyproject-build-systems + npm-lockfile-fix + ; + }