about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/wgnord/default.nix
blob: a85c318c65d7778e05cc3c2cb2834d4f8402b339 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ bash
, coreutils
, curl
, fetchFromGitHub
, gnugrep
, gnused
, iproute2
, jq
, lib
, resholve
, wireguard-tools
}:

resholve.mkDerivation rec {
  pname = "wgnord";
  version = "0.2.0";

  src = fetchFromGitHub {
    owner = "phirecc";
    repo = pname;
    rev = version;
    hash = "sha256-00513jr3Sk8YahqI14pQ7pU4P7MBUlsqXXfrACu35RQ=";
  };

  postPatch = ''
    substituteInPlace wgnord \
      --replace '$conf_dir/countries.txt' "$out/share/countries.txt" \
      --replace '$conf_dir/countries_iso31662.txt' "$out/share/countries_iso31662.txt"
  '';

  dontBuild = true;

  installPhase = ''
    install -Dm 755 wgnord -t $out/bin/
    install -Dm 644 countries.txt -t $out/share/
    install -Dm 644 countries_iso31662.txt -t $out/share/
  '';

  solutions.default = {
    scripts = [ "bin/wgnord" ];
    interpreter = "${bash}/bin/sh";
    inputs = [
      coreutils
      curl
      gnugrep
      gnused
      iproute2
      jq
      wireguard-tools
    ];
    fix.aliases = true; # curl command in an alias
    execer = [
      "cannot:${iproute2}/bin/ip"
      "cannot:${wireguard-tools}/bin/wg-quick"
    ];
  };

  meta = with lib; {
    description = "A NordVPN Wireguard (NordLynx) client in POSIX shell";
    homepage = "https://github.com/phirecc/wgnord";
    changelog = "https://github.com/phirecc/wgnord/releases/tag/v${version}";
    maintainers = with lib.maintainers; [ urandom ];
    license = licenses.mit;
  };
}