mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
e0464e4788
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" ```
57 lines
1.3 KiB
Nix
57 lines
1.3 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
nix,
|
|
rustPlatform,
|
|
darwin,
|
|
CoreServices ? darwin.apple_sdk.frameworks.CoreServices,
|
|
installShellFiles,
|
|
}:
|
|
let
|
|
version = "0.4.40";
|
|
in
|
|
rustPlatform.buildRustPackage {
|
|
inherit version;
|
|
pname = "mdbook";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "rust-lang";
|
|
repo = "mdBook";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-GGQK2Mf3EK1rwBMzQkAzWAaK6Fh0Qqqf8dtDjZPxOMA=";
|
|
};
|
|
|
|
cargoHash = "sha256-jriSQHn+Y+EWtwDJeMTAuCCHR7fEtWsErAxbG9a4pts=";
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ CoreServices ];
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd mdbook \
|
|
--bash <($out/bin/mdbook completions bash) \
|
|
--fish <($out/bin/mdbook completions fish) \
|
|
--zsh <($out/bin/mdbook completions zsh )
|
|
'';
|
|
|
|
passthru = {
|
|
tests = {
|
|
inherit nix;
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
description = "Create books from MarkDown";
|
|
mainProgram = "mdbook";
|
|
homepage = "https://github.com/rust-lang/mdBook";
|
|
changelog = "https://github.com/rust-lang/mdBook/blob/v${version}/CHANGELOG.md";
|
|
license = [ lib.licenses.mpl20 ];
|
|
maintainers = with lib.maintainers; [
|
|
havvy
|
|
Frostman
|
|
matthiasbeyer
|
|
];
|
|
};
|
|
}
|