• sunstoned@lemmus.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 months ago

    Love the example here!

    I’m still learning about available references (ex config.services.navidrome.settings.Port). What resources did you find to be the best for learning that kind of thing?

    I’ll accept RTFM if that’s applicable :)

    • tux7350@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      4 months ago

      Use nix repl! That stands for Read Eval Print Loop. You can evaluate a nix expression and see all the attributes inside. For example, on a non-flake system, use :l <nixpkgs/nixos> inside the repl to load the current system. Then you can hit the tab key to show whats inside of the current attribute set, make sure you have a . at the end. Then you can press enter to evaluate and see the declaration. For example when you set networking.hostName in configuration.nix you can actually find it under options.networking.hostName.value evaluating that in the repl.

      • sunstoned@lemmus.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 months ago

        Amazing! I’ve used that before but just to look for packages offline. I’ll definitely check that out.

    • Laser@feddit.org
      link
      fedilink
      arrow-up
      3
      ·
      4 months ago

      Well, a lot of it is just trying stuff out, but let’s say you want to setup Navidrome because you read about it somewhere. My first step is always to go to https://search.nixos.org/options? and search for it, it’ll show you the options available. If you want to know how it’s implemented under the hood, press the “Declared in” link where it shows you the source code of the module, this can sometimes be helpful.

      Other than that, read the wiki for examples, and remember that nix is a full language and not just a configuration, so you can keep it flexible.