From 232d56f2dcb31e72ab372611f0f58fdb8e3e2711 Mon Sep 17 00:00:00 2001 From: hermes Date: Sat, 3 Oct 2026 19:16:57 +0000 Subject: [PATCH 1/2] nix: add flake (package, app, overlay, devShell) --- README.md | 1 + flake.nix | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 flake.nix diff --git a/README.md b/README.md index ca4de93..d93f1bb 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Minimal Rust coding agent. Uses your existing subscriptions, no API keys. ```sh +nix run github:johannes/hx # Nix: run directly (flake; also `nix profile install`) cargo build --release hx login claude # Claude Pro/Max hx login codex # ChatGPT Plus/Pro diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a093d2c --- /dev/null +++ b/flake.nix @@ -0,0 +1,47 @@ +{ + description = "hx: minimal Rust coding agent"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = + { self, nixpkgs }: + let + systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forAll = f: nixpkgs.lib.genAttrs systems (s: f nixpkgs.legacyPackages.${s}); + in + { + packages = forAll (pkgs: rec { + hx = pkgs.rustPlatform.buildRustPackage { + pname = "hx"; + version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version; + src = pkgs.lib.cleanSource ./.; + cargoLock.lockFile = ./Cargo.lock; + cargoBuildFlags = [ "-p" "hx-cli" ]; + # ponytail: tests skipped (need git/network); enable when hermetic. + doCheck = false; + # rustls may build aws-lc-sys (cmake) depending on feature set. + nativeBuildInputs = [ pkgs.cmake pkgs.perl ]; + dontUseCmakeConfigure = true; + meta = { + description = "Minimal Rust coding agent using existing subscriptions"; + license = pkgs.lib.licenses.unlicense; + mainProgram = "hx"; + }; + }; + default = hx; + }); + + apps = forAll (pkgs: rec { + hx = { type = "app"; program = "${self.packages.${pkgs.system}.hx}/bin/hx"; }; + default = hx; + }); + + overlays.default = _: prev: { hx = self.packages.${prev.system}.hx; }; + + devShells = forAll (pkgs: { + default = pkgs.mkShell { + packages = with pkgs; [ cargo rustc clippy rustfmt rust-analyzer git ]; + }; + }); + }; +} -- 2.54.1 From 5d21012c4380e6c2e23da8e6f5e941429e9903f7 Mon Sep 17 00:00:00 2001 From: hermes Date: Sat, 3 Oct 2026 19:17:08 +0000 Subject: [PATCH 2/2] readme: nix url --- README.md | 2 +- flake.lock | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 flake.lock diff --git a/README.md b/README.md index d93f1bb..d690143 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Minimal Rust coding agent. Uses your existing subscriptions, no API keys. ```sh -nix run github:johannes/hx # Nix: run directly (flake; also `nix profile install`) +nix run git+https://git.jokresner.de/johannes/hx # Nix: run directly (flake; also `nix profile install`) cargo build --release hx login claude # Claude Pro/Max hx login codex # ChatGPT Plus/Pro diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..12b201d --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1790822859, + "narHash": "sha256-69xHQhAeMAD2wDXO7T2pcOZIF9Sga2W+JkmY2a11Ops=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c59305bab2065cfecc4944690d9eedbb56f3a9fa", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} -- 2.54.1