Skip to content

Commit 62a3d78

Browse files
committed
chatgpt: init at 1.2025.014
1 parent 309e8a5 commit 62a3d78

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
lib,
3+
stdenvNoCC,
4+
darwin,
5+
fetchurl,
6+
_7zz,
7+
undmg,
8+
}:
9+
10+
let
11+
source = import ./source.nix;
12+
in
13+
stdenvNoCC.mkDerivation {
14+
pname = "chatgpt";
15+
inherit (source) version;
16+
17+
src = fetchurl source.src;
18+
19+
nativeBuildInputs = [
20+
undmg
21+
];
22+
23+
sourceRoot = ".";
24+
25+
installPhase = ''
26+
runHook preInstall
27+
28+
mkdir -p "$out/Applications"
29+
mkdir -p "$out/bin"
30+
cp -a ChatGPT.app "$out/Applications"
31+
ln -s "$out/Applications/ChatGPT.app/Contents/MacOS/ChatGPT" "$out/bin/ChatGPT"
32+
33+
runHook postInstall
34+
'';
35+
36+
passthru.updateScript = ./update.sh;
37+
38+
meta = {
39+
description = "Desktop application for ChatGPT";
40+
homepage = "https://openai.com/chatgpt/desktop/";
41+
changelog = "https://help.openai.com/en/articles/9703738-macos-app-release-notes";
42+
license = lib.licenses.unfree;
43+
maintainers = with lib.maintainers; [ wattmto ];
44+
platforms = lib.platforms.darwin;
45+
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
46+
mainProgram = "ChatGPT";
47+
};
48+
}

pkgs/by-name/ch/chatgpt/source.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
version = "1.2025.014";
3+
src = {
4+
url = "https://persistent.oaistatic.com/sidekick/public/ChatGPT_Desktop_public_1.2025.014_1737150122.dmg";
5+
hash = "sha256-NxCkrsPaptYNTZ+urkJqYeC4a0nGaEOFO/7SQL1Jmpc=";
6+
};
7+
}

pkgs/by-name/ch/chatgpt/update.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env nix-shell
2+
#!nix-shell -i bash -p curl libxml2
3+
4+
XML_URL="https://persistent.oaistatic.com/sidekick/public/sparkle_public_appcast.xml"
5+
6+
XML_DATA=$(curl -s $XML_URL)
7+
8+
LATEST_VERSION=$(echo "$XML_DATA" | xmllint --xpath '/rss/channel/item[1]/*[local-name()="shortVersionString"]/text()' -)
9+
DOWNLOAD_URL=$(echo "$XML_DATA" | xmllint --xpath 'string(//item[1]/enclosure/@url)' -)
10+
11+
HASH=$(nix-prefetch-url $DOWNLOAD_URL | xargs nix hash convert --hash-algo sha256)
12+
13+
cat > source.nix << _EOF_
14+
{
15+
version = "$LATEST_VERSION";
16+
src = fetchurl {
17+
url = "$DOWNLOAD_URL";
18+
sha256 = "$HASH";
19+
};
20+
}
21+
_EOF_

0 commit comments

Comments
 (0)