Commit 1c26e0e7 authored by Zahrun's avatar Zahrun
Browse files

speedify: init at 15.6.4-12495

parent 7d123199
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@

- [qBittorrent](https://www.qbittorrent.org/), is a bittorrent client programmed in C++ / Qt that uses libtorrent by Arvid Norberg. Available as [services.qbittorrent](#opt-services.qbittorrent.enable).

- [Speedify](https://speedify.com/), a proprietary VPN which allows combining multiple internet connections (Wi-Fi, 4G, 5G, Ethernet, Starlink, Satellite, and more) to improve the stability, speed, and security of online experiences. Available as [services.speedify](#opt-services.speedify.enable).

- [Szurubooru](https://github.com/rr-/szurubooru), an image board engine inspired by services such as Danbooru, dedicated for small and medium communities. Available as [services.szurubooru](#opt-services.szurubooru.enable).

- The [Neat IP Address Planner](https://spritelink.github.io/NIPAP/) (NIPAP) can now be enabled through [services.nipap.enable](#opt-services.nipap.enable).
+1 −0
Original line number Diff line number Diff line
@@ -1335,6 +1335,7 @@
  ./services/networking/soju.nix
  ./services/networking/solanum.nix
  ./services/networking/spacecookie.nix
  ./services/networking/speedify.nix
  ./services/networking/spiped.nix
  ./services/networking/squid.nix
  ./services/networking/ssh/sshd.nix
+59 −0
Original line number Diff line number Diff line
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.services.speedify;
in
{
  options.services.speedify = {
    enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        This option enables Speedify daemon.
        This sets {option}`networking.firewall.checkReversePath` to "loose", which might be undesirable for security.
      '';
    };

    package = lib.mkPackageOption pkgs "speedify" { };
  };

  config = lib.mkIf cfg.enable {
    boot.kernelModules = [ "tun" ];

    networking.firewall.checkReversePath = "loose";

    systemd.services.speedify = {
      description = "Speedify Service";
      wantedBy = [ "multi-user.target" ];
      wants = [
        "network.target"
        "network-online.target"
      ];
      after = [
        "network-online.target"
      ]
      ++ lib.optional config.networking.networkmanager.enable "NetworkManager.service";
      path = [
        pkgs.procps
        pkgs.nettools
      ];
      serviceConfig = {
        ExecStart = "${cfg.package}/share/speedify/SpeedifyStartup.sh";
        ExecStop = "${cfg.package}/share/speedify/SpeedifyShutdown.sh";
        Restart = "on-failure";
        RestartSec = 5;
        TimeoutStartSec = 30;
        TimeoutStopSec = 30;
        Type = "forking";
      };
    };
  };

  meta.maintainers = with lib.maintainers; [
    zahrun
  ];
}
+61 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  dpkg,
  fetchurl,
  procps,
  net-tools,
  autoPatchelfHook,
}:
stdenv.mkDerivation rec {
  pname = "speedify";
  version = "15.6.4-12495";

  src = fetchurl {
    url = "https://apt.connectify.me/pool/main/s/speedify/speedify_${version}_amd64.deb";
    hash = "sha256-b8J7JqVxuRREC16DeKD7hOBX4IZMbJPLArLmPtnDUB4=";
  };

  nativeBuildInputs = [
    dpkg
    autoPatchelfHook
  ];

  buildInputs = [
    procps
    net-tools
  ];

  installPhase = ''
    runHook preInstall

    substituteInPlace "usr/share/speedify/SpeedifyStartup.sh" "usr/share/speedify/SpeedifyShutdown.sh" "usr/share/speedify/GenerateLogs.sh" \
      --replace-fail '/usr/share/' "$out/share/"
    substituteInPlace "usr/share/speedify/SpeedifyStartup.sh" \
      --replace-fail 'logs' "/var/log/speedify"

    mkdir -p $out/share/
    mv usr/share $out/
    mkdir -p $out/etc/
    mv lib/systemd $out/etc/

    mkdir -p $out/bin
    ln -s $out/share/speedify/speedify_cli $out/bin/speedify_cli

    runHook postInstall
  '';

  meta = {
    homepage = "https://speedify.com/";
    description = "Use multiple internet connections in parallel";
    longDescription = ''
      Combine multiple internet connections (Wi-Fi, 4G, 5G, Ethernet, Starlink, Satellite, and more)
      to improve the stability, speed, and security of your online experiences.
      Check corresponding option {option}`services.speedify.enable`
    '';
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    license = lib.licenses.unfree;
    platforms = [ "x86_64-linux" ];
    maintainers = with lib.maintainers; [ zahrun ];
  };
}