• balsoft@lemmy.ml
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    15 hours ago

    This is a pretty good list of tutorials for Nix (as the package manager thingy) (not NixOS): https://nix.dev/tutorials/#tutorials

    Here’s a tutorial for the Nix language: https://nix.dev/tutorials/nix-language

    As for the configuration.nix file, TBH, once you understand the Nix language you can just go around and look at what other people have written to get the inspiration. There’s a list of NixOS configs here: https://wiki.nixos.org/wiki/Configuration_Collection. Some of them are quite complex (as is mine), but you can start with something simple, maybe like this: https://bitbucket.org/bzz/nixos/src/master/configuration.nix . It will give you an idea of how to set config options and how the imports system works. To then see which config options are out there, look at https://search.nixos.org/options , you can search for anything you like (e.g. services, programs, networking, random system configuration stuff). You should never ever edit anything in /etc other than configuration.nix manually, always look for config options to do it.

    There’s technically documentation about it here: https://nixos.org/manual/nixos/stable/#sec-configuration-file , which can be helpful, but it’s also kinda long for what it tries to explain.

    Once you get the basics, you can look into flakes to replace stateful channels, making your configuration more modular to reuse it across multiple machines (now it’d be time to look at those more complicated configs), using home-manager to also manage your $HOME (so that you don’t have to touch ~/.config manually either), and maybe even impermanence to make your system reset to whatever is in your NixOS config on every reboot, erasing any accidental edits to configs, to make sure that your configuration reflects what exactly you want from your machines.