Skip to content

raspi-utils: init at 0-unstable-2025-10-02#449925

Open
GiggleSquid wants to merge 1 commit intoNixOS:masterfrom
GiggleSquid:pkgs-raspi-utils
Open

raspi-utils: init at 0-unstable-2025-10-02#449925
GiggleSquid wants to merge 1 commit intoNixOS:masterfrom
GiggleSquid:pkgs-raspi-utils

Conversation

@GiggleSquid
Copy link
Contributor

@GiggleSquid GiggleSquid commented Oct 8, 2025

Part of #449772

Adds raspi-utils, a replacement for libraspberrypi.

The rpi userland repo was archived 2025-07-27: https://github.com/raspberrypi/userland
This contained mostly proprietary VideoCore APIs (alongside rpi hardware tools).

Other rpi hardware tools were moved to the utils repo: https://github.com/raspberrypi/utils

After 25.11 libraspberrypi will be deprecated in favor of raspi-utils

@dezgeg @tkerber Please let me know if you wish to be maintainers for this package as your were both maintainers for libraspberrypi.

@SFrijters Please let me know if you wish to be a maintainer as well, as this was mostly your idea.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Oct 8, 2025
@GiggleSquid
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 449925
Commit: 06017cc949f43337423bb867338adf4b2fd4ea1d


x86_64-linux

✅ 1 package built:
  • raspi-utils

@GiggleSquid GiggleSquid added the 8.has: package (new) This PR adds a new package label Oct 8, 2025
@GiggleSquid GiggleSquid marked this pull request as ready for review October 8, 2025 13:21
@nixpkgs-ci nixpkgs-ci bot added the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Oct 8, 2025
@SFrijters
Copy link
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 449925
Commit: 06017cc949f43337423bb867338adf4b2fd4ea1d


x86_64-linux

✅ 1 package built:
  • raspi-utils

aarch64-linux

✅ 1 package built:
  • raspi-utils

@SFrijters SFrijters requested review from dezgeg and tkerber October 8, 2025 14:24
@nixpkgs-ci nixpkgs-ci bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Oct 8, 2025
Copy link
Contributor

@RossSmyth RossSmyth left a comment

Choose a reason for hiding this comment

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

Good start, but most of these utilities wouldn't be usable on all systems. Needs:

  1. provide executable in buildInput to patch shebangs of some of the executables so they run at all on NixOS
  2. Patch the locations of executables to the nix store
  3. Either optionally or unconditoinally add gnutls so the crypto util can be build
  4. Add dtc to build inputs so libfdt can be accessed.

(lib.cmakeBool "ARM64" stdenv.hostPlatform.isAarch64)
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}")
];

Copy link
Contributor

Choose a reason for hiding this comment

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

Or double-check that it is installed in the correct (for Nixpkgs) location.

Suggested change
installShellCompletion --cmd vcgencmd \
vcgencmd/vcgencmd-completion.bash
'';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've worked on all the other suggestions, but you'll have to forgive me, I don't understand this one.

Could you explain it a bit more please?

Copy link
Member

Choose a reason for hiding this comment

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

The completions for pinctrl and vcgencmd end up in share/bash-completion/completions/ (which is correct), but they don't have a .bash extension - is that okay?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not completely sure, the file will end up in the /run/current-system/etc/bash-completion directory, but will bash still use it without an extension? If so then seems fine to me.

rev = "9f61b87db715fe9729305e242de8412d8db4153c";
hash = "sha256-LAEAjxb6+lQKo2VUknkuZa5sK37k6SjF+imj/7qyOe4=";
};

Copy link
Contributor

Choose a reason for hiding this comment

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

There are several places that need patching to access dtc correctly. kdtc, dtmerge, and overlaycheck (possibly).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would you (or @SFrijters) be able to test this for me? I don't currently have the appropriate machines spare to test myself.

I've only gone so far as to simply execute the binaries once.

Copy link
Member

Choose a reason for hiding this comment

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

I'm doing some testing at the moment, adding @RossSmyth 's suggestions.

Would patching be preferred over wrapProgram? It looks like overlaycheck is doing some more complicated stuff so patching may be needed anyway, but kdtc is just calling 'dtc', so if it's on the PATH that could be enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

I generally preferring patching but if there is a lot of stuff to patch then don't waste your time and just wrap (use makeBinaryWrapper)

@SFrijters
Copy link
Member

raspinfo tries to run a bunch of stuff (after adding bashNonInteractive to buildInputs, allowing the shebang to be patched):

<redacted>/result/bin/raspinfo: line 196: apt-cache: command not found
<redacted>/result/bin/raspinfo: line 208: ifconfig: command not found
<redacted>/result/bin/raspinfo: line 215: lsusb: command not found
<redacted>/result/bin/raspinfo: line 137: aplay: command not found

Maybe more after it asked for sudo and I aborted it.

@SFrijters
Copy link
Member

overlaycheck and kdtc also want a cpp compiler at runtime.

@SFrijters
Copy link
Member

SFrijters commented Oct 9, 2025

Getting aggravated with the slow Pi and testing cycle for now, feel free to take inspiration from my WIP fixup commit at https://github.com/SFrijters/nixpkgs/tree/raspi-utils .

@GiggleSquid
Copy link
Contributor Author

I've pushed to get some of the suggestions closed.

Seems this will definitely be more complex than I initially thought!

But it does need to be done right. And I suspect this will continue to require more testing and iteration

@RossSmyth
Copy link
Contributor

raspinfo tries to run a bunch of stuff (after adding bashNonInteractive to buildInputs, allowing the shebang to be patched):

Hm maybe just not package that utility? Seems pretty raspbian-specific since if you are running NixOS on your pi then you may not be using sudo or apt.

@SFrijters
Copy link
Member

I made another commit to https://github.com/SFrijters/nixpkgs/tree/raspi-utils which uses a patch / replaceVars approach. I skimmed through the source files and hopefully caught most of them.

Remaining problem: the current implementation does not work because of infinite recursion - is it possible to defer to the $out path inside replaceVars somehow?

which seems to be used only to check that a command exists, so maybe we can use command -v instead and drop that dependency entirely. I'm not sure if git is ever on an active code path for us.

@RossSmyth
Copy link
Contributor

RossSmyth commented Oct 12, 2025

is it possible to defer to the $out path inside replaceVars somehow?

No, but you can use placeholder "out"

@SFrijters
Copy link
Member

@RossSmyth Right, thanks, I knew there was something I was forgetting. In this case though it seems I have to jump through an additional hoop - it works but a pointer to a cleaner way would be appreciated.

@GiggleSquid Other than that, my branch so far is my best effort at finding and patching the paths to external executables - I've never used the new executables for anything myself, so maybe I missed a code path somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages 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.

3 participants