4 ms·
Just to add to what others said regarding question 2. After you write a derivation that you can build, you need to create a module [1]. The module defines conf
by takeda 6y ago
Just to add to what others said regarding question 2.
After you write a derivation that you can build, you need to create a module [1]. The module defines configuration options, then takes the donation and does other things such as creating service users (if needed), services and configurations.
Then you simply import it and use it.
Regarding question 1 what was suggested by others is what is the current way of doing it, but I will recommend to go through Nix Pills[2]. The author starts with making a simple derivation and then starts introducing conventions. The conventions make things more complex, but they make things more flexible. I can't wait for Flakes[3], they will standardize a lot of this, removing extra cruft and allowing things to be more composable.
[1] https://nixos.org/nixos/manual/index.html#sec-writing-modules https://nixos.org/nixos/manual/index.html#sec-writing-module...
[2] https://nixos.org/nixos/nix-pills/index.html https://nixos.org/nixos/nix-pills/index.html
[3] https://www.tweag.io/blog/2020-05-25-flakes/ https://www.tweag.io/blog/2020-05-25-flakes/
- thibran 6y agoThanks for the links. Flakes seem to be a good way forward. I've even read most Nix Pills posts, but didn't like them much. Too many details about things that I didn't understand at the time of reading, so the why got lost. In Nix you get a lot of details, what is missing is often the why and how. For example I wanted to have a CLI command available with a binary build, finding out how to add the CLI tool to the package through wrapProgram in postInstall wasn't fun. Overall Nix is awesome, but here and there it is hell of a lot frustrating. After reading so many hours I should not have to ask how to install a custom package the right way.