nixpkgs/pkgs/games/anki/sync-server.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

52 lines
1.1 KiB
Nix

{ lib
, stdenv
, rustPlatform
, anki
, darwin
, openssl
, pkg-config
, protobuf
}:
rustPlatform.buildRustPackage {
pname = "anki-sync-server";
inherit (anki) version src cargoLock;
patches = [
./patches/Cargo.lock-update-time-for-rust-1.80.patch
];
# only build sync server
cargoBuildFlags = [
"--bin"
"anki-sync-server"
];
checkFlags = [
# these two tests are flaky, see https://github.com/ankitects/anki/issues/3353
# Also removed from anki when removing this.
"--skip=media::check::test::unicode_normalization"
"--skip=scheduler::answering::test::state_application"
];
nativeBuildInputs = [ protobuf pkg-config ];
buildInputs = [
openssl
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];
env.PROTOC = lib.getExe protobuf;
meta = with lib; {
description = "Standalone official anki sync server";
homepage = "https://apps.ankiweb.net";
license = with licenses; [ agpl3Plus ];
maintainers = with maintainers; [ martinetd ];
mainProgram = "anki-sync-server";
};
}