Merge pull request #175140 from Yureien/init/expressvpn

expressvpn: init at 3.25.0.13

authored by Sandro and committed by GitHub 90cd5459 8c746505

+139
+7
nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
··· 71 71 <link linkend="opt-services.persistent-evdev.enable">services.persistent-evdev</link>. 72 72 </para> 73 73 </listitem> 74 + <listitem> 75 + <para> 76 + <link xlink:href="https://www.expressvpn.com">expressvpn</link>, 77 + the CLI client for ExpressVPN. Available as 78 + <link linkend="opt-services.expressvpn.enable">services.expressvpn</link>. 79 + </para> 80 + </listitem> 74 81 </itemizedlist> 75 82 </section> 76 83 <section xml:id="sec-release-22.11-incompatibilities">
+2
nixos/doc/manual/release-notes/rl-2211.section.md
··· 31 31 Available as [services.infnoise](options.html#opt-services.infnoise.enable). 32 32 - [persistent-evdev](https://github.com/aiberia/persistent-evdev), a daemon to add virtual proxy devices that mirror a physical input device but persist even if the underlying hardware is hot-plugged. Available as [services.persistent-evdev](#opt-services.persistent-evdev.enable). 33 33 34 + - [expressvpn](https://www.expressvpn.com), the CLI client for ExpressVPN. Available as [services.expressvpn](#opt-services.expressvpn.enable). 35 + 34 36 <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. --> 35 37 36 38 ## Backward Incompatibilities {#sec-release-22.11-incompatibilities}
+1
nixos/modules/module-list.nix
··· 771 771 ./services/networking/ergo.nix 772 772 ./services/networking/ergochat.nix 773 773 ./services/networking/eternal-terminal.nix 774 + ./services/networking/expressvpn.nix 774 775 ./services/networking/fakeroute.nix 775 776 ./services/networking/ferm.nix 776 777 ./services/networking/fireqos.nix
+29
nixos/modules/services/networking/expressvpn.nix
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + with lib; 4 + { 5 + options.services.expressvpn.enable = mkOption { 6 + type = types.bool; 7 + default = false; 8 + description = '' 9 + Enable the ExpressVPN daemon. 10 + ''; 11 + }; 12 + 13 + config = mkIf config.services.expressvpn.enable { 14 + boot.kernelModules = [ "tun" ]; 15 + 16 + systemd.services.expressvpn = { 17 + description = "ExpressVPN Daemon"; 18 + serviceConfig = { 19 + ExecStart = "${pkgs.expressvpn}/bin/expressvpnd"; 20 + Restart = "on-failure"; 21 + RestartSec = 5; 22 + }; 23 + wantedBy = [ "multi-user.target" ]; 24 + after = [ "network.target" "network-online.target" ]; 25 + }; 26 + }; 27 + 28 + meta.maintainers = with maintainers; [ yureien ]; 29 + }
+98
pkgs/applications/networking/expressvpn/default.nix
··· 1 + { autoPatchelfHook 2 + , buildFHSUserEnv 3 + , dpkg 4 + , fetchurl 5 + , inotify-tools 6 + , lib 7 + , stdenvNoCC 8 + , sysctl 9 + , writeScript 10 + }: 11 + 12 + let 13 + pname = "expressvpn"; 14 + clientVersion = "3.25.0"; 15 + clientBuild = "13"; 16 + version = lib.strings.concatStringsSep "." [ clientVersion clientBuild ]; 17 + 18 + expressvpnBase = stdenvNoCC.mkDerivation { 19 + inherit pname version; 20 + 21 + src = fetchurl { 22 + url = "https://www.expressvpn.works/clients/linux/expressvpn_${version}-1_amd64.deb"; 23 + hash = "sha256-lyDjG346FrgT7SZbsWET+Hexl9Un6mzMukfO2PwlInA="; 24 + }; 25 + 26 + nativeBuildInputs = [ dpkg autoPatchelfHook ]; 27 + 28 + dontConfigure = true; 29 + dontBuild = true; 30 + 31 + unpackPhase = '' 32 + runHook preUnpack 33 + dpkg --fsys-tarfile $src | tar --extract 34 + runHook postUnpack 35 + ''; 36 + 37 + installPhase = '' 38 + runHook preInstall 39 + mv usr/ $out/ 40 + runHook postInstall 41 + ''; 42 + }; 43 + 44 + expressvpndFHS = buildFHSUserEnv { 45 + name = "expressvpnd"; 46 + 47 + # When connected, it directly creates/deletes resolv.conf to change the DNS entries. 48 + # Since it's running in an FHS environment, it has no effect on actual resolv.conf. 49 + # Hence, place a watcher that updates host resolv.conf when FHS resolv.conf changes. 50 + runScript = writeScript "${pname}-wrapper" '' 51 + cp /host/etc/resolv.conf /etc/resolv.conf; 52 + while inotifywait /etc 2>/dev/null; 53 + do 54 + cp /etc/resolv.conf /host/etc/resolv.conf; 55 + done & 56 + expressvpnd --client-version ${clientVersion} --client-build ${clientBuild} 57 + ''; 58 + 59 + # expressvpnd binary has hard-coded the path /sbin/sysctl hence below workaround. 60 + extraBuildCommands = '' 61 + chmod +w sbin 62 + ln -s ${sysctl}/bin/sysctl sbin/sysctl 63 + ''; 64 + 65 + # The expressvpnd binary also uses hard-coded paths to the other binaries and files 66 + # it ships with, hence the FHS environment. 67 + 68 + targetPkgs = pkgs: with pkgs; [ 69 + expressvpnBase 70 + inotify-tools 71 + iproute2 72 + ]; 73 + }; 74 + in 75 + stdenvNoCC.mkDerivation { 76 + inherit pname version; 77 + 78 + dontUnpack = true; 79 + dontConfigure = true; 80 + dontBuild = true; 81 + 82 + installPhase = '' 83 + runHook preInstall 84 + mkdir -p $out/bin $out/share 85 + ln -s ${expressvpnBase}/bin/expressvpn $out/bin 86 + ln -s ${expressvpndFHS}/bin/expressvpnd $out/bin 87 + ln -s ${expressvpnBase}/share/{bash-completion,doc,man} $out/share/ 88 + runHook postInstall 89 + ''; 90 + 91 + meta = with lib; { 92 + description = "CLI client for ExpressVPN"; 93 + homepage = "https://www.expressvpn.com"; 94 + license = licenses.unfree; 95 + platforms = [ "x86_64-linux" ]; 96 + maintainers = with maintainers; [ yureien ]; 97 + }; 98 + }
+2
pkgs/top-level/all-packages.nix
··· 392 392 393 393 evans = callPackage ../development/tools/evans { }; 394 394 395 + expressvpn = callPackage ../applications/networking/expressvpn { }; 396 + 395 397 firefly-desktop = callPackage ../applications/misc/firefly-desktop { }; 396 398 397 399 frugal = callPackage ../development/tools/frugal { };