clash.nix 647 B

123456789101112131415161718
  1. { config, pkgs, ... }:
  2. {
  3. systemd.services.clash = {
  4. wantedBy = [ "multi-user.target" ];
  5. after = [ "network-online.target" ];
  6. description = "Clash Service";
  7. serviceConfig = {
  8. Type = "simple";
  9. User = "clash";
  10. Group = "clash";
  11. ExecStart = "${pkgs.clash-meta}/bin/clash-meta -d /etc/clash";
  12. Restart = "on-failure";
  13. CapabilityBoundingSet="CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW";
  14. AmbientCapabilities="CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW";
  15. };
  16. };
  17. environment.systemPackages = [ pkgs.clash-meta ];
  18. }