hamrs: add darwin support

Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
This commit is contained in:
Ethan Carter Edwards 2025-03-16 17:51:36 -04:00
parent 057be5b68e
commit ce11e7f719
No known key found for this signature in database
GPG key ID: D83DC5377393C7E6
2 changed files with 47 additions and 1 deletions

View file

@ -0,0 +1,41 @@
{
lib,
stdenvNoCC,
pname,
version,
meta,
fetchurl,
_7zz,
undmg,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
inherit pname version;
src =
if stdenvNoCC.hostPlatform.isAarch64 then
(fetchurl {
url = "https://hamrs-releases.s3.us-east-2.amazonaws.com/${finalAttrs.version}/HAMRS-${finalAttrs.version}.dmg";
hash = "sha256-IQ7r2OLwJW4auiNDddzZ99jXxrtPw3uYoGIUEHU1gtc=";
})
else
(fetchurl {
url = "https://hamrs-releases.s3.us-east-2.amazonaws.com/${finalAttrs.version}/HAMRS-${finalAttrs.version}-intel.dmg";
hash = "sha256-bgWeIARE3gO5FA9MqidfXo1Wdn5wDUa/RNzZBxSKloM=";
});
nativeBuildInputs = if stdenvNoCC.hostPlatform.isAarch64 then [ _7zz ] else [ undmg ];
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r *.app $out/Applications
runHook postInstall
'';
inherit meta;
})

View file

@ -20,9 +20,14 @@ let
"aarch64-linux"
"x86_64-linux"
"i686-linux"
"aarch64-darwin"
"x86_64-darwin"
];
mainProgram = "hamrs";
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
in
callPackage ./linux.nix { inherit pname version meta; }
if stdenvNoCC.hostPlatform.isDarwin then
callPackage ./darwin.nix { inherit pname version meta; }
else
callPackage ./linux.nix { inherit pname version meta; }