|
464 | 464 | fi |
465 | 465 | ''; |
466 | 466 |
|
| 467 | + linuxFeaturesConfigFile = config: |
| 468 | + pkgs.writeText "codex-linux-features.json" (builtins.toJSON config); |
| 469 | + |
467 | 470 | linuxFeaturesConfig = linuxFeatureIds: |
468 | | - pkgs.writeText "codex-linux-features.json" (builtins.toJSON { |
| 471 | + linuxFeaturesConfigFile { |
469 | 472 | enabled = linuxFeatureIds; |
470 | | - }); |
| 473 | + }; |
| 474 | + |
| 475 | + normalizeLinuxFeaturesConfig = config: |
| 476 | + let |
| 477 | + enabled = nixLinuxFeatures.normalize (config.enabled or [ ]); |
| 478 | + in |
| 479 | + config // { |
| 480 | + inherit enabled; |
| 481 | + }; |
| 482 | + |
| 483 | + watchdogLinuxFeaturesConfig = normalizeLinuxFeaturesConfig ( |
| 484 | + builtins.fromJSON (builtins.readFile ./scripts/ci/watchdog-linux-features.json) |
| 485 | + ); |
471 | 486 |
|
472 | 487 | enabledFeatureIds = { enableComputerUseUi ? false, linuxFeatureIds ? [ ] }: |
473 | 488 | pkgs.lib.optionals enableComputerUseUi [ "computer-use-ui" ] |
|
479 | 494 | in |
480 | 495 | if featureIds == [ ] then "" else "-${pkgs.lib.concatStringsSep "-" featureIds}"; |
481 | 496 |
|
482 | | - mkCodexDesktopPayload = { enableComputerUseUi ? false, linuxFeatureIds ? [ ] }: |
| 497 | + mkCodexDesktopPayload = { enableComputerUseUi ? false, linuxFeatureIds ? [ ], linuxFeaturesConfigOverride ? null }: |
| 498 | + let |
| 499 | + effectiveLinuxFeaturesConfig = |
| 500 | + if linuxFeaturesConfigOverride == null then |
| 501 | + normalizeLinuxFeaturesConfig { enabled = linuxFeatureIds; } |
| 502 | + else |
| 503 | + normalizeLinuxFeaturesConfig linuxFeaturesConfigOverride; |
| 504 | + effectiveLinuxFeatureIds = effectiveLinuxFeaturesConfig.enabled; |
| 505 | + in |
483 | 506 | pkgs.stdenv.mkDerivation { |
484 | | - pname = "codex-desktop${packageSuffix { inherit enableComputerUseUi linuxFeatureIds; }}-payload"; |
| 507 | + pname = "codex-desktop${packageSuffix { inherit enableComputerUseUi; linuxFeatureIds = effectiveLinuxFeatureIds; }}-payload"; |
485 | 508 | version = codexVersion; |
486 | 509 | src = sourceRoot; |
487 | 510 | __structuredAttrs = true; |
|
528 | 551 | export CXXFLAGS="''${CXXFLAGS:-} -ffile-prefix-map=$TMPDIR=/build -fdebug-prefix-map=$TMPDIR=/build -fmacro-prefix-map=$TMPDIR=/build" |
529 | 552 | export RUSTFLAGS="''${RUSTFLAGS:-} --remap-path-prefix=$TMPDIR=/build -C link-arg=-Wl,--build-id=none" |
530 | 553 | export CODEX_MANAGED_NODE_SOURCE="${pkgs.nodejs}" |
531 | | - export CODEX_LINUX_FEATURES_CONFIG="${linuxFeaturesConfig linuxFeatureIds}" |
| 554 | + export CODEX_LINUX_FEATURES_CONFIG="${linuxFeaturesConfigFile effectiveLinuxFeaturesConfig}" |
532 | 555 | export CODEX_ELECTRON_ZIP_SOURCE="${electronZip}" |
533 | 556 | export CODEX_NATIVE_MODULES_SOURCE="${codexNativeModules}" |
534 | 557 | ${pkgs.lib.optionalString (browserUseNodeRepl != null) '' |
|
538 | 561 | export CODEX_LINUX_COMPUTER_USE_COSMIC_SOURCE="${codexComputerUseBinaries}/bin/codex-computer-use-cosmic" |
539 | 562 | export CODEX_CHROME_EXTENSION_HOST_SOURCE="${codexComputerUseBinaries}/bin/codex-chrome-extension-host" |
540 | 563 | export CODEX_NOTIFICATION_ACTIONS_SOURCE="${codexNotificationActionsBinary}/bin/codex-notification-actions-linux" |
541 | | - ${pkgs.lib.optionalString (builtins.elem "mcp-helper-reaper" linuxFeatureIds) '' |
| 564 | + ${pkgs.lib.optionalString (builtins.elem "mcp-helper-reaper" effectiveLinuxFeatureIds) '' |
542 | 565 | export CODEX_MCP_HELPER_REAPER_SOURCE="${codexMcpHelperReaper}/bin/codex-mcp-helper-reaper" |
543 | 566 | ''} |
544 | | - ${pkgs.lib.optionalString (builtins.elem "global-dictation" linuxFeatureIds) '' |
| 567 | + ${pkgs.lib.optionalString (builtins.elem "global-dictation" effectiveLinuxFeatureIds) '' |
545 | 568 | export CODEX_GLOBAL_DICTATION_LINUX_SOURCE="${codexGlobalDictationBinary}/bin/codex-global-dictation-linux" |
546 | 569 | ''} |
547 | 570 | mkdir -p "$HOME" "$npm_config_cache" "$CARGO_HOME" |
|
571 | 594 | ''; |
572 | 595 | }; |
573 | 596 |
|
574 | | - buildCodexDesktop = { enableComputerUseUi ? false, linuxFeatureIds ? [ ] }: |
| 597 | + buildCodexDesktop = { enableComputerUseUi ? false, linuxFeatureIds ? [ ], linuxFeaturesConfigOverride ? null }: |
575 | 598 | let |
576 | | - normalizedLinuxFeatureIds = nixLinuxFeatures.normalize linuxFeatureIds; |
| 599 | + effectiveLinuxFeaturesConfig = |
| 600 | + if linuxFeaturesConfigOverride == null then |
| 601 | + normalizeLinuxFeaturesConfig { enabled = linuxFeatureIds; } |
| 602 | + else |
| 603 | + normalizeLinuxFeaturesConfig linuxFeaturesConfigOverride; |
| 604 | + normalizedLinuxFeatureIds = effectiveLinuxFeaturesConfig.enabled; |
577 | 605 | featureArgs = { |
578 | 606 | inherit enableComputerUseUi; |
579 | 607 | linuxFeatureIds = normalizedLinuxFeatureIds; |
580 | 608 | }; |
581 | 609 | payload = mkCodexDesktopPayload { |
582 | 610 | inherit enableComputerUseUi; |
583 | 611 | linuxFeatureIds = normalizedLinuxFeatureIds; |
| 612 | + linuxFeaturesConfigOverride = effectiveLinuxFeaturesConfig; |
584 | 613 | }; |
585 | 614 | payloadLauncherPath = launcherPath + pkgs.lib.optionalString |
586 | 615 | (builtins.elem "global-dictation" normalizedLinuxFeatureIds) |
|
696 | 725 | linuxFeatureIds = [ "remote-mobile-control" ]; |
697 | 726 | }; |
698 | 727 |
|
699 | | - codexDesktopNixFeatureCheck = codexDesktop.override { |
700 | | - linuxFeatureIds = [ |
701 | | - "appshots" |
702 | | - "frameless-titlebar" |
703 | | - "global-dictation" |
704 | | - "mcp-helper-reaper" |
705 | | - "node-repl-reaper" |
706 | | - "open-target-discovery" |
707 | | - "persistent-status-panel" |
708 | | - ]; |
| 728 | + codexDesktopWatchdogFeatureCheck = codexDesktop.override { |
| 729 | + linuxFeaturesConfigOverride = watchdogLinuxFeaturesConfig; |
709 | 730 | }; |
710 | 731 |
|
711 | 732 | installer = pkgs.writeShellApplication { |
|
769 | 790 | nix-linux-features-evaluation = import ./nix/linux-features-test.nix { |
770 | 791 | inherit pkgs self system; |
771 | 792 | }; |
772 | | - nix-linux-features-multi-feature = codexDesktopNixFeatureCheck; |
| 793 | + watchdog-linux-features = codexDesktopWatchdogFeatureCheck; |
| 794 | + nix-linux-features-multi-feature = codexDesktopWatchdogFeatureCheck; |
773 | 795 | }; |
774 | 796 |
|
775 | 797 | apps.default = { |
|
0 commit comments