diff --git a/pkgs/by-name/ha/hamrs/darwin.nix b/pkgs/by-name/ha/hamrs/darwin.nix new file mode 100644 index 000000000000..fd8f413ba6d8 --- /dev/null +++ b/pkgs/by-name/ha/hamrs/darwin.nix @@ -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; +}) diff --git a/pkgs/by-name/ha/hamrs/linux.nix b/pkgs/by-name/ha/hamrs/linux.nix new file mode 100644 index 000000000000..b163d407f39b --- /dev/null +++ b/pkgs/by-name/ha/hamrs/linux.nix @@ -0,0 +1,48 @@ +{ + lib, + stdenvNoCC, + appimageTools, + fetchurl, + pname, + version, + meta, +}: + +let + suffix = + { + aarch64-linux = "linux-armv7l"; + x86_64-linux = "linux-x86_64"; + i686-linux = "linux-i386"; + } + .${stdenvNoCC.hostPlatform.system} + or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}"); +in +appimageTools.wrapType2 rec { + inherit pname version; + + src = fetchurl { + url = "https://hamrs-releases.s3.us-east-2.amazonaws.com/${version}/hamrs-${version}-${suffix}.AppImage"; + hash = + { + aarch64-linux = "sha256-nBW8q7LVWQz93LkTc+c36H+2ymLLwLKfxePUwEm3D2E="; + x86_64-linux = "sha256-tplp7TADvbxkk5qBb4c4zm4mrzrVtW/WVUjiolBBJHc="; + i686-linux = "sha256-PllxLMBsPCedKU7OUN0nqi4qtQ57l2Z+huLfkfaBfT4="; + } + .${stdenvNoCC.hostPlatform.system} + or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}"); + }; + + extraInstallCommands = + let + contents = appimageTools.extract { inherit pname version src; }; + in + '' + install -m 444 -D ${contents}/${pname}.desktop -t $out/share/applications + substituteInPlace $out/share/applications/${pname}.desktop \ + --replace-fail 'Exec=AppRun' 'Exec=${pname}' + cp -r ${contents}/usr/share/icons $out/share + ''; + + inherit meta; +} diff --git a/pkgs/by-name/ha/hamrs/package.nix b/pkgs/by-name/ha/hamrs/package.nix index 45937658d4bb..8a8bbf4c830b 100644 --- a/pkgs/by-name/ha/hamrs/package.nix +++ b/pkgs/by-name/ha/hamrs/package.nix @@ -1,56 +1,33 @@ { - appimageTools, lib, - fetchurl, - stdenv, + stdenvNoCC, + callPackage, }: let - suffix = - { - aarch64-linux = "linux-armv7l"; - x86_64-linux = "linux-x86_64"; - i686-linux = "linux-i386"; - } - .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); -in -appimageTools.wrapType2 rec { pname = "hamrs"; version = "1.0.7"; - src = fetchurl { - url = "https://hamrs-releases.s3.us-east-2.amazonaws.com/${version}/hamrs-${version}-${suffix}.AppImage"; - hash = - { - aarch64-linux = "sha256-nBW8q7LVWQz93LkTc+c36H+2ymLLwLKfxePUwEm3D2E="; - x86_64-linux = "sha256-tplp7TADvbxkk5qBb4c4zm4mrzrVtW/WVUjiolBBJHc="; - i686-linux = "sha256-PllxLMBsPCedKU7OUN0nqi4qtQ57l2Z+huLfkfaBfT4="; - } - .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); - }; - - extraInstallCommands = - let - contents = appimageTools.extract { inherit pname version src; }; - in - '' - install -m 444 -D ${contents}/${pname}.desktop -t $out/share/applications - substituteInPlace $out/share/applications/${pname}.desktop \ - --replace-fail 'Exec=AppRun' 'Exec=${pname}' - cp -r ${contents}/usr/share/icons $out/share - ''; - - meta = with lib; { - description = "A simple, portable logger tailored for activities like Parks on the Air, Field Day, and more."; + meta = { + description = "Simple, portable logger tailored for activities like Parks on the Air, Field Day, and more."; homepage = "https://hamrs.app/"; - license = licenses.unfree; - maintainers = [ maintainers.jhollowe ]; + license = lib.licenses.unfree; + maintainers = with lib.maintainers; [ + ethancedwards8 + jhollowe + ]; platforms = [ "aarch64-linux" "x86_64-linux" "i686-linux" + "aarch64-darwin" + "x86_64-darwin" ]; mainProgram = "hamrs"; - sourceProvenance = [ sourceTypes.binaryNativeCode ]; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; }; -} +in +if stdenvNoCC.hostPlatform.isDarwin then + callPackage ./darwin.nix { inherit pname version meta; } +else + callPackage ./linux.nix { inherit pname version meta; }