nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 cacert,
4 nixosTests,
5 rustPlatform,
6 fetchFromGitHub,
7 nix-update-script,
8}:
9
10rustPlatform.buildRustPackage {
11 pname = "redlib";
12 version = "0.36.0-unstable-2025-12-16";
13
14 src = fetchFromGitHub {
15 owner = "redlib-org";
16 repo = "redlib";
17 rev = "ba98178bbce0f62265095ba085128c7022e51a1f";
18 hash = "sha256-ERTEoT7w8oGA0ztrzc9r9Bl/7OOay+APg3pW+h3tgvM=";
19 };
20
21 cargoHash = "sha256-ageSjIX0BLVYlLAjeojQq5N6/VASOIpwXNR/3msl/p4=";
22
23 postInstall = ''
24 install --mode=444 -D contrib/redlib.service $out/lib/systemd/system/redlib.service
25 substituteInPlace $out/lib/systemd/system/redlib.service \
26 --replace-fail "/usr/bin/redlib" "$out/bin/redlib"
27 '';
28
29 checkFlags = [
30 # All these test try to connect to Reddit.
31 # utils.rs
32 "--skip=test_fetching_subreddit_quarantined"
33 "--skip=test_fetching_nsfw_subreddit"
34 "--skip=test_fetching_ws"
35
36 # client.rs
37 "--skip=test_obfuscated_share_link"
38 "--skip=test_share_link_strip_json"
39 "--skip=test_localization_popular"
40 "--skip=test_private_sub"
41 "--skip=test_banned_sub"
42 "--skip=test_gated_sub"
43 "--skip=test_default_subscriptions"
44 "--skip=test_rate_limit_check"
45
46 # subreddit.rs
47 "--skip=test_fetching_subreddit"
48 "--skip=test_gated_and_quarantined"
49
50 # user.rs
51 "--skip=test_fetching_user"
52
53 # These try to connect to the oauth client
54 # oauth.rs
55 "--skip=test_oauth_client"
56 "--skip=test_oauth_client_refresh"
57 "--skip=test_oauth_token_exists"
58 "--skip=test_oauth_headers_len"
59 "--skip=oauth::test_generic_web_backend"
60 "--skip=oauth::test_mobile_spoof_backend"
61 ];
62
63 env = {
64 SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
65 };
66
67 passthru = {
68 tests = nixosTests.redlib;
69 updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
70 };
71
72 meta = {
73 description = "Private front-end for Reddit (Continued fork of Libreddit)";
74 homepage = "https://github.com/redlib-org/redlib";
75 license = lib.licenses.agpl3Only;
76 mainProgram = "redlib";
77 maintainers = with lib.maintainers; [
78 bpeetz
79 Guanran928
80 ];
81 };
82}