caffeine: Build from source

This commit is contained in:
Maxime Brunet
2026-04-19 14:54:34 -03:00
parent 788c08f343
commit ff3a83476c
+34 -11
View File
@@ -1,28 +1,52 @@
{
lib,
stdenvNoCC,
fetchurl,
undmg,
stdenv,
fetchFromGitHub,
apple-sdk,
darwin,
xcbuildHook,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
stdenv.mkDerivation (finalAttrs: {
pname = "caffeine";
version = "1.1.4";
src = fetchurl {
url = "https://github.com/IntelliScape/caffeine/releases/download/${finalAttrs.version}/Caffeine.dmg";
hash = "sha256-GtNMMpmgyGaHPE/rQyw+ERhjda229DxfSBrp1G0G1yM=";
src = fetchFromGitHub {
owner = "IntelliScape";
repo = "caffeine";
tag = finalAttrs.version;
hash = "sha256-AmBPY5ZVWBq2ZesNvvJ/Do5XgPjb5R1ESNJm7tx0M6k=";
};
sourceRoot = ".";
# xcbuild routes image.png resources through CopyPNGFile, which requires the
# Apple-only copypng tool that is unavailable in the nixpkgs toolchain.
# Treat these PNGs as generic files so xcbuild copies them directly.
postPatch = ''
substituteInPlace Caffeine.xcodeproj/project.pbxproj \
--replace-fail \
"lastKnownFileType = image.png;" \
"lastKnownFileType = file;"
'';
nativeBuildInputs = [ undmg ];
nativeBuildInputs = [
xcbuildHook
darwin.autoSignDarwinBinariesHook
];
buildInputs = [
apple-sdk
];
xcbuildFlags = [
"-target Caffeine"
"-configuration Release"
];
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r *.app $out/Applications
cp -r Products/Release/Caffeine.app $out/Applications
runHook postInstall
'';
@@ -36,6 +60,5 @@ stdenvNoCC.mkDerivation (finalAttrs: {
"x86_64-darwin"
"aarch64-darwin"
];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})