I’m hoping this will be helpful for creating future core-contributors.
Even though I’m not new to nix in the slightest, understanding the bootstrapping sequence has been challenging to say the least.
So, is there some way to: - build cowsay - force a rebuild of cowsay’s depenedencies recursively (its okay if it takes 48 hours) - have the console print out a list of every .nix file that was accessed (in order) while that happens
I’m fine if I need to hack stuff, like build a custom nix binary, in order to get this printout. I also won’t be bothered by any weird ordering thats caused/not-caused by lazy evaluation. I’m mostly interested in what code is used and what isn’t; like which packages are needed for something like fetchFromGithub to work, etc.
Attempts:
I’ve looked at lib/debug.nix, didn’t see anything obvious to do the trick.
Didn’t see any kind of debug=vomit type of option inside of nix/nix repl/nix-env help menus.
As a last resort I’ve considered using the OS to try and detect file-reads and, while possible, it also wasn’t straightforward and it would be nice to do this in a not-os-specific way since bootstrapping is different for each OS.
Edit: using that command, I present nixpkgs-skeleton; a repo which contains only absolutely-essential files for building cowsay (308 files, 152 directories ). Hopefully people will find it useful to explore!
And for those who want a quick look at the output, here’s the begining of the file-access for MacOS M1
(nixpkgs commit cfb43ad7b941d9c3606fb35d91228da7ebddbfc5)
This is a great little project! Thanks for making and sharing! I checked out a few of the files and they look unchanged relative to cfb43ad7b941d9c3606fb35d91228da7ebddbfc5. Is it true that you didn’t change any of the files that were needed for nixpkgs-skeleton to build cowsay?
I’m not exactly sure about the question. But hopefully this will answer it;
I forked nixpkgs
Checked out that commit you mentioned
Built cowsay using that command
Recorded all the accessed files
Deleted all the not-mentioned files
Rebuilt to make sure it still worked
Pushed that change
I never did get around to repeating the process for Linux, mostly cause I spent a while trying to make sure nix wasn’t caching anything (which I never really confirmed)
It’d be nice to have a Github action that automates this for Linux and Mac. Sadly my Github action skills aren’t up for that task yet