21 lines
577 B
Nix
21 lines
577 B
Nix
{ pkgs, ... }:
|
|
|
|
{
|
|
systemd.user.services.shadowsocks-proxy = {
|
|
Unit.Description = "Shadowsocks proxy service";
|
|
Install.WantedBy = [ "default.target" ];
|
|
Service = {
|
|
Restart = "always";
|
|
ExecStart = "${pkgs.writeShellScript "sslocal-service-start" ''
|
|
#!/run/current-system/sw/bin/bash
|
|
${pkgs.shadowsocks-rust}/bin/sslocal -c ${./shadowsocks.json}
|
|
''}";
|
|
ExecStop = "${pkgs.writeShellScript "sslocal-service-stop" ''
|
|
#!/run/current-system/sw/bin/bash
|
|
${pkgs.toybox}/bin/killall sslocal
|
|
''}";
|
|
|
|
};
|
|
};
|
|
}
|