File tree Expand file tree Collapse file tree 3 files changed +76
-0
lines changed Expand file tree Collapse file tree 3 files changed +76
-0
lines changed Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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_
You can’t perform that action at this time.
0 commit comments