Skip to content

Commit dcf1a39

Browse files
authored
mlx42: format and clean up (#343492)
2 parents 84bd184 + 4140c52 commit dcf1a39

File tree

1 file changed

+32
-20
lines changed

1 file changed

+32
-20
lines changed

pkgs/by-name/ml/mlx42/package.nix

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
{ lib
2-
, stdenv
3-
, fetchFromGitHub
4-
, cmake
5-
, glfw
6-
, darwin
7-
, enableShared ? !stdenv.hostPlatform.isStatic
8-
, enableDebug ? false
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
cmake,
6+
glfw,
7+
darwin,
8+
enableShared ? !stdenv.hostPlatform.isStatic,
9+
enableDebug ? false,
910
}:
1011

1112
stdenv.mkDerivation (finalAttrs: {
@@ -15,32 +16,43 @@ stdenv.mkDerivation (finalAttrs: {
1516
src = fetchFromGitHub {
1617
owner = "codam-coding-college";
1718
repo = "MLX42";
18-
rev = "v${finalAttrs.version}";
19+
rev = "refs/tags/v${finalAttrs.version}";
1920
hash = "sha256-c4LoTePHhQeZTx33V1K3ZyXmT7vjB6NdkGVAiSuJKfI=";
2021
};
2122

22-
postPatch = ''
23-
patchShebangs ./tools
24-
''
25-
+ lib.optionalString enableShared ''
26-
substituteInPlace CMakeLists.txt \
27-
--replace "mlx42 STATIC" "mlx42 SHARED"
28-
'';
23+
postPatch =
24+
''
25+
patchShebangs --build ./tools
26+
''
27+
+ lib.optionalString enableShared ''
28+
substituteInPlace CMakeLists.txt \
29+
--replace-fail "mlx42 STATIC" "mlx42 SHARED"
30+
'';
31+
32+
strictDeps = true;
2933

3034
nativeBuildInputs = [ cmake ];
3135

32-
buildInputs = [ glfw ]
33-
++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [ OpenGL Cocoa IOKit ]);
36+
buildInputs =
37+
[ glfw ]
38+
++ lib.optionals stdenv.hostPlatform.isDarwin (
39+
with darwin.apple_sdk.frameworks;
40+
[
41+
OpenGL
42+
Cocoa
43+
IOKit
44+
]
45+
);
3446

35-
cmakeFlags = [ "-DDEBUG=${toString enableDebug}" ];
47+
cmakeFlags = [ (lib.cmakeBool "DEBUG" enableDebug) ];
3648

3749
postInstall = ''
3850
mkdir -p $out/lib/pkgconfig
3951
substituteAll ${./mlx42.pc} $out/lib/pkgconfig/mlx42.pc
4052
'';
4153

4254
meta = {
43-
changelog = "https://github.com/codam-coding-college/MLX42/releases/tag/${finalAttrs.src.rev}";
55+
changelog = "https://github.com/codam-coding-college/MLX42/releases/tag/v${finalAttrs.version}";
4456
description = "Simple cross-platform graphics library that uses GLFW and OpenGL";
4557
homepage = "https://github.com/codam-coding-college/MLX42";
4658
license = lib.licenses.gpl2Only;

0 commit comments

Comments
 (0)