Build packet from nix repo before submitting a PR

Hi everyone,

I’m trying to contribute to the NixOS community by updating a packet for Bambu Studio. As a learning exercise, I want to update the existing packet to the latest version and gain a better understanding of the packet building process.

I’ve already made some modifications using overrideAttrs, but I’m sure there’s more to it. I’m particularly interested in building the packet independently and testing it in a controlled environment that doesn’t rely on my local setup. For instance, there are new dependencies for the latest version of Bambu Studio that limit how much I can accomplish in this way.

Could someone please provide guidance on the following:

  1. Building the packet: How can I build the Nix Bambu packet on its own?
  2. Testing the packet: Is there a way to test the built packet in a Nix shell or similar environment?
  3. Flakes and derivations: Are there any specific considerations for using flakes when building packets? I got quite confused with some of the examples I’ve read online and I believe it has to do with this.

Any advice or examples would be greatly appreciated! Thanks.

I would do it like this:

  1. Fork the nixpkgs repository
  2. Clone it onto your computer and make the changes you want.
  3. In the root of your nixpkgs run the following command to build the package nix-build -A bambu-studio
  4. You will get a result file in the repository that points to the built Bambu Studio in Nix store. You can then test that. ./result/bin/bambu-studio

It could be that you should build the package with nix-build --arg nixpkgs ./. -A bambu-studio to avoid using your system nixpkgs.

AFAIK you can ignore flakes when you are working directly on Nixpkgs and packaging is mostly the same when you use flakes.

This might help as well: Packaging existing software with Nix — nix.dev documentation

I’m really not an expert in this so maybe someone else can correct me here but I tested the commands and used them before as well.

2 Likes

I didn’t manage to find the solution to bambu-studio in time, someone beat me to it. But I was able to find a dependency issue an create my very first MR to the nixpkgs repo! Thanks!!

1 Like