mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 07:05:13 +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" ```
52 lines
1.5 KiB
Nix
52 lines
1.5 KiB
Nix
{ lib, stdenv, rustPlatform, fetchFromBitbucket, Libsystem, SystemConfiguration, installShellFiles }:
|
||
|
||
rustPlatform.buildRustPackage rec {
|
||
pname = "bore";
|
||
version = "0.4.1";
|
||
|
||
src = fetchFromBitbucket {
|
||
owner = "delan";
|
||
repo = "nonymous";
|
||
rev = "${pname}-${version}";
|
||
sha256 = "1fdnnx7d18gj4rkv1dc6q379dqabl66zks9i0rjarjwcci8m30d9";
|
||
};
|
||
|
||
cargoHash = "sha256-vUKv98lfsrxBiJxjL8ZKLZ1IVCX5hHzl+F5y4Ot3i/Y=";
|
||
cargoBuildFlags = [ "-p" pname ];
|
||
|
||
# error[E0793]: reference to packed field is unaligned
|
||
doCheck = !stdenv.hostPlatform.isDarwin;
|
||
|
||
# FIXME can’t test --all-targets and --doc in a single invocation
|
||
cargoTestFlags = [ "--all-targets" "--workspace" ];
|
||
checkFeatures = [ "std" ];
|
||
|
||
nativeBuildInputs = [ installShellFiles ]
|
||
++ lib.optional stdenv.hostPlatform.isDarwin rustPlatform.bindgenHook;
|
||
|
||
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
||
Libsystem
|
||
SystemConfiguration
|
||
];
|
||
|
||
postInstall = ''
|
||
installManPage $src/bore/doc/bore.1
|
||
'';
|
||
|
||
doInstallCheck = true;
|
||
installCheckPhase = ''
|
||
printf '\0\0\0\0\0\0\0\0\0\0\0\0' \
|
||
| $out/bin/bore --decode \
|
||
| grep -q ';; NoError #0 Query 0 0 0 0 flags'
|
||
'';
|
||
|
||
meta = with lib; {
|
||
description = "DNS query tool";
|
||
homepage = "https://crates.io/crates/bore";
|
||
license = licenses.isc;
|
||
maintainers = [ ];
|
||
mainProgram = "bore";
|
||
broken = stdenv.hostPlatform.isDarwin; # bindgen fails on: "in6_addr_union_(...)" is not a valid Ident
|
||
};
|
||
}
|