diff --git a/flake.lock b/flake.lock index fc3df88..79829b8 100644 --- a/flake.lock +++ b/flake.lock @@ -109,27 +109,6 @@ "type": "github" } }, - "codex-desktop-linux": { - "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1787079200, - "narHash": "sha256-BYo8mVEqRj6y8PzpFd3rX6TQTknB3Ynp/3ykMTm56D8=", - "owner": "ilysenko", - "repo": "codex-desktop-linux", - "rev": "1875dc2eaab6f9448617d18d0eda58902edf0f1a", - "type": "github" - }, - "original": { - "owner": "ilysenko", - "repo": "codex-desktop-linux", - "type": "github" - } - }, "crane": { "locked": { "lastModified": 1771796463, @@ -270,24 +249,6 @@ } }, "flake-utils_2": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { "locked": { "lastModified": 1644229661, "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", @@ -302,9 +263,9 @@ "type": "github" } }, - "flake-utils_4": { + "flake-utils_3": { "inputs": { - "systems": "systems_8" + "systems": "systems_7" }, "locked": { "lastModified": 1731533236, @@ -322,7 +283,7 @@ }, "foundry": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" ] @@ -474,7 +435,7 @@ "hyprwire": "hyprwire", "nixpkgs": "nixpkgs_5", "pre-commit-hooks": "pre-commit-hooks", - "systems": "systems_5", + "systems": "systems_4", "xdph": "xdph" }, "locked": { @@ -599,7 +560,7 @@ "rose-pine-hyprcursor", "nixpkgs" ], - "systems": "systems_6" + "systems": "systems_5" }, "locked": { "lastModified": 1709914708, @@ -1094,7 +1055,6 @@ "agent-skills": "agent-skills", "claude-code": "claude-code", "codex-cli": "codex-cli", - "codex-desktop-linux": "codex-desktop-linux", "ethui": "ethui", "foundry": "foundry", "hardware": "hardware", @@ -1110,7 +1070,7 @@ "rose-pine-hyprcursor": "rose-pine-hyprcursor", "sem": "sem", "spicetify-nix": "spicetify-nix", - "systems": "systems_10", + "systems": "systems_9", "zen-browser": "zen-browser" } }, @@ -1175,7 +1135,7 @@ "sem": { "inputs": { "flake-parts": "flake-parts_3", - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_3", "nixpkgs": "nixpkgs_8", "rust-overlay": "rust-overlay" }, @@ -1198,7 +1158,7 @@ "nixpkgs": [ "nixpkgs" ], - "systems": "systems_9" + "systems": "systems_8" }, "locked": { "lastModified": 1786855359, @@ -1229,21 +1189,6 @@ "type": "github" } }, - "systems_10": { - "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", - "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-linux", - "type": "github" - } - }, "systems_2": { "locked": { "lastModified": 1681028828, @@ -1276,16 +1221,16 @@ }, "systems_4": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "default-linux", "type": "github" } }, @@ -1306,16 +1251,16 @@ }, "systems_6": { "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default-linux", + "repo": "default", "type": "github" } }, @@ -1351,22 +1296,22 @@ }, "systems_9": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "default-linux", "type": "github" } }, "utils": { "inputs": { - "systems": "systems_4" + "systems": "systems_3" }, "locked": { "lastModified": 1731533236, @@ -1384,7 +1329,7 @@ }, "utils_2": { "inputs": { - "systems": "systems_7" + "systems": "systems_6" }, "locked": { "lastModified": 1710146030, diff --git a/flake.nix b/flake.nix index 25b5483..198c47c 100644 --- a/flake.nix +++ b/flake.nix @@ -58,10 +58,6 @@ url = "github:sadjow/codex-cli-nix/main"; inputs.nixpkgs.follows = "nixpkgs"; }; - codex-desktop-linux = { - url = "github:ilysenko/codex-desktop-linux"; - inputs.nixpkgs.follows = "nixpkgs"; - }; # Pinned to the tag, and pins its own nixpkgs for the same reason ethui does # — it is a verified Rust build. Bump deliberately, not via `flake update`. agent-of-empires.url = "git+https://git.naps.pt/yolo/agent-of-empires.git"; diff --git a/home/arrakis/default.nix b/home/arrakis/default.nix index e9caca6..3b2cb68 100644 --- a/home/arrakis/default.nix +++ b/home/arrakis/default.nix @@ -25,11 +25,6 @@ custom.hyprland.cursorSize = 32; custom.hyprland.gdkScale = 1; - # ChatGPT's XWayland window needs an explicit device scale as well. - xdg.configFile."codex-desktop/electron-flags.conf".text = '' - --force-device-scale-factor=1 - ''; - # Fingerprint unlock for hyprlock — arrakis is the only host with a reader # (fprintd is enabled system-side in hosts/arrakis). hyprlock talks to fprintd # over D-Bus directly (not via PAM), running in parallel with password input: diff --git a/home/common/programs/ai-gui.nix b/home/common/programs/ai-gui.nix index 848a9ad..6958836 100644 --- a/home/common/programs/ai-gui.nix +++ b/home/common/programs/ai-gui.nix @@ -1,7 +1,6 @@ { config, pkgs, - inputs, lib, ... }: @@ -9,7 +8,7 @@ let claude-desktop = pkgs.callPackage ../../../pkgs/claude-desktop/package.nix { inherit (config.custom.aiApps) deviceScaleFactor; }; - codex-cli = inputs.codex-cli.packages.${pkgs.stdenv.hostPlatform.system}.default; + chatgpt = pkgs.callPackage ../../../pkgs/chatgpt/package.nix { }; t3-code = pkgs.callPackage ../../../pkgs/t3-code/package.nix { inherit (config.custom.aiApps) deviceScaleFactor; }; @@ -19,16 +18,10 @@ let }; in { - imports = [ inputs.codex-desktop-linux.homeManagerModules.default ]; - home.packages = lib.optionals pkgs.stdenv.hostPlatform.isx86_64 [ claude-desktop + chatgpt t3-code openwhispr ]; - - programs.codexDesktopLinux = { - enable = true; - cliPackage = codex-cli; - }; } diff --git a/pkgs/chatgpt/package.nix b/pkgs/chatgpt/package.nix new file mode 100644 index 0000000..719f86e --- /dev/null +++ b/pkgs/chatgpt/package.nix @@ -0,0 +1,145 @@ +{ + lib, + stdenv, + fetchurl, + autoPatchelfHook, + asar, + glibc, + dpkg, + makeWrapper, + wrapGAppsHook3, + alsa-lib, + at-spi2-atk, + at-spi2-core, + atk, + cairo, + cups, + dbus, + expat, + gdk-pixbuf, + glib, + gtk3, + libGL, + libdrm, + libgbm, + libnotify, + libsecret, + libusb1, + libxkbcommon, + nspr, + nss, + openssl, + pango, + systemd, + tpm2-tss, + wayland, + libX11, + libxcb, + libxcomposite, + libxdamage, + libxext, + libxfixes, + libxrandr, + xdg-utils, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "chatgpt"; + version = "26.915.31945"; + + src = fetchurl { + url = "https://persistent.oaistatic.com/codex-app-prod/linux/deb/pool/main/c/chatgpt/chatgpt_${finalAttrs.version}_amd64.deb"; + hash = "sha256-0nqcApGc/khNzF80WEueqf0NemXGncyHK1vc+g77WYM="; + }; + + nativeBuildInputs = [ + autoPatchelfHook + asar + dpkg + makeWrapper + wrapGAppsHook3 + ]; + buildInputs = [ + alsa-lib + at-spi2-atk + at-spi2-core + atk + cairo + cups + dbus + expat + gdk-pixbuf + glib + gtk3 + libGL + libdrm + libgbm + libnotify + libsecret + libusb1 + libxkbcommon + nspr + nss + openssl + pango + stdenv.cc.cc.lib + systemd + tpm2-tss + wayland + libX11 + libxcb + libxcomposite + libxdamage + libxext + libxfixes + libxrandr + ]; + runtimeDependencies = map lib.getLib [ + libGL + libsecret + libnotify + systemd + wayland + ]; + + unpackCmd = "dpkg-deb -x $curSrc ."; + sourceRoot = "."; + postPatch = '' + asar extract usr/lib/chatgpt/resources/app.asar app + # Nix relocates the ELF interpreter beyond detect-libc's read buffer. + # Avoid its crashing process.report fallback by providing the real ldd path. + substituteInPlace app/node_modules/@parcel/watcher/node_modules/detect-libc/lib/filesystem.js \ + --replace-fail "'/usr/bin/ldd'" "'${lib.getBin glibc}/bin/ldd'" + asar pack app usr/lib/chatgpt/resources/app.asar --unpack-dir node_modules + rm -r app + ''; + + dontConfigure = true; + dontBuild = true; + dontWrapGApps = true; + + installPhase = '' + runHook preInstall + mkdir -p $out/lib $out/share + cp -r usr/lib/chatgpt $out/lib/chatgpt + # Use GTK; the bundled Qt shims and musl variants are not used on this host. + rm $out/lib/chatgpt/libqt{5,6}_shim.so + find $out/lib/chatgpt/resources -name '*musl*' -exec rm -rf {} + + cp -r usr/share/applications usr/share/pixmaps usr/share/metainfo $out/share/ + makeWrapper $out/lib/chatgpt/ChatGPT $out/bin/chatgpt \ + "''${gappsWrapperArgs[@]}" \ + --prefix PATH : ${lib.makeBinPath [ xdg-utils ]} \ + --add-flags "--ozone-platform=wayland" + substituteInPlace $out/share/applications/chatgpt.desktop \ + --replace-fail "Exec=chatgpt %U" "Exec=$out/bin/chatgpt %U" + runHook postInstall + ''; + + meta = { + description = "Official ChatGPT desktop app with Codex"; + homepage = "https://learn.chatgpt.com/docs/linux/linux-app"; + license = lib.licenses.unfree; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + platforms = [ "x86_64-linux" ]; + mainProgram = "chatgpt"; + }; +})