Skip to content

nix depexts: load from json instead of inlining package names#6894

Merged
kit-ty-kate merged 1 commit intoocaml:masterfrom
kit-ty-kate:nix-depext-packages-json
Apr 16, 2026
Merged

nix depexts: load from json instead of inlining package names#6894
kit-ty-kate merged 1 commit intoocaml:masterfrom
kit-ty-kate:nix-depext-packages-json

Conversation

@kit-ty-kate
Copy link
Copy Markdown
Member

@kit-ty-kate kit-ty-kate commented Apr 15, 2026

Fixed and tested by @RyanGibb

The following pattern was allowed:

depexts: [
  ["gmp ]; <arbitrary nix expression>"] {os-distribution = "nixos"}

The json values can include strings trying to escape the json, but the map (name: buildPackages.${name}) ensures any value will either be correct or make nix-build fail which is a reasonable behaviour. Nix syntax does not work like bash and thus ensure that nothing can escape the ${name}.

Backported to 2.5 in #6895

Copy link
Copy Markdown
Collaborator

@rjbou rjbou left a comment

Choose a reason for hiding this comment

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

LGTM!
Tested locally, and it changes well the derivation parsing error to a less harmful json parsing error.

Comment thread src/state/opamSysInteract.ml Outdated
Comment thread src/state/opamSysInteract.ml
@kit-ty-kate kit-ty-kate force-pushed the nix-depext-packages-json branch from 621741a to d2259c2 Compare April 16, 2026 14:35
@kit-ty-kate kit-ty-kate merged commit 0d5faf1 into ocaml:master Apr 16, 2026
62 of 63 checks passed
@kit-ty-kate kit-ty-kate deleted the nix-depext-packages-json branch April 16, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants