Disclaimer: I’ve only been using NixOS etc for about 6 months and I haven’t done built any packages or written custom modules, so I’m still kind of a noob.
While learning Nix, I have come up against three issues which I believe could hypothetically be solved by the same solution.
Issue 1:
Nix has a limited audience because it forces everyone to learn the logic behind reproducing their system with the functional programming. I believe I have gotten over the biggest hump of the learning curve (finally!), but it makes it hard to pitch to people that just want reproducible apps and configs without learning how variable inheritance and string concatenation works in the Nix language.
Issue 2:
Nix aims to allow people to make their configs and packages stateless, which is great, but everyone wants some state. Most people don’t want a nixos-rebuild switch
to set their speaker volume or display brightness (which it thankfully doesn’t). I use Home Manage to track my terminal configuration, but,I like changing the colour scheme of my terminal often. For me, terminal colour scheme should be a stateful value, because I change it on moods. However, I don’t know of a way to separate that out from the other terminal configuration that I do want to be in my Nix configuration.
Issue 3:
This is related to issue 2, but still distinct I believe. Nix rebuilds are kind of slow. I don’t have a problem with this if I’m editing things like my flake architecture or something else I don’t change often, but for something basic like installing a package, waiting for the NIx language interpreter to comb through every line of my config is kind of unnecessary. It would be nice if changing some piece of data like adding a package would not trigger a re-evaluation of all the Nix code.
My Solution:
I think it would be cool to decouple the logic behind reproducible builds, dependency handling, inheritance, etc. from the “meat” of the configuration: package lists and configuration options. For example, I would be able to declare inputs and outputs etc. in a language that compiles slowly, but is reliable and performant (like Rust or Go) and have them access data from a set of standardized configuration files (like YML or TOML). Nerds like us could edit the basic architecture, and all average Linux users would have to do to install and configure packages is to edit some familiar looking config files.
I realize this is likely extremely difficult to accomplish, but I think it is at least an interesting idea. That said, Nix and Guix both chose to use DSL programming languages rather than passive config files, so there is likely some huge drawback staring me in the face that I didn’t think of. I would love to hear the community’s thoughts.
Also, I saw somewhere that you can import stuff from YML etc. into a Nix file. How does that work exactly?