Skip to content

Conversation

pinpox
Copy link
Member

@pinpox pinpox commented Feb 14, 2025

Things done

When using nixos-rebuild-ng from scripts, the last word of the output is cut off because it is printed to stdout instead of stderr like the rest of the output.

Example:

Moving mount
+ umount -R /run/secrets.tmp
+ rmdir /run/secrets.tmp
+ umount --lazy /run/secrets
reloading user units for pinpox...
reloading user units for root...
restarting sysinit-reactivation.target
the following new units were started: NetworkManager-dispatcher.service
Done. The new configuration is
Return Code: 0
  • 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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 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 the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Feb 14, 2025
@nix-owners nix-owners bot requested a review from thiagokokada February 14, 2025 18:08
@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Feb 14, 2025
Copy link
Contributor

@thiagokokada thiagokokada left a comment

Choose a reason for hiding this comment

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

This is proposital, the idea is that if you want to use the output for scripting you can without needing to do weird hacks with sed etc.

@pinpox
Copy link
Member Author

pinpox commented Feb 15, 2025

This is proposital, the idea is that if you want to use the output for scripting you can without needing to do weird hacks with sed etc.

Would it make sense to write it to both then?

@thiagokokada
Copy link
Contributor

Would it make sense to write it to both then?

Not really, otherwise it would appear twice in normal usage.

@pinpox
Copy link
Member Author

pinpox commented Feb 16, 2025

Ok, I'll find a workaround then. The output of stdout can't just be concatenated to the stderr output thogh, because it does not only print the path. Some other lines of logging are printed there too:

Last lines of stderr:

reloading user units for pinpox...
reloading user units for root...
restarting sysinit-reactivation.target
Done. The new configuration is

Meanwhile stdout prints:

setting up /etc...
Attaching mount /run/secrets.tmp -> /run/secrets
Moving single attached mount
/nix/store/y57bmp3gham535kk252qfb1gdqkg8jx3-nixos-system-ahorn-25.05.20250213.2ff53fe

I can extract the last line of the stdout, though I don't fully understand why the other three lines are printed there too.

@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 28, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants