mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 02:03:01 +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" ```
62 lines
1.3 KiB
Nix
62 lines
1.3 KiB
Nix
{ lib
|
|
, stdenv
|
|
, cmocka
|
|
, darwin
|
|
, fetchFromGitHub
|
|
, gtk3
|
|
, meson
|
|
, ninja
|
|
, pkg-config
|
|
, unstableGitUpdater
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "libui-ng";
|
|
version = "4.1-unstable-2024-05-19";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "libui-ng";
|
|
repo = "libui-ng";
|
|
rev = "49b04c4cf8ae4d3e38e389f446ef75170eb62762";
|
|
hash = "sha256-W9LnUBUKwx1x3+BEeUanisBGR2Q4dnbcMM5k8mCondM=";
|
|
};
|
|
|
|
postPatch = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) ''
|
|
substituteInPlace meson.build --replace "'-arch', 'arm64'" ""
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
cmocka
|
|
meson
|
|
ninja
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs =
|
|
if stdenv.hostPlatform.isDarwin then [
|
|
darwin.libobjc
|
|
darwin.apple_sdk_11_0.Libsystem
|
|
darwin.apple_sdk_11_0.frameworks.Cocoa
|
|
darwin.apple_sdk_11_0.frameworks.AppKit
|
|
darwin.apple_sdk_11_0.frameworks.CoreFoundation
|
|
] else [
|
|
gtk3
|
|
];
|
|
|
|
mesonFlags = [
|
|
(lib.mesonBool "examples" (!stdenv.hostPlatform.isDarwin))
|
|
];
|
|
|
|
passthru.updateScript = unstableGitUpdater {
|
|
tagPrefix = "alpha";
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Portable GUI library for C";
|
|
homepage = "https://github.com/libui-ng/libui-ng";
|
|
license = licenses.mit;
|
|
maintainers = [ ];
|
|
platforms = platforms.all;
|
|
};
|
|
}
|