Skip to content

Comments

lib: modules.sh should check JSON output for predictability (23.11 backport)#275462

Merged
infinisil merged 1 commit intoNixOS:staging-23.11from
9999years:lib-test-modules-json-23.11-backport
Dec 19, 2023
Merged

lib: modules.sh should check JSON output for predictability (23.11 backport)#275462
infinisil merged 1 commit intoNixOS:staging-23.11from
9999years:lib-test-modules-json-23.11-backport

Conversation

@9999years
Copy link
Contributor

Description of changes

Backport of #275264.

Currently, the lib/tests/modules.sh test checks the output of nix-instantiate --eval without --json, which outputs an unspecified human-readable format.

This patch modifies modules.sh to use the --json output instead, to be robust against future changes to nix-instantiate output.

See also: NixOS/nix#9606

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Currently, the `lib/tests/modules.sh` test checks the output of
`nix-instantiate --eval` without `--json`, which outputs an unspecified
human-readable format.

This patch modifies `modules.sh` to use the `--json` output instead, to
be robust against future changes to `nix-instantiate` output.
@9999years 9999years requested a review from infinisil as a code owner December 19, 2023 17:41
@github-actions github-actions bot added 6.topic: module system About "NixOS" module system internals 6.topic: lib The Nixpkgs function library labels Dec 19, 2023
@9999years 9999years changed the title lib: modules.sh should check JSON output for predictability lib: modules.sh should check JSON output for predictability (23.11 backport) Dec 19, 2023
@infinisil infinisil merged commit 1aa41f6 into NixOS:staging-23.11 Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: lib The Nixpkgs function library 6.topic: module system About "NixOS" module system internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants