about summary refs log tree commit diff
path: root/nixos/tests/nitter.nix
blob: 114f1aac7c7af82b7ab83dc273419a29a9c4083b (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
import ./make-test-python.nix ({ pkgs, ... }:

let
  # In a real deployment this should naturally not common from the nix store
  # and be seeded via agenix or as a non-nix managed file.
  #
  # These credentials are from the nitter wiki and are expired. We must provide
  # credentials in the correct format, otherwise nitter fails to start. They
  # must not be valid, as unauthorized errors are handled gracefully.
  guestAccountFile = pkgs.writeText "guest_accounts.jsonl" ''
    {"oauth_token":"1719213587296620928-BsXY2RIJEw7fjxoNwbBemgjJhueK0m","oauth_token_secret":"N0WB0xhL4ng6WTN44aZO82SUJjz7ssI3hHez2CUhTiYqy"}
  '';
in
{
  name = "nitter";
  meta.maintainers = with pkgs.lib.maintainers; [ erdnaxe ];

  nodes.machine = {
    services.nitter = {
      enable = true;
      # Test CAP_NET_BIND_SERVICE
      server.port = 80;
      # Provide dummy guest accounts
      guestAccounts = guestAccountFile;
    };
  };

  testScript = ''
    machine.wait_for_unit("nitter.service")
    machine.wait_for_open_port(80)
    machine.succeed("curl --fail http://localhost:80/")
  '';
})