Skip to content

February 2023#

Tuesday, 28#

ListenBrainz#

I’m back on ListenBrainz. Gotta put some trust in this open-source / open data solution for music tracking and personalized recommendations.

zig-gir-ffi#

Added support for emitting global constants. Refactored the code for handling types.

Storing what would normally be local variables inside the output structs bothers me, though.

Zigmod#

I’ve started working on a more generic builder for Zigmod packages in Nixpkgs, but the Gist dependency (which already was a red flag in itself) of Zigmod has been deleted recently. Seems like taken down by GitHub staff.

don’t put all your eggs in one basket

Monday, 27#

Counter-Strike: Source#

Played my favorite game (the Zombie Escape mode) for the first time in a long time. Learned about gamemode. Fonts are scuffed on the Linux version, though. And my network stability has been atrocious.

Every Noise at Once#

Every Noise at Once is amazing. It’s a rabbit hole of the music world.

Besides the map, they also have other subsites. Here’s a few I would recommend checking out:

Definitely click that Scan button and give it a shot!

Sunday, 26#

zig-gir-ffi#

Done more refactoring. Reduced the number of repeated parameters by generalizing EmitRequest into Repository.

Implemented casting (there are still some edge cases left, e.g., arrays of interfaces).

Stopped at implementing support for global constants. Gotta deal with these pesky bare unions.

Saturday, 25#

zig-gir-ffi#

Done lots of refactoring today.

Most of the changes I did can be described by the following reflection:

It should probably be refactored if you have to write a comment that isn’t a docstring. Every new line of comments increases this probability.

Reflections on 10,000 Hours of Programming

More on this in the Linux kernel coding style:

Friday, 24#

Noita#

Learned how to use Lutris today, played Noita using it. Enjoyed the game very much.

Thursday, 23#

Dwarf Fortress#

Wanted to buy the Steam version of Dwarf Fortress today (and to try it with the Proton-GE runtime on NixOS). That’s somewhat tricky to do in Russia. I tried to do it via Qiwi‘s Steam Kazakhstan option, but apparently the Steam store is down right now because of the new Sons Of The Forest game. What a coincidence. And I haven’t been playing games in a long while.

Wednesday, 22#

Git#

Apparently, you can fetch a single commit from a repo (source):

git init
git remote add origin $URL
git fetch --depth 1 origin $SHA1
git checkout FETCH_HEAD

Zigmod#

Added a script for generating the list of dependencies.

Thinking that it’s better to do it like that than packaging the whole dependency tree in Nixpkgs.

Tuesday, 21#

zig-gir-ffi#

Added a Nix flake. This required me to somehow address the fact that there is no /usr/share on Nix based systems. I decided to traverse XDG_DATA_DIRS paths as a solution.

Monday, 20#

Objectivism#

Poking around some topics in an interest to know how objectivism would apply to them.

Issues like

  • Poverty, medical care, etc.
  • Altruism vs. charity
  • Communism vs. social betterment

There are a lot of interpretations (and misinterpretations) around these and many other topics applied to this philosophy. It seems to me, though, that the answers are mostly common sense.

Sunday, 19#

direnv#

Okay, I guess I will just have tooling available globally instead of specifying it in flakes. This solves an issue with forks (like nixpkgs) where it’s often inconvenient to add extra files that are not covered by a .gitignore.

Zigmod#

Created a PR for adding Zigmod to nixpkgs.

It’s a package manager for Zig that I use. The official one is in the works, though!

Shout-out to Meghan, by the way. She created Zigmod and also inspired this very journal!

Saturday, 18#

direnv#

Set up direnv and nix-direnv today for the first time.

I have a couple of use cases in mind for them:

  • Setting up specific versions of tools easily (Zig stable vs. nightly, for example)
  • Setting up native dependencies easily
  • Making builds more reproducible

I’ve created a flake for this very site. I’ve also set up CI/CD using Nix (which turned out to be somewhat more complicated than I thought).

Wezterm#

Solved the mystery with the disappearing cursor that bugged me since I installed NixOS for the first time. Just gotta set the XCURSOR_THEME variable to your theme (Adwaita in my case).

Friday, 17#

Nixpkgs#

My first ever pull request to Nixpkgs got merged this night. I am officially one of the maintainers and a member of the organization now!

Objectivism#

Watched the “Introduction to Objectivism, by Leonard Peikoff” lecture. It’s amazing. I correlate many of the ideas of objectivism with my own beliefs, so I am eager to dive into the works of Ayn Rand as soon as possible.

Thursday, 16#

Nix Pills#

Finished Nix Pills today. Those are good for understanding the core concepts behind basic functions used in Nixpkgs.

Star Wars#

I’ve replaced the “Hello there!” and “Unlimited power!” clips on Odysee with SDR versions (different release). That way, you can watch it on mobile devices, too.

Wednesday, 15#

core-js#

The story of the core-js‘s maintainer is horrifying.

As an open source developer myself, I will most likely have similar problems in terms of monetary income. The current plan is to seek a job in the field which would allow me to work on open source on a side. I strongly believe in Trade Free‘s take on this:

The ones who offer, should not ask anything in return. The ones who receive, should not have to give anything in return.

Some of the LiberaManifesto‘s takes are relatable, too:

We owe you nothing. You owe us nothing.

This is why I would probably hesitate from any kind of donations on my projects. But to make that work, a traditional job seems to be the only viable choice. I’m not yet sure startups are worth the risk, even though they give much more freedom.

Maniac#

In other news, the Maniac series are pretty good. Silly at times, but it’s good silly. Why aren’t they more popular, though?

And I still don’t understand why are they called Maniac (besides being based on other series of the same name).

Star Wars#

Preparing the “Hello there!” and “Unlimited power!” clips today, so I can link to them on my about page.

One of the features that I miss from ĀµTorrent while using qBittorrent is media streaming. It allows one to seek a video file while it is being sequentially downloaded, and by doing so changing what part of the file is being downloaded. This is very useful for extracting small clips out of big releases that are otherwise too big to download in the whole.

Today I used WebTorrent for the first time. It’s pretty bad, but it has support for media streaming (it is its prime feature). Using it, I was able to

  • Find the timestamps of the scenes in a smaller release by seeking it while it is being downloaded
  • Find the same scenes in a 4K release while it is also being downloaded

Then, I was able to extract the scenes from a partially downloaded file via FFmpeg:

ffmpeg -y -ss 01:14:40 -i input.mkv -t 40 -c copy -map 0 "cut.mkv"

After that, I did a more precise cut, splitting on I-frames, as I described here. Turns out chapters and subtitles can make the duration of the resulting file longer, so I have added a note about that.

Also, apparently LBRY’s player converts HDR to SDR just fine (Odysee’s grays it out, though).

Tuesday, 14#

LBRY#

You have to transcode audio from Dolby AC-3 to AAC before uploading to LBRY, otherwise there will be no sound.

I would recommend the FDK AAC codec.

lbry-desktop#

Updated my no blacklist fork to version 0.53.9.

Leave No Trace#

Transcoding “Leave No Trace” extras today.

Uploaded them on YouTube and LBRY.

Nixpkgs#

If you want to nix develop a package and your unpackPhase fails with something like

<...>
cp: cannot create regular file 'source/<hash>-source/<file>': Permission denied
<...>
do not know how to unpack source archive /nix/store/<hash>-source

that’s probably because the unpacker wanted to unpack the source directory, but the source directory wasn’t empty. It creates a directory inside, but if there are other directories, it won’t be sure what to unpack.

You can fix this by adding

preUnpack = ''
  rm -rf source
'';

to your Nix expression.

Transmission#

I am somewhat impressed that Transmission developers have created native clients for all major platforms. That’s something I thought was really cool but also pretty hard to do in general.

I still prefer qBittorrent, though.

Monday, 13#

Anytype#

Got an invite to Anytype‘s Alpha Program today. You know… after two years of signing up for it, or something like that.

And yeah, it’s basically Notion. And also an Electron app. I don’t really have any use for it right now.

Home Manager#

I found out that Home Manager doesn’t trigger package rebuilds on changing overlay attributes. Just as a user package does, it also binds packages to the garbage collector root that is attached to the currently running session (check with nix-store --query --roots). However, since a rebuild didn’t happen, it reuses the built version in the store. Hence, you cannot apply changes until you reboot and garbage collect (via sudo nix-collect-garbage) again.

This might be a case against putting packages in home.packages instead of users.users.<name>.packages.

NixOS#

Moved to NixOS completely. Silverblue is gone.

Nixpkgs#

More missing packages:

Also, a package for Tracy is missing a desktop file.

Subtitle Edit#

Added a desktop file to the package. Learned how to use icoutils for extracting icons from Windows executables. nixpkgs also provide the makeDesktopItem function which makes creating desktop files easier.

Sunday, 12#

NixOS#

Adding more packages to my configuration today, preparing to nuke Silverblue‘s partitions.

Stumbled on a couple of issues with the packages:

Subtitle Edit#

I’ve created a PR this night to nixpkgs.

Saturday, 11#

Git#

Rant time: there is no way to update a repo from a shallow clone.

Welp, gotta git fetch --unshallow upstream master the nixpkgs repo for a few hours now…

Subtitle Edit#

Seems like Subtitle Edit requires .NET Framework 4.8. This is problematic since Nixpkgs switched to .NET 6.0 as the default (LTS) version, which is incompatible with the Framework one. buildDotfileModule wouldn’t work, and I’m unsure how to fetch proper NuGet dependencies for buildDotfilePackage. There is no passthru.fetch-deps in the latter one.

I switched to the backup plan of wrapping with Mono.

DllImport#

Some gotcha I found out: you probably should not add lib in front of a library when using DllImport. An example of that in the Subtitle Edit’s code:

[DllImport("libhunspell")]
[DllImport("mpv", CallingConvention = CallingConvention.Cdecl)]

The application would find libmpv in the LD_LIBRARY_PATH, but would ignore libhunspell. A workaround for that is to add a symbolic link to the library’s shared object to the directory from which the application is loaded:

ln -s ${hunspell.out}/lib/libhunspell*.so $out/bin/libhunspell.so

That’s described here and here.

Friday, 10#

Git#

To quickly fetch a branch of the upstream repo in a fork, run

git remote add upstream $UPSTREAM_REPO
git fetch --depth $DEPTH upstream $REMOTE_BRANCH:$LOCAL_BRANCH
git checkout $LOCAL_BRANCH

Subtitle Edit#

Trying to package Subtitle Edit today. Downloading from the cache is painfully slow… I’m not sure whether building it using the buildDotfileModule function will work, but I’d like to try that first instead of wrapping the executable from the portable version with Mono.

I need this program to run OCR on picture-based subtitles (dvdsub, specifically).

Thursday, 9#

Nixpkgs#

Reading the Nixpkgs manual today.

Wednesday, 8#

Fish#

You can immediately incorporate history changes from other sessions of the Fish shell via history merge. That’s something I wanted for a long time but thought was not available. Here is a thread with examples on automating the synchronization if necessary.

Nix#

Reading the Nix manual today.

Tuesday, 7#

Leave No Trace#

Even though the movie is mostly about struggles with PTSD, I really like its seemingly (intentional?) anti-societal message. Or, rather, that it propagates a more non-conformal and down-to-earth approach to human relationships rather than the one cultivated by contemporary culture.

So You Want to Be a Wizard#

Julia Evans’s “So you want to be a wizard” talk is pretty inspiring. She has a blog and she publishes computer zines at Wizard Zines. There’s an accompanying zine to that talk, and the “The Pocket Guide to Debugging” one is a good overview of practical approaches for debugging.

Monday, 6#

mpv#

Okay, if you don’t want your movie evening ruined like it is now for me, change the mpv‘s hwdec setting to auto instead of auto-safe. For some reason, in the latter variant, the player doesn’t pick up the dav1d (AV1) decoder automatically.

Reflections on a decade of coding#

Reading Jamie Brandon‘s “Reflections on a decade of coding” today.

While I’m going through that, I would like to point out two very general pieces of advice I try to use everywhere in my life, especially in software development:

  1. Be pragmatic
  2. Be curious

Sunday, 5#

*Arrs#

Last night, while trying to fall asleep, I found out that I missed the beginning of the new season of The Owl House… which started 4 months ago. So, today I set up Sonarr and Prowlarr to make missing shows a thing of the past. I would recommend the wiki and TRaSH Guides if you’d like to have an automated way to get the newest episodes of the shows. Make sure to check out variants for other media types, too!

Make sure you got the permissions right, though, I spent some time dealing with that. There is also a nuance with the public indexers lying about the number of seeds, so that’s something you might need to address, too.

Saturday, 4#

NixOS#

A bit more configuration done.

Friday, 3#

NixOS#

Okay, added lots of packages. Definitely struggled with overlays for a while, but I figured it out.

Here‘s a good example of a simple config.

This entry is committed from the new OS!

Thursday, 2#

NixOS#

I added support for secrets in my configuration via sops-nix, ssh-to-age, sops, and age.

Create an Ed25519 SSH key if you don’t have one yet:

ssh-keygen -t ed25519 -C "<email>"

Derive an age key from the SSH key:

mkdir -p ~/.config/sops/age
read -s SSH_TO_AGE_PASSPHRASE; export SSH_TO_AGE_PASSPHRASE
go run github.com/Mic92/ssh-to-age/cmd/ssh-to-age@latest -i ~/.ssh/id_ed25519.pub
go run github.com/Mic92/ssh-to-age/cmd/ssh-to-age@latest -private-key -i ~/.ssh/id_ed25519 -o ~/.config/sops/age/keys.txt

Test the age key:

echo "Hello there!" > test
age -e -r "<public key>" test > test.age
age -d -i ~/.config/sops/age/keys.txt test.age

.sops.yaml:

keys:
  - &age-key <public key>
creation_rules:
  - path_regex: ^secrets.yaml$
    key_groups:
      - age:
          - *age-key

Create / edit secrets via sops secrets.yaml.

Wednesday, 1#

NixOS#

Aight, there is much configuration to do. I’ve installed NixOS on the disk since I couldn’t build QuiteRSS from source in a virtual machine. Ironically, I couldn’t do that on a real machine either. Gonna look out for a replacement (NewsFlash, most likely).

On a related note, I have an unfinished project for my own RSS reader called Tidings.

Plex#

You can start a Plex server in a container with

sudo podman run \
  -d \
  --name plex \
  --network=host \
  -e TZ="<timezone>" \
  -v /path/to/database:/config:Z \
  -v /path/to/transcode:/transcode:Z \
  -v /path/to/data:/data:Z \
  docker.io/plexinc/pms-docker

The Web interface is at http://localhost:32400/web. Make sure the directories have sufficient privileges. See more info about the image here.