I’ve recently switched from Arch to NixOS - one of my goto tools when I want to route traffic via a different ssh machine is using a socks proxy with tsocks - on any other distro I’m setting this up by modifying /etc/tsocks.conf which is not possible on NixOS - what’s the nix way to do that?
You can create arbitrary files in /etc/ using the options environment.etc. An example would be:
{config, ...}: {
environment.etc.”tsocks.conf”.text = ‘‘
your text here
this will become the body of the file
it can also use nix interpolation
${config.something.someValue}
‘‘;
}
The name of all files and folders are prepended with /etc/. You can read up more here: https://search.nixos.org/options?channel=25.11&query=environment.etc
1 Like
I think TSOCKS can be configured via environment variables, but if you want a global mutable configuration file, you can request a symlink from /etc/tsocks.conf to whatever location you store the mutable tsocks config (which is probably also a symlink to one of the prepared files, but not necessarily)
1 Like