nixpkgs/pkgs/by-name/re/redlib/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

70 lines
1.7 KiB
Nix

{
lib,
stdenv,
cacert,
nixosTests,
rustPlatform,
fetchFromGitHub,
darwin,
}:
rustPlatform.buildRustPackage rec {
pname = "redlib";
version = "0.35.1-unstable-2024-09-22";
src = fetchFromGitHub {
owner = "redlib-org";
repo = "redlib";
rev = "d5f137ce47de39e2c8c4ed09d13ba1f809bee560";
hash = "sha256-12XKeBCKciKummI43oTbKGkkY0mghA82ir2C3LhnwSs=";
};
cargoHash = "sha256-XSmeJAK18J9WxrG5orFbAB9hWVLQQ50oB223oHT3OOk=";
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.Security
];
checkFlags = [
# All these test try to connect to Reddit.
# utils.rs
"--skip=test_fetching_subreddit_quarantined"
"--skip=test_fetching_nsfw_subreddit"
"--skip=test_fetching_ws"
# client.rs
"--skip=test_obfuscated_share_link"
"--skip=test_share_link_strip_json"
"--skip=test_localization_popular"
# subreddit.rs
"--skip=test_fetching_subreddit"
"--skip=test_gated_and_quarantined"
# user.rs
"--skip=test_fetching_user"
# These try to connect to the oauth client
# oauth.rs
"--skip=test_oauth_client"
"--skip=test_oauth_client_refresh"
"--skip=test_oauth_token_exists"
];
env = {
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
};
passthru.tests = {
inherit (nixosTests) redlib;
};
meta = {
changelog = "https://github.com/redlib-org/redlib/releases/tag/v${version}";
description = "Private front-end for Reddit (Continued fork of Libreddit)";
homepage = "https://github.com/redlib-org/redlib";
license = lib.licenses.agpl3Only;
mainProgram = "redlib";
maintainers = with lib.maintainers; [ soispha ];
};
}