nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 copyPkgconfigItems,
6 makePkgconfigItem,
7}:
8
9stdenv.mkDerivation rec {
10 pname = "stb";
11 version = "0-unstable-2023-01-29";
12
13 src = fetchFromGitHub {
14 owner = "nothings";
15 repo = "stb";
16 rev = "5736b15f7ea0ffb08dd38af21067c314d6a3aae9";
17 hash = "sha256-s2ASdlT3bBNrqvwfhhN6skjbmyEnUgvNOrvhgUSRj98=";
18 };
19
20 nativeBuildInputs = [ copyPkgconfigItems ];
21
22 pkgconfigItems = [
23 (makePkgconfigItem rec {
24 name = "stb";
25 version = "1";
26 cflags = [ "-I${variables.includedir}/stb" ];
27 variables = rec {
28 prefix = "${placeholder "out"}";
29 includedir = "${prefix}/include";
30 };
31 inherit (meta) description;
32 })
33 ];
34
35 dontBuild = true;
36
37 installPhase = ''
38 runHook preInstall
39 mkdir -p $out/include/stb
40 cp *.h $out/include/stb/
41 cp *.c $out/include/stb/
42 runHook postInstall
43 '';
44
45 meta = {
46 description = "Single-file public domain libraries for C/C++";
47 homepage = "https://github.com/nothings/stb";
48 license = with lib.licenses; [
49 mit
50 # OR
51 unlicense
52 ];
53 platforms = lib.platforms.all;
54 maintainers = [ ];
55 };
56}