Skip to content

Comments

lib: modules.sh should check JSON output for predictability#275264

Merged
infinisil merged 1 commit intoNixOS:masterfrom
9999years:lib-test-modules-json
Dec 19, 2023
Merged

lib: modules.sh should check JSON output for predictability#275264
infinisil merged 1 commit intoNixOS:masterfrom
9999years:lib-test-modules-json

Conversation

@9999years
Copy link
Contributor

Description of changes

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.

@github-actions github-actions bot added 6.topic: module system About "NixOS" module system internals 6.topic: lib The Nixpkgs function library labels Dec 18, 2023
@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
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 branch from 23e25e0 to fa9727c Compare December 19, 2023 17:23
@9999years 9999years requested a review from infinisil December 19, 2023 17:23
Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

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

Looking good!

@github-actions
Copy link
Contributor

Backport failed for staging-23.05, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin staging-23.05
git worktree add -d .worktree/backport-275264-to-staging-23.05 origin/staging-23.05
cd .worktree/backport-275264-to-staging-23.05
git switch --create backport-275264-to-staging-23.05
git cherry-pick -x fa9727cf1e4916d948529946b877eae7f0a61b0d

1 similar comment
@github-actions
Copy link
Contributor

Backport failed for staging-23.05, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin staging-23.05
git worktree add -d .worktree/backport-275264-to-staging-23.05 origin/staging-23.05
cd .worktree/backport-275264-to-staging-23.05
git switch --create backport-275264-to-staging-23.05
git cherry-pick -x fa9727cf1e4916d948529946b877eae7f0a61b0d

@github-actions
Copy link
Contributor

Git push to origin failed for release-23.05 with exitcode 1

@github-actions
Copy link
Contributor

Successfully created backport PR for release-23.05:

@infinisil
Copy link
Member

@9999years Oh, I only just realised that your manual backports in #275462 and #275268 went to the staging branches. This isn't ideal, they should go to the main development branches (release-*) instead. Doesn't matter much though, it's just gonna take like up to a week now for the backports to land in the release channels.

I'll close the automatic backports, those won't be necessary. If you're wondering about the staging workflow, see https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#staging

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 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