Skip to content

Conversation

@connerohnesorge
Copy link

@connerohnesorge connerohnesorge commented Apr 18, 2025

This pull request updates the flake.nix file to improve its structure and maintainability. The most important changes include reformatting the outputs attribute for better readability and updating the codex-cli package definition to use a local path and a new hash for npmDepsHash.

Structural improvements:

  • Reformatted the outputs attribute to use a block-style layout, making it more readable and consistent with common Nix practices.

Package definition updates:

  • Updated the codex-cli package definition to use a local path (./codex-cli) for the src attribute instead of a relative reference (self + "/codex-cli").
  • Changed the npmDepsHash for codex-cli to a new value (sha256-UkvkaM7tvVlio0st8UA45x8wQ+q423BTzshsmdmmO2o=), reflecting updated dependencies.

Autonomous Update for the future:

  • Created a github action step and bash script for updating the npmHash in the flake.nix if the package-lock.json changes in ./codex-cli

@github-actions
Copy link

github-actions bot commented Apr 18, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


1 out of 2 committers have signed the CLA.
✅ (conneroisu)[https://github.com/conneroisu]
@actions-user
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@connerohnesorge
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 18, 2025
@tibo-openai
Copy link
Collaborator

Thanks! One CODEX.md, why would we want to add it to .gitignore? It should be pretty universal, so what is the thinking here?

@connerohnesorge
Copy link
Author

Ope. thought the idea was to add more specific context to a goal in CODEX.md. I'll remove it from gitignore

@tibo-openai
Copy link
Collaborator

This change is based on the package-lock.json, however we are using pnpm since #287. Could you update the logic to reflect?

@connerohnesorge
Copy link
Author

Yes I will update the logic to reflect. Thanks for switching to pnpm I like it alot more!

Comment on lines 74 to 79
update-nix-hash:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write # Needed for push access
pull-requests: write # Needed for PR creation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just flagging this for awareness, this job introduces write access from CI for the first time (excluding the CLA Assistant, which already operates with elevated perms via pull_request_target).

It’s scoped well (only runs on push to main) so it won’t run on PRs or forks. That said, it does slightly shift the trust boundary, merging into main will now trigger a job that can push branches and open PRs back to the repo.

No action needed here, but it might be worth making sure folks reviewing automation changes are aware of that shift. If main isn’t already protected, enabling “require PRs before merging” and disallowing force-pushes/deletion would be good hardening steps for this kind of setup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this job is the only one in ci.yml with write permissions, it might be worth considering moving it to a separate workflow file (e.g. update-nix-hash.yml). That could make it easier to see at a glance which workflows mutate the repo and which are strictly read-only CI.

Also worth noting, the script update-nix-hash.sh will be run with elevated permissions and therefore also needs special attention during review to ensure it is not going to smuggle a secret, accidentally commit something, and that it’s not vulnerable to input injection (e.g. using PR metadata like branch names in shell commands without quoting).

@connerohnesorge
Copy link
Author

I updated the flake and hash updater to use pnpm, let me know if the github action step to update the flake hash should be it's own action.

@tibo-openai tibo-openai changed the title Add direnv and CODEX.md to gitignore and update flake deps hash feat: add direnv and CODEX.md to gitignore and update flake deps hash Apr 22, 2025
@connerohnesorge
Copy link
Author

I updated the flake to use pnpm. Please let me know if you want any other changes

@connerohnesorge connerohnesorge changed the title feat: add direnv and CODEX.md to gitignore and update flake deps hash feat: add direnv gitignore, migrate flake to use pnpm, and create automatic hash update script (added to github action) Apr 24, 2025
@connerohnesorge
Copy link
Author

Just updated the bot to sign the CLA since the CLA is failing

@connerohnesorge connerohnesorge changed the title feat: add direnv gitignore, migrate flake to use pnpm, and create automatic hash update script (added to github action) feat: add direnv gitignore, migrate flake to use pnpm, and create automatic hash update script (added to github action made bot sign the cla) Apr 26, 2025
@peteringram0
Copy link

@conneroisu Sorry im still new to nix/flakes so if this question is beside the point of this PR then please ignore it but if if i run

~ ❯ nix run github:conneroisu/codex --extra-experimental-features nix-command --extra-experimental-features flakes

error: unable to execute '/nix/store/z4cwhcbj786xlw82y3mx1w3m5nxy1l4g--openai-codex-0.1.2504251709/bin/@openai/codex': No such file or directory

Additionally when i include this in my flake it seems to download correctly and runs without any errors however codex/codex-cli are not available in PATH. I use the helix flake and this seems to add to PATH correctly.

@connerohnesorge
Copy link
Author

connerohnesorge commented Apr 28, 2025

@peteringram0 You are correct. Additionally, it should now add to the path correctly. Thanks!

@peteringram0
Copy link

@peteringram0 You are correct. Additionally, it should now add to the path correctly. Thanks!

That update is working now! I notice though that it it exports 'codex-cli' rather than just default. This requires people to look into the flake and out what thats needed. Maybe an idea to make .default work?

codex-cli.packages.${pkgs.system}.codex-cli
# codex-cli.packages.${pkgs.system}.default

@peteringram0
Copy link

@conneroisu i think in packages you can have a 'default' and just equal to 'codex-cli'. Like this: https://github.com/helix-editor/helix/blob/master/flake.nix#L50

@connerohnesorge
Copy link
Author

connerohnesorge commented Apr 28, 2025

@peteringram0 yep, didn't even see your comment, but updated to have both codex-cli, default, and the update nix hash script. Thanks again

@peteringram0
Copy link

@peteringram0 yep, didn't even see your comment, but updated to have both codex-cli, default, and the update nix hash script. Thanks again

latest version doesnt seem to support .default but does still work with .codex-cli

@github-actions github-actions bot locked and limited conversation to collaborators May 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants