chatgpt: init at 1.2025.014
This commit is contained in:
parent
309e8a5e50
commit
62a3d78cb7
48
pkgs/by-name/ch/chatgpt/package.nix
Normal file
48
pkgs/by-name/ch/chatgpt/package.nix
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
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
pkgs/by-name/ch/chatgpt/source.nix
Normal file
7
pkgs/by-name/ch/chatgpt/source.nix
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
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
pkgs/by-name/ch/chatgpt/update.sh
Executable file
21
pkgs/by-name/ch/chatgpt/update.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/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_
|
Loading…
x
Reference in New Issue
Block a user