• 3 Posts
  • 70 Comments
Joined 1 year ago
cake
Cake day: June 14th, 2023

help-circle

  • Other way around, actually; C was one of several languages proposed to model UNIX without having to write assembly on every line, and has steadily increased in abstraction. Today, C is specified relative to a high-level abstract machine and doesn’t really resemble any modern processing units’ capabilities.

    Incidentally, coming to understand this is precisely what the OP meme is about.











  • Sarcasm needs to be humorous; you’re merely rattling off insults. Anyway, it’s pretty uncommon that somebody literally “can’t contribute code;” anybody who can learn how to use a computer and post juvenile horseshit to Lemmy can learn how to write code. I’m a former professional musician; writing code is my backup career, taking less practice and effort than playing the piano. I encourage you to try putting in some effort; for the same time it takes to write around 500 comments/month on Lemmy, you could probably build a program that automates or simplifies some portion of your life.

    And seriously, by doubling down on the idea that being Neanderthal is bad or deficient, you’re spouting some nasty rhetoric. It doesn’t matter whether you’re serious or not; eventually, you’ll forget that you were being ironic. “Those who play with the devil’s toys will be brought by degrees to wield his sword” and all that.


  • As a hardware hacker, I’ve experienced Apple’s anti-FLOSS behavior. I was there when Apple was trying to discourage iPodLinux. In contrast, when we wanted to upstream support for the Didj, LeapFrog gave us documentation and their kernel hackers joined our IRC channel. It’s the same reason that people prefer ATI/AMD to nVidia, literally anybody to Broadcom, etc.

    Your “entire fucking point” is obvious from the top-level comment you replied to; you’ve taken offense to somebody pointing out that writing FLOSS on Apple hardware is oxymoronic. And it’s a bad point, given that such a FLOSS hacker is going to use Homebrew or Nix in order to get a decent userland that hasn’t been nerfed repeatedly by an owner with a GPLv3 allergy and a fetish for controlling filesystem layouts. Darwin is a weird exception, not one of the easy-to-handle BSDs.

    Also, what, are you not anti-Apple? Do you really think that a fashion company is going to reward you for being fake-angry on Lemmy?






  • 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;
      };
    }
    

  • I’m adding some code snippets from my homelab’s flake. Minor details are changed. Note how I have a core.nix and also separate files for adding Avahi (zeroconf) and SSH, and for fixing bufferbloat. I could have them as one file, but it’s easier to come back to them after several years this way. (bufferbloat.nix was last changed in December 2021, for example.)

    I know that some of this code style probably seems weird. Think of it as heavily inspired by Puppet, Chef, Ansible, HCL, etc.; when we are configuring a system, it is very very nice to be able to comment out a single line at a time.

    Click to see code!

    Some common modules, bundled into a NixOS module:

        commonModules = {
          imports = [
            nixpkgs.nixosModules.notDetected
            ./avahi.nix
            ./bufferbloat.nix
            ./core.nix
            ./ssh.nix
          ];
          nix.registry.nixpkgs.flake = self.inputs.nixpkgs;
          nixpkgs.config.packageOverrides = pkgs: {
            mumble = pkgs.mumble.override {
              pulseSupport = true;
            };
          };
          users.users.corbin = {
            isNormalUser = true;
            extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
          };
        };
    

    A NixOS machine definition:

          joker = nixpkgs.lib.nixosSystem {
            inherit system;
            modules = [
              commonModules
              ./joker/configuration.nix
              ./gl.nix
              ./sound.nix
              ./wifi.nix
              ./xserver.nix
            ];
          };