Skip to content

Comments

lib: modules.sh should check JSON output for predictability (23.05 backport)#275268

Merged
infinisil merged 2 commits intoNixOS:staging-23.05from
9999years:lib-test-modules-json-23.05-backport
Dec 19, 2023
Merged

lib: modules.sh should check JSON output for predictability (23.05 backport)#275268
infinisil merged 2 commits intoNixOS:staging-23.05from
9999years:lib-test-modules-json-23.05-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.

NixOS/nix#9606 changes how values are printed in
some cases. This updates the lib tests to work with the new output
format, which should be familiar to `nix repl` users.
@9999years 9999years force-pushed the lib-test-modules-json-23.05-backport branch from fd186a5 to 5676777 Compare December 18, 2023 20:21
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Dec 18, 2023
@infinisil
Copy link
Member

Needs to be updated with the changes from the main PR. And this should also be backported to 23.11 if we backport to 23.05.

Note that in most cases you can automatically get a bot to do backports for you by adding the backport <branch> label to PRs on master.

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 force-pushed the lib-test-modules-json-23.05-backport branch from 5676777 to 0ceeea0 Compare December 19, 2023 17:38
@9999years
Copy link
Contributor Author

Updated, ready for review!

@9999years
Copy link
Contributor Author

Put up a 23.11 backport in #275462 too.

@9999years 9999years changed the title Lib test modules json 23.05 backport lib: modules.sh should check JSON output for predictability (23.05 backport) Dec 19, 2023
@infinisil infinisil merged commit c90765e into NixOS:staging-23.05 Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants