pureintent: add devbox.nix with proxychains + devbox-run wrapper (#114)

Routes shell-invoked commands through the existing jumphost SOCKS5 proxy
(programs.jumphost.socks5Proxy), so Go tools that bypass libc (nix, step,
pu) pick up the proxy via ALL_PROXY/HTTPS_PROXY/HTTP_PROXY while libc
callers (ssh) get it via proxychains.

Usage: devbox-run nix run github:juspay/project-unknown -- connect <name>
This commit is contained in:
Sridhar Ratnakumar 2026-05-13 16:21:31 -04:00 committed by GitHub
parent 4e2be64bb2
commit bc5e7c8d27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 0 deletions

View file

@ -25,6 +25,7 @@ in
imports = [
self.nixosModules.default
./configuration.nix
./devbox.nix
(self + /modules/nixos/linux/beszel.nix)
(self + /modules/nixos/linux/incus)
];

View file

@ -0,0 +1,33 @@
# Depends on programs.jumphost.socks5Proxy (https://github.com/srid/jumphost-nix)
# for the local SOCKS5 listener. See modules/home/work/juspay.nix:29-31.
{ config, flake, pkgs, ... }:
let
socksPort = config.home-manager.users.${flake.config.me.username}.programs.jumphost.socks5Proxy.port;
proxychainsBin = "${config.programs.proxychains.package}/bin/proxychains4";
devbox-run = pkgs.writeShellScriptBin "devbox-run" ''
export ALL_PROXY=socks5://127.0.0.1:${toString socksPort}
export HTTPS_PROXY=socks5://127.0.0.1:${toString socksPort}
export HTTP_PROXY=socks5://127.0.0.1:${toString socksPort}
exec ${proxychainsBin} "$@"
'';
in
{
programs.proxychains = {
enable = true;
chain.type = "strict";
proxyDNS = true;
proxies.devbox = {
enable = true;
type = "socks5";
host = "127.0.0.1";
port = socksPort;
};
};
environment.systemPackages = [
devbox-run
];
}