diary @ telent

Can I speak to your supervisor?#

Fri Oct 30 16:22:36 2020

Topics: nix nixwrt lua

When we left off last time I was teasing some words abut L2TP ("PPP over the internet") and how it would let me test the actual routing/gatewaying/firewalling etc in NixWRT without breaking the internet access for everyone else in the house.

That's part of what I've been doing since though not exactly all of it. Mostly I have been drowing in alphabet soup.

Clearly, there are a number of dependencies here (and not forgetting you can't even start the process until you have a transport interface configured for the l2tp to be tunneled over), and modeling these dependencies in Monit was becoming a bit unwieldy. I'm not 100% sure that writing a whole new service supervision system in Lua will be net better, but that's what I've set out to do and early signs are promising. Two sentence summary:

It's very much WIP. If I can arrive at a general design that will let me cleanly address (1) the case above; (2) l2tp over lte modem as backup for pppoe; (3) automatically recovering from a buggy ethernet driver/device that panics under heavy load, I will tentatively conclude that it is a good piece of software.

In other news, I have revived (more accurately, rewritten) the QEMU target for NixWRT so now you (and I) can build and run it without access to real hardware. I am only mildly infuriated that QEMU doesn't appear to support device trees on MIPS (or perhaps it does but the Malta MIPS subarch init code doesn't know how to load the dtb that QEMU passes) but it hasn't added a whole lot of complexity to the build to have one target without. See the instructions in the README

If I get much more fed up of having to build a new image and reboot qemu every time I move the bugs around in my Lua scripts, I may also look into adding 9p support so that the emulator can read its root fs direct from the host.

Advent of Blogpost#

Tue Dec 1 20:20:05 2020

Topics: android nix

Trying something new: a blog post for every day between now and Christmas. They will necessarily be a bit shorter and even less polished than the usual ones.

Day 1: internet music streaming for people who'd rather own their music than rent it.

I have ~ 200GB of files in /srv/media/music on my desktop PC, most of it from a massive CD ripping exercise about ten years ago, and I'd like to be able to listen to it from anywhere in the house (at minimum) or on the internet (ideally). I accomplish this using Airsonic - a "free, web-based media streamer, providing ubiquitous access to your music", coupled with Audinaut - an Android app to "stream music from Subsonic-compatible servers."

Airsonic is in Nixpkgs and there's a Nixos module for it. Audinaut is in the F-droid repo and apparently also in the Play Store

    services.airsonic = {
      enable = true;
      virtualHost = "muisc.telent.net";
      listenAddress = "0.0.0.0";
      contextPath = "/";
      maxMemory = 500;
    };
    services.nginx.virtualHosts."muisc.telent.net".enableACME = true;
    services.nginx.virtualHosts."muisc.telent.net".forceSSL = true;

but you should note that it relies on its own stateful database of some kind ( don't know what exactly, haven't dug into it) for configuration, so you have to set that stuff up by hand outside of Nix.

One caveat with Airsonic is, per the documentation:

Also note that Airsonic will organize your music according to how they are organized on your disk. Unlike many other music applications, Airsonic does not organize the music according to the tag information embedded in the files. (It does, however, also read the tags for presentation and search purposes.)
Consequently, it’s recommended that the music folders you add to Airsonic are organized in an “artist/album/song” manner. There are music managers, like MediaMonkey, that can help you achieve this.

My music collection didn't quite conform to this convention. The bulk of it was in flac/artistname-albumname, a bunch of other albums were in mp3/artist/album, and then the "long tail" included files in Songbird, annabelle, very_old_mp3_player and from_usb_stick. I straightened it all out using beets which describes itself as "the media library management system for obsessive-compulsive music geeks." but also works very nicely as a media library management system for entirely neurotypical (as far as I know) computer geeks who have a significant collection of music just because they've been buying CDs for a long time. I configured it approximately thus:

[dan@loaclhost:~]$ cat .config/beets/config.yaml
directory: /srv/media/music-new
library: /home/dan/beets-library.db
import:
  copy: no
  move: yes
  write: no
  strong_rec_thresh: 0.10
plugins: chroma web fromfilename fetchart duplicates
strong_rec_thresh: 0.10
match:
  preferred:
    countries: ['GB|UK', 'US']
fetchart:
  auto: yes

and then cd /srv/media/music-old && beet import .. Do this inside of tmux, because it takes ages and asks a lot of questions.

Tomorrow I'll talk about sniproxy which is how, with one static IPv4 address but a bazillion IPv6 addresses but a mobile phone network that doesn't support IPv6 (this is the UK. None of them do) I can make my music server visible outside of the house.