Unverified Commit 6c181f0b authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

chatgpt: init at 1.2025.014 (#377423)

parents cfe66f88 62a3d78c
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  darwin,
  fetchurl,
  _7zz,
  undmg,
}:

let
  source = import ./source.nix;
in
stdenvNoCC.mkDerivation {
  pname = "chatgpt";
  inherit (source) version;

  src = fetchurl source.src;

  nativeBuildInputs = [
    undmg
  ];

  sourceRoot = ".";

  installPhase = ''
    runHook preInstall

    mkdir -p "$out/Applications"
    mkdir -p "$out/bin"
    cp -a ChatGPT.app "$out/Applications"
    ln -s "$out/Applications/ChatGPT.app/Contents/MacOS/ChatGPT" "$out/bin/ChatGPT"

    runHook postInstall
  '';

  passthru.updateScript = ./update.sh;

  meta = {
    description = "Desktop application for ChatGPT";
    homepage = "https://openai.com/chatgpt/desktop/";
    changelog = "https://help.openai.com/en/articles/9703738-macos-app-release-notes";
    license = lib.licenses.unfree;
    maintainers = with lib.maintainers; [ wattmto ];
    platforms = lib.platforms.darwin;
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    mainProgram = "ChatGPT";
  };
}
+7 −0
Original line number Diff line number Diff line
{
  version = "1.2025.014";
  src = {
    url = "https://persistent.oaistatic.com/sidekick/public/ChatGPT_Desktop_public_1.2025.014_1737150122.dmg";
    hash = "sha256-NxCkrsPaptYNTZ+urkJqYeC4a0nGaEOFO/7SQL1Jmpc=";
  };
}
+21 −0
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl libxml2

XML_URL="https://persistent.oaistatic.com/sidekick/public/sparkle_public_appcast.xml"

XML_DATA=$(curl -s $XML_URL)

LATEST_VERSION=$(echo "$XML_DATA" | xmllint --xpath '/rss/channel/item[1]/*[local-name()="shortVersionString"]/text()' -)
DOWNLOAD_URL=$(echo "$XML_DATA" | xmllint --xpath 'string(//item[1]/enclosure/@url)' -)

HASH=$(nix-prefetch-url $DOWNLOAD_URL | xargs nix hash convert --hash-algo sha256)

cat > source.nix << _EOF_
{
  version = "$LATEST_VERSION";
  src = fetchurl {
    url = "$DOWNLOAD_URL";
    sha256 = "$HASH";
  };
}
_EOF_