nixpkgs/pkgs/by-name/ac/acpica-tools/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

57 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, bison
, flex
}:
stdenv.mkDerivation rec {
pname = "acpica-tools";
version = "20240827";
src = fetchFromGitHub {
owner = "acpica";
repo = "acpica";
rev = "refs/tags/version-${version}";
hash = "sha256-RlhKBvydesUdBaFUHk3sSM6SRIZ7q5IqnibX+hps+Tc=";
};
nativeBuildInputs = [ bison flex ];
buildFlags = [
"acpibin"
"acpidump"
"acpiexamples"
"acpiexec"
"acpihelp"
"acpisrc"
"acpixtract"
"iasl"
];
env.NIX_CFLAGS_COMPILE = toString ([
"-O3"
]);
enableParallelBuilding = true;
# i686 builds fail with hardening enabled (due to -Wformat-overflow). Disable
# -Werror altogether to make this derivation less fragile to toolchain
# updates.
NOWERROR = "TRUE";
# We can handle stripping ourselves.
# Unless we are on Darwin. Upstream makefiles degrade coreutils install to cp if _APPLE is detected.
INSTALLFLAGS = lib.optionals (!stdenv.hostPlatform.isDarwin) "-m 555";
installFlags = [ "PREFIX=${placeholder "out"}" ];
meta = with lib; {
homepage = "https://www.acpica.org/";
description = "ACPICA Tools";
license = with licenses; [ iasl gpl2Only bsd3 ];
maintainers = with maintainers; [ tadfisher felixsinger ];
platforms = platforms.linux ++ platforms.darwin;
};
}