nixpkgs/pkgs/tools/text/mdbook-pdf/default.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

50 lines
1.1 KiB
Nix

{ lib
, stdenv
, fetchCrate
, rustPlatform
, pkg-config
, openssl
, CoreServices
}:
rustPlatform.buildRustPackage rec {
pname = "mdbook-pdf";
version = "0.1.10";
src = fetchCrate {
inherit pname version;
hash = "sha256-zRoO84ij7zF1I8ijXS/oApMKfS3e04+5/CgahAemqCA=";
};
cargoHash = "sha256-eay3tl4edeM05D+0iIu8Zw4L1N2Bk1csLo0AwNdyCdA=";
nativeBuildInputs = [
pkg-config
];
buildInputs = [
openssl
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
CoreServices
];
# Stop downloading from the Internet to
# generate the Chrome Devtools Protocol
env.DOCS_RS = true;
# Stop formatting with rustfmt
env.DO_NOT_FORMAT = true;
# No test.
doCheck = false;
meta = with lib; {
description = "Backend for mdBook written in Rust for generating PDF";
mainProgram = "mdbook-pdf";
homepage = "https://github.com/HollowMan6/mdbook-pdf";
changelog = "https://github.com/HollowMan6/mdbook-pdf/releases/tag/v${version}";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ hollowman6 matthiasbeyer ];
};
}