Hi. I’m hunting for any info on how to build a Nix package from local (and modified!) sources. To be clear, not the modified Nix package files from the Nixpkgs repos but the actual original program modified source code tweaked locally.
IDK whether I can’t quite word properly what I’m looking for or the topic is generally a grey area. But all I keep finding is:
- How to force pull and build some Nixpkgs package locally as opposed to auto downloading pre-built bins from Nixpkgs cache.
- How to clone Nixpkgs registry repo and build/install packages from that local Nixpkgs registry repo as opposed to online Nixpkgs registry repo on Github.
- How to build a custom version of a package with some custom compiler flags.
- How to build a custom version of a package and apply a source diff patch in the process.
- etc
Some of these assorted shreds of info I found (discourse/google/reddit/blogs/youtube) are rather dated and no longer apply anyways. But regardless, none answer the two fundamental questions I’m trying to figure:
- Assume you are daily driving a certain program. The project is hosted on Github and is widely available for everything including NixOS via Nixpkgs. Now you want to improve certain things and potentially contribute back to the project. Meaning you want to clone the project locally and set up a dev environment so you can modify the code, build and run it locally on your Nixos box. What is the most efficient way of achieving this?
- Not to distract from point 1 above as it is a generic task on its own, but the program I want to tweak is an always on running service. As in actually running on the box I want to develop it on, originally installed via standard configuration.nix route. It is a popular Wayland compositor WM. So naturally, the next question after building it from sources would be how on earth do you run it to test/debug given that it is already running and in fact is one of the fundamental system pieces needed to do almost anything including Nix package management and the actual development. As in letting you run all other programs needed for development starting with multiple terminal instances and finishing with web browser for docs etc. A catch 22 situation…
Any advice please? Any pointers to the relevant Nixos doc/wiki pages or any external guides? Both of these sound like rather usual common place tasks in my head yet I’m struggling to find anything relevant.
Thanks