• 1 Post
  • 12 Comments
Joined 1 year ago
cake
Cake day: June 14th, 2023

help-circle



  • Corbin@programming.devtoNix / NixOS@programming.devNix Release 2.24
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    1
    ·
    3 months ago

    The nixpkgs community has been operating and maintaining nixpkgs-update since 2018. Earlier in the thread, you were shown the infamous Repology graph; it’s also linked from the nixpkgs-update documentation. We already have a concerted plan to offer the freshest ports tree in the world and are executing on it. If your particular pet package isn’t available, then contribute it yourself and the bot will ensure that it stays fresh and updated.




  • Search the manual for support32Bit configuration options, like hardware.opengl.support32Bit, hardware.pulseaudio.support32Bit, or services.pipewire.alsa.support32Bit. Any 32-bit games, as well as Steam itself, will need these to get their GL and PA/ALSA libraries set up properly.

    You may also want to look up what programs.nix-ld.enable does, although I hear that there’s a better harness builtin as of NixOS 24.05.

    All that said, everything Just Worked when I last tried. I haven’t run Steam in a while, though. I do use Retroarch and OBS without problems, though, streaming PS4 speedruns to Youtube or Peertube, and that all works out-of-box.






  • Oh, right, monoids! Yes, you understand correctly.

    A monoid is a collection of objects that has some sort of addition and zero. (Depending on your maths background, it might equivalently have some sort of multiplication and unit.) Addition must be associative, and addition with zero must not have any effect. Monoids let us think of a system as built from a sequence of operations; each operation adds to the system, preparing its state incrementally.

    Sometimes monoids are commutative, which means that the order of additions is irrelevant to the result. Commutative monoids let us think of a system as built from a collection of operations without worrying about the order in which those operations are applied.

    NixOS modules (and HM modules, etc.) are commutative monoids. The zero is {}. The module system lets options declare their own monoids which ride along, like my example of allowedTCPPorts. Because we can combine sets of port numbers (with set union) and get more sets, we can factor a set of ports into many smaller subsets and put each one in their own file. Here’s my shortest module, for an internal Docker registry, docker-registry.nix:

    {
      networking.firewall.allowedTCPPorts = [ 5000 ];
      services.dockerRegistry = {
        enable = true;
        enableGarbageCollect = true;
      };
    }
    

  • At scale, you’ll appreciate explicitly spelling out your imports. I currently have 23 importable files, of which two are mutually incompatible (headless vs. Xorg). I don’t want a glob over these files because no machine can have all of them; indeed, most machines only have like five imports from the list.

    What might be more interesting to you is a common collection of modules which must be imported everywhere. To achieve this, I explicitly declare a commonModules at the top of my flake and reuse it in each machine definition. Another approach might be a common.nix module which recursively contains the common modules as its own imports.

    Finally, it doesn’t “defeat[] the point of separating” expressions into multiple files to avoid globbing over them. Because NixOS/HM modules are monoidal, they often factor nicely. When you have a dozen different services, you could stuff all of them into one file with one networking.firewall.allowedTCPPorts if you wanted, or you could put each service into its own file and let each module bring its own port to the combined configuration. The latter is easier at scale; I have nine modules declaring TCP ports and five machine-specific TCP ports as well, and it would be a pain to put all of them in one location.