• kibiz0r@midwest.social
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    6 hours ago

    Well, Nix is a programming language, so there’s no getting around having to learn basic principles of coding.

    That said, I feel like coming into Nix with a lot of programming experience actually worked against me at first, because I made a lot of assumptions that weren’t true and basically had to “unlearn” certain things.

    The main things being:

    • Lazy evaluation is trippy as hell sometimes
    • The language truly does not allow for side-effects. Everything you might think is a side-effect is really executed from outside the language runtime itself
    • It might be more accurate to think of Nix as a database, where the keys are the parameters of what to build and the values are directories full of the built artifacts

    What really made it click for me was seeing how a derivation object is basically equivalent to a path. So if I do ${pkgs.foo}/bar”, that’s the exact absolute path (plus /bar) where Nix will end up storing the output of the pkgs.foo derivation. Even without actually building the derivation, you can know where it will end up.

    Anyway, the documentation is pretty shitty, so you basically have to scour every community resource you can find and read way more of it than it seems like you should have to. Discord/Matrix servers help a lot too. And learning to navigate the source code for nixpkgs.

    Also: Don’t start with NixOS, imo. Start with dumb throwaway stuff where you make a derivation that downloads a file and unzips it and runs a single command. Once you understand that, do something that requires understanding a bit of nixpkgs, like using overlays. Then you can use NixOS. Otherwise, there’s too much going on all at once.

    Edit:

    • Nix pills is good
    • Vimjoyer is amazing