Currently going through the process of learning to work with flakes, meanwhile having relatively limited experience with the legacy nix packaging approach.
Just recently started the following to help myself:
and to have something handy in the future in case I need to refresh my memory. I especially wanted something that is complete, meaning that nothing needs to be added to it in order to try it.
I somehow overlooked the templates mentioned by @nixinator, and will consult them in the future.
As a newcomer it can be a bit difficult to quickly get something working based on examples, because different examples may use different approaches. For instance, the interplay between legacy nix and flakes can be coded differently. The default.nix can be imported in flake.nix or the default.nix can import the flake. When using a rust overlay, different overlays are available. If cross-compilation is needed, there seems to be different ways to go about it, etc. So it can be quite challenging to pick things up from multiple examples as different examples may use different approaches.
Hence having a rich collection of ideally fully working examples can be very useful. So far I’ve glanced at the repo of different projects I come across that are relevant to what I am working on, and that people point too. But all these projects are not so simple, so I had to pick them apart to try what I needed.
As auxilliary to everyone else’s answers, someofmine are pretty simple while still being useful, and might serve as a lightweight example for some things here and there.
I started using flakes only after I was comfortable writing other Nix packages. However, I found the NUR template a good way to get started with “here’s my nix stuff”. GitHub - nix-community/nur-packages-template: A template for NUR repositories: [maintainer=@fgaz] – Maybe it’s not “simple”; but, I could use it without knowing what flakes are / without interacting with the flakes, and I could just remove the stuff I didn’t care about. I think it’s monkey-see-money-do’able.