nixpkgs/pkgs/tools/graphics/mesa-demos/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

71 lines
1.2 KiB
Nix

{ lib
, stdenv
, fetchurl
, libglut
, libGL
, libGLU
, libX11
, libXext
, mesa
, meson
, ninja
, pkg-config
, wayland
, wayland-scanner
, wayland-protocols
, vulkan-loader
, libxkbcommon
, libdecor
, glslang
}:
stdenv.mkDerivation rec {
pname = "mesa-demos";
version = "9.0.0";
src = fetchurl {
url = "https://archive.mesa3d.org/demos/${pname}-${version}.tar.xz";
sha256 = "sha256-MEaj0mp7BRr3690lel8jv+sWDK1u2VIynN/x6fHtSWs=";
};
depsBuildBuild = [
pkg-config
];
nativeBuildInputs = [
meson
ninja
pkg-config
wayland-scanner
glslang
];
buildInputs = [
libglut
libX11
libXext
libGL
libGLU
mesa
wayland
wayland-protocols
vulkan-loader
libxkbcommon
libdecor
];
mesonFlags = [
"-Degl=${if stdenv.hostPlatform.isDarwin then "disabled" else "auto"}"
(lib.mesonEnable "libdrm" (stdenv.hostPlatform.isLinux))
(lib.mesonEnable "osmesa" false)
(lib.mesonEnable "wayland" (lib.meta.availableOn stdenv.hostPlatform wayland))
];
meta = with lib; {
inherit (mesa.meta) homepage platforms;
description = "Collection of demos and test programs for OpenGL and Mesa";
license = licenses.mit;
maintainers = with maintainers; [ andersk ];
};
}