darwin.PowerManagement: convert to Meson and use mkAppleDerivation

This commit is contained in:
Randy Eckenrode 2024-09-22 15:58:58 -04:00
parent 822a865209
commit 6fca3b4a70
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9
5 changed files with 56 additions and 11 deletions

View File

@ -1,10 +0,0 @@
{ appleDerivation, xcbuildHook, IOKit }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook ];
buildInputs = [ IOKit ];
xcbuildFlags = [ "-target" "caffeinate" ];
installPhase = ''
install -D Products/Deployment/caffeinate $out/bin/caffeinate
'';
}

View File

@ -0,0 +1,23 @@
# Build settings based on the upstream Xcode project.
# See: https://github.com/apple-oss-distributions/PowerManagement/blob/main/PowerManagement.xcodeproj/project.pbxproj
# Project settings
project('PowerManagement', 'c', version : '@version@')
# Dependencies
cc = meson.get_compiler('c')
# Binaries
caffeinate = executable(
'caffeinate',
dependencies : dependency('appleframeworks', modules : ['CoreFoundation', 'IOKit']),
install : true,
sources : [
'caffeinate/caffeinate.c',
],
)
install_man(
'caffeinate/caffeinate.8',
)

View File

@ -0,0 +1,28 @@
{
lib,
apple-sdk,
mkAppleDerivation,
stdenvNoCC,
}:
let
iokitUser = apple-sdk.sourceRelease "IOKitUser";
privateHeaders = stdenvNoCC.mkDerivation {
name = "file_cmds-deps-private-headers";
buildCommand = ''
install -D -t "$out/include/IOKit/pwr_mgt" \
'${iokitUser}/pwr_mgt.subproj/IOPMLibPrivate.h'
'';
};
in
mkAppleDerivation {
releaseName = "PowerManagement";
xcodeHash = "sha256-Zx3DwooXyY81jve5tSxmT13NKAsnsn6D2PRelh65Q7Q=";
env.NIX_CFLAGS_COMPILE = "-I${privateHeaders}/include";
meta.description = "Contains the Darwin caffeinate command";
}

View File

@ -317,7 +317,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
system_cmds = applePackage "system_cmds" "macos-14.3" "sha256-qFp9nkzsq9uQ7zoyfvO+3gvDlc7kaPvn6luvmO/Io30=" {};
text_cmds = applePackage "text_cmds" "osx-10.11.6" "sha256-KSebU7ZyUsPeqn51nzuGNaNxs9pvmlIQQdkWXIVzDxw=" {};
top = applePackage "top" "osx-10.11.6" "sha256-jbz64ODogtpNyLpXGSZj1jCBdFPVXcVcBkL1vc7g5qQ=" {};
PowerManagement = applePackage "PowerManagement" "osx-10.11.6" "sha256-bYGtYnBOcE5W03AZzfVTJXPZ6GgryGAMt/LgLPxFkVk=" {};
PowerManagement = callPackage ./PowerManagement/package.nix { };
# `configdHeaders` cant use an override because `pkgs.darwin.configd` on aarch64-darwin will
# be replaced by SystemConfiguration.framework from the macOS SDK.

View File

@ -11,6 +11,10 @@
"hash": "sha256-p3CYITMljHVuwijeYnUbKaIWp/xPC4/hg1G1lO6PlFU=",
"version": "66108"
},
"PowerManagement": {
"hash": "sha256-bYGtYnBOcE5W03AZzfVTJXPZ6GgryGAMt/LgLPxFkVk=",
"version": "572.50.1"
},
"adv_cmds": {
"hash": "sha256-Ztp8ALWcviEpthoiY8ttWzGI8OcsLzsULjlqe8GIzw8=",
"version": "163"