mirror of
https://github.com/srid/nixos-config.git
synced 2026-07-16 22:01:33 +08:00
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:
parent
4e2be64bb2
commit
bc5e7c8d27
2 changed files with 34 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ in
|
|||
imports = [
|
||||
self.nixosModules.default
|
||||
./configuration.nix
|
||||
./devbox.nix
|
||||
(self + /modules/nixos/linux/beszel.nix)
|
||||
(self + /modules/nixos/linux/incus)
|
||||
];
|
||||
|
|
|
|||
33
configurations/nixos/pureintent/devbox.nix
Normal file
33
configurations/nixos/pureintent/devbox.nix
Normal 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
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue