Open hawkw opened 6 months ago
I like the chunky comments for making the different outputs distinct.
I'm assuming that if we wanted to FlakeHub it, we'd need to proactively keep the flake up to date. Right now needing to manually update the output hashes of the git dependencies. I have heard tell of something that might be able to automate updates to them but I don't remember what it is- I can go asking around. I know that I can PR updates to it as necessary but I only pay attention when I'm updating humility on my jumpbox pi. Maybe you'd run into it frequently enough to keep that up to date though.
I'm assuming that if we wanted to FlakeHub it, we'd need to proactively keep the flake up to date. Right now needing to manually update the output hashes of the git dependencies. I have heard tell of something that might be able to automate updates to them but I don't remember what it is- I can go asking around.
Yeah, figuring this out is why I didn't include publishing in this PR...having to update those hashes manually is unfortunate. Fortunately, a majority of them haven't changed since you published your blog post a while ago. So, the amount of dependency churn isn't too bad...
This commit adds a Nix flake for building Humility for Nix users, providing a dev environment with build dependencies for use with
nix develop
ordirenv
, and (on NixOS) configuring udev rules to allow all debug probes supported byprobe-rs
. Parts of this flake --- in particular, the code for cross-compiling for multiple targets --- are based on code written by @faithanalog.What The Flake Provides
The flake provides the following:
humility
(for the host platform), as well ashumility-aarch64
andhumility-armv7l
for cross-compiling for ARM linux environments. These were in @faithanalog's config as I believe she's got dev boards hooked up to a Raspberry Pi or something that she SSHes into, but would like to build Humility on her dev machine for the Pi target.udev
rules published byprobe-rs
, allowing NixOS users to addto their
configuration.nix
to allow all the debug probes thatprobe-rs
supports to be run by non-root users. This config is fetched from theprobe-rs/website
Git repository, so if upstream adds new supported probes, we can pick up their changes.app
for use withnix run
, which runs a Humility command.nix develop
ordirenv
programs.humility
which can be used by NixOS users to add Humility to the system's packages, add the udev rules, and add user account(s) to theplugdev
group to allow access to debug probes.On Checking In Nix Configurations
I understand that checking in configurations that are specific to a package manager/distro that not everyone uses may be controversial. And, if folks don't want Nix configs in the main Humility repo, that's understandable, and there are alternative options for Nix users to build Humility --- we can also have a Nix flake in a separate repo that fetches the Humility sources from Git. However, checking in this flake to the Humility repo has some meaningful advantages for Nix users:
direnv
ornix-develop
. If the Nix configuration is not in the source tree, it can't easily be used withdirenv
. Of course, Nix users can have their own dev environment that isn't checked in. However, this would no longer be the same build environment definition that would be used for building a Humility nix package, meaning that there is the potential for drift between individual contributors' dev environments and the canonical build environment.If this rationale isn't convincing, that's okay, and I'm happy to close this PR. :)