Where I've been

The Quiet Kid

I'm not sure if it come across, but I've never exactly been the loud kid. If you've met me IRL, you know I tend to not have much to say, even if I'm pretty comfortable with you. The same goes for this blog!

The time in between the last post and this has been a whirlwind, though. I suppose an update is in order.

Another year in the bag

I took an entire year of purely compsci classes, and I seem to have done pretty well by all metrics! These classes were all of great interest to me, but even then I had to sell my soul to the devil for the grades I earned.

The classes that were particularly memorable were Operating Systems, Formal Languages and Automata Theory, and Introduction to Parallel Programming. The professors for these classes truly are GOATs, and the content were really engaging.

This was the first year that I TA'ed for, too. I would like to think I was a competent TA, if not a little too un-serious at times.

Summer of Everything

This summer is certainly a hectic one for me. Let's start from the top - I'm currently in the Google Summer of Code program, writing accelerated decoding filters for FFmpeg! You can read about exactly what I'm doing here! It's really exciting stuff, at the intersection of multimedia and low-level computing. x86_64 Assembly may be a daunting task, and throwing SIMD on top of that makes it super inaccessible, but it's really not that bad once you have a good infrastructure for macros, and FFmpeg certainly has that in spades!

The other main shenangian I've been up to is that I'm now Studio Engineer at Radio K! I'm in charge of the audio side of Off the Record! It's really an honor that I get to record the amazing musicians in this part of the world and witness it first-hand! You can hear my mixes as well as the amazing performances here!

One last thing is that ACM UMN is, after many long years, finally getting the upgraded 10-gigabit network! My tenure as systems administrator may be over, but it's all-hands-on-deck for this network upgrade, and I'm giving all the guidance I can to our new sysadmin in this transition!

Future of the Blog

My best friend recently talked to me about the lack of simple explainations for digital multimedia - she's had to rely on me to explain lots of stuff in digital audio and video. Essentially, there really isn't an accessible resource for this stuff.

I'm planning to write a short series of blogposts on this site explaining the stuff that goes into your codecs, from audio to video, and generally just nerd out about digital audio and video in an accessible manner! Sort of a more approachable version of xiphmont's amazing "Digital Media Primer". Stay tuned for those!

I'm also planning to write an article or two about x86_64 assembly, SIMD, and efficient memory access. I'm going to be a TA for Machine Architecture and Organization next semester, so not only will this be a resource for future students, but also gives me a chance to practice elegantly explaining this stuff!

Till next time,

r/l/s

NIX NIX NIX(OS)

A dive into the trinity

A joke that originated from my roomate Andrew goes something like this

nixos trinitarianism

Naturally, as with all things cursed, seeing that compelled me to try it. As with anything new, it seemed scary at first - a massive departure from the typical package management paradigm. However, having used it on-and-off for a couple weeks or so, I can confidently say there's a lot to like about it!

The motivation

So why NixOS over all the other distros out there? NixOS definitely pales in comparison to the mainstay distros (Debian, Ubutntu, RHEL, etc) in terms of official support from software vendors.

The big motivation for NixOS is avoiding DLL hell. You think Linux doesn't suffer from DLL hell? Think again! Think of the multiple times you've seen apt or pacman fail leaving you with a system full of garbage in your /usr/bin! Think of the multitude of precompiled Linux binaries that will never run on your machine because of a different libc! Think of the amount of library packages you installed for schoolwork once and never touched again! That's what Nix is trying to avoid, in the big picture.

Of course, there's been other efforts to prevent this - most notably, Fedora's Silverblue aims to do something similar - with an immutable root and flatpaks to manage a package's dependencies. However, NixOS's approach to doing this differs from Silverblue significantly.

NixOS attempts to avoid this DLL (or rather, package) hell by taking inspiration from the world of functional programming - the seminal paper that describes Nix as a whole lays out the functional nix language that NixOS uses to determine package dependecies and settings.

The DevOps and sysadmin people will be immediately drawn to the reproducability that NixOS provides - the "godfile" configuration.nix is all that is needed to re-create an OS (sans any user data, obviously), and a typical NixOS development environment strives to be completely reproducable - the same source code should yield the same binary.

Great, how do I get started?

There is no substitute for hands-on experience! Trust me, unlike other distros, this isn't something that you can learn by osmosis! It's very much equivalent to learning your first functional language!

You'd want to get the NixOS ISO and write it to a boot USB, then follow the instructions to install it. These instructions are very sparse, so don't be afraid to Google!

Some installation notes and stumbling blocks:

  1. The live ISO automatically assumes DHCP. While this is to be expected, it's a bit of a stumbling block for people without DHCP (ahem, ACM UMN server closet). To get around this, we first tell the live system the static IP

    ifconfig <dev name> xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx
    route add default gw xxx.xxx.xxx.xxx
    echo "nameserver 8.8.8.8 >> /etc/resolv.conf
    

    Then, in configuration.nix, we need to specify the same parameters.

    {
        ...
        networking.hostName = "hostname";
        networking.useDHCP = false;
        networking.defaultGateway = {
            address = "xxx.xxx.xxx.xxx"
            interface = "eth0";
        }
        networking.interfaces.eth0.ipv4.addresses = [{
            address = "xxx.xxx.xxx.xxx";
            prefixLength = 24;
        }];
        networking.nameservers = [ "8.8.8.8" "8.8.4.4" ];
        ...
    }
    
  2. Early KMS - early KMS, where the display driver and KMS is initialized during the initramfs stage, has some benefits in terms of laptop power savings, DRI2, and some alleged kernel space power savings. To enable early KMS on a NixOS configuration, edit configuration.nix

    ...
    boot.initrd.availableKernelModules = [ "i915" ];
    boot.initrd.kernelModules = [ "i915" ];
    ...
    

    Note that i915 is the Intel kernel module! Do lsmod to investigate what modules you need rather than blindly using i915!

Even more to talk about

There is a lot to the Nix ecosystem, as you can see from the trinity at the top of the post. We've only scratched the surface of NixOS! Not the Nix ecosystem, just one piece of it. I really do encourage you to try it out on your own, and do stay tuned for my NixOS updates!

Til next time,

r/l/s