about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/nitter/default.nix
blob: 013a66ef3d3f4663d582433c8e93cd60a51ac788 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{ lib
, buildNimPackage
, fetchFromGitHub
, nimPackages
, nixosTests
, substituteAll
, unstableGitUpdater
, flatty
, jester
, jsony
, karax
, markdown
, nimcrypto
, packedjson
, redis
, redpool
, sass
, supersnappy
, zippy
}:

buildNimPackage rec {
  pname = "nitter";
  version = "unstable-2023-08-08";

  src = fetchFromGitHub {
    owner = "zedeus";
    repo = "nitter";
    rev = "d7ca353a55ea3440a2ec1f09155951210a374cc7";
    hash = "sha256-nlpUzbMkDzDk1n4X+9Wk7+qQk+KOfs5ID6euIfHBoa8=";
  };

  patches = [
    (substituteAll {
      src = ./nitter-version.patch;
      inherit version;
      inherit (src) rev;
      url = builtins.replaceStrings [ "archive" ".tar.gz" ] [ "commit" "" ] src.url;
    })
  ];

  buildInputs = [
    flatty
    jester
    jsony
    karax
    markdown
    nimcrypto
    packedjson
    redis
    redpool
    sass
    supersnappy
    zippy
  ];

  nimBinOnly = true;

  nimFlags = [ "--mm:refc" ];

  postBuild = ''
    nim c --hint[Processing]:off -r tools/gencss
    nim c --hint[Processing]:off -r tools/rendermd
  '';

  postInstall = ''
    mkdir -p $out/share/nitter
    cp -r public $out/share/nitter/public
  '';

  passthru = {
    tests = { inherit (nixosTests) nitter; };
    updateScript = unstableGitUpdater {};
  };

  meta = with lib; {
    homepage = "https://github.com/zedeus/nitter";
    description = "Alternative Twitter front-end";
    license = licenses.agpl3Only;
    maintainers = with maintainers; [ erdnaxe infinidoge ];
    mainProgram = "nitter";
  };
}