• @[email protected]
    link
    fedilink
    21 year ago

    Is there an easy way to learn this for just the package manager? Most of the tutorials I find are tailored to NixOS, which I’m not using and don’t plan on using.

    • @[email protected]
      link
      fedilink
      41 year ago

      You can absolutely use nix and home-manager without NixOS, you can even use it on a Mac!

      Most of the tutorials I find are tailored to NixOS

      I think that’s less true than you think. There’s definitely a lot of tutorials from people who do use NixOS… But this mostly doesn’t matter, using nix is more or less the same regardless of operating system. There is some stuff specific to NixOS, but that’s mostly just using nix to configure system services.

      Is there an easy way to learn this for just the package manager?

      That said… There’s not a super easy gateway to learning nix, unfortunately. The easiest way to learn is probably to try to package one of your personal projects, or by learning home-manager and trying to fully declare your home environment. Packaging programs in certain languages can involve having to learn more about the nix ecosystem than others (e.g., python is a little more complicated than what you’d need to package a simple C program, because python has it’s own ecosystem that you have to integrate with).

      Probably the best introduction is the nix pills if you want to learn how nix works (not necessarily how to use it, but it will give you a really solid foundation):

      https://nixos.org/guides/nix-pills/

      Though, it’s really common for people to bounce off of the nix pills because they start kind of slow. If you can follow through them, though, you’ll have a good understanding of the nix language and how it’s used to construct derivations for building packages.

      The nix language is much maligned, but it’s actually not as bad as you think going in (error messages can be ATROCIOUS, however). It looks a bit weird, but I think if you go in with the understanding that it’s “Turing Complete JSON” you’ll have a better time. Almost everything you’re doing in nix is building up attribute sets (which are basically just JSON dictionaries) which specify the dependencies and build stages of a project… But it’s not a static representation like JSON, you can call functions to do arbitrary computations to build up fields (e.g., I have some functions to automatically set up wireguard configurations from a description of the network layout of my machines, so it’s useful to be able to do this stuff).

    • sickday
      link
      fedilink
      21 year ago

      For what it’s worth, I don’t understand the nix language or all the package manager functions in their entirety. I generally use what I need and that’s it. Most information I’ve required that is nixpkgs-specific I was able to find in the manual. home-manager has one as well and it’s been the best reference for me.