HomeUpSign my Guestbook!RSS • Published: 2026-04-16

Minis


Random things I wanna write down

2026🔗

2026-05🔗

2026-05-01🔗

  1. How well does the Nix Store Block deduplicate (Man)?

    I’m on ZFS, it is generally stated that deduplication is for very specific workloads and has way too much overhead otherwise. It actually still has overhead even after you turn it off, because until all the blocks written with deduplication are gone, the table remains.

    Nonetheless just out of curiosity, since Nix already does deduplication (both in and out of band) using hard-links, and compresses incredibly well, maybe the ratio would be decent.

    Btw, Nix? Why is it just called “optimisation” of the Store? That’s really not descriptive. In any case Nix basically takes every file and just makes it a hard link to /nix/store/.links/<checksum-of-file> so files with the same checksum are hard-linked to the same data on disk. They can do this since the story is more or less write-only.

    1. So, we start with 111G of Nix Store (I recently did a GC).

      mindpool/nix 111G 165G 111G legacy

    2. Make a snapshot.

      sudo zfs snap mindpool/nix@experiment

      mindpool/nix@experiment 659K - 111G -

    3. Now for the sacrilegious part.

      sudo zfs send -Lce mindpool/nix@experiment | sudo zfs receive -o dedup=on blackpool/experiment

    I absolutely should’ve used a zfs checkpoint for this… and I could’ve used zsb -S… and a pool inside a file… meh.

    And we landed on a whopping 1.35x dedupratio, very very far from what I’ve read starts to be worth the effort.

    1. BTRFS Deduplication

      Little sidenote on BTRFS’s dedupe, as far as I can tell (and that I used) it’s out-of-band. So you write files normally and then afterwards the user can run (optionally periodically or in the background as a daemon) a program that scans through BTRFS’s extents and tells BTRFS which blocks should be merged. BTRFS does of course verify this claim by checking the blocks are actually the same. Though apparently it can sometimes not play nice with BTRFS’s own administration when moving around blocks.

      This is interesting, perhaps more useful to people that need faster writes, and a different approach I thought was worth mentioning.

    2. copies=N

      I seem to have left copies on 2, which stores multiple copies of the same blocks on one disk. It I guess protects from bitrot? This was once upon a time supposed to be a pure backup disk. This interesting thread changed my opinions on a few things. And a two posts testing it practically. I’ll stick to RAID for stuff, maybe save for writing to CDs.

2026-04🔗

2026-04-29🔗

  1. At my first glance, UVM seems like the hardware people just discovered OOP

2026-04-27🔗

  1. --donotask

    • What I saw: --do-no-task
    • What the docs meant: --do-not-ask

2026-04-21🔗

  1. Unix Lossage

    Back when reading the Unix Hater’s Handbook I learnt a fun little term “Unix Lossage”. It might mean various things to various people, however I’ll use it to generally mean when I accidentally burn time or money due to something I don’t think is entirely my fault.

    My First two examples were:

    • cat, less, grep, find and many other commands behave like variadics and just list or operate on one file after another. xxd however… does not do that, it’s signature is xxd [options] [infile [outfile]]. Which means that if you use it like the others, xxd file.txt bar.txt your second file gets irretrievably overwritten. Now, luckily I do have very good backups so something like this didn’t set me back but the fact that one has to guess because every program has its own way of interpreting its arguments is something I’m not exactly happy with.
    • a vs. a/ is interpreted weirdly differently by different programs

2026-04-16🔗

  1. Using Org-Mode

    Trying out Org-Mode after a while, will try to use it for minis, as that’s probably the simplest way to start gradually.

    It should also allow me to easily include:

    • tables even in the middle of lists

      AB
      1with links
      34
      56
      scriptssuperdoublesubα
      Footnotes1
    • equations $$ \sum_{0}^{\inf} \frac{1}{k^2} $$

2026-03🔗

2026-03-14🔗

  1. @ Syntax

    Ada has a neat syntax since 2021.

    X := @ * 2;
    

    The @ always signifies the LHS of the assignment. Even in more complex situations like this:

    Cursor(3, Next) := @ * 2 + Sqrt(@);
    

    It’s a very nice way of doing all the +=, *=, |=, <<=, etc. which seems slightly more readable to me, for the basic cases I still learnt to see :=@+ as a +=, and in the more complex expressions where you don’t actually want to just have the final operation be + the old value, it comes in way more handy.

    Ofc doing this with macros is trivial.

  2. OCaml has curried keywords

    I spoke about keywords improving readability in an older post.

    And actually found something that does it close to what I described.

    OCaml calls it “Labelled Arguments”:

    # let add ~x ~y = x + y;;
    val add : x:int -> y:int -> int = <fun>
    
    # add ~x:2 ~y:4;;
    - : int = 6
    
    # add ~y:2 ~x:5;;
    - : int = 7
    
    # add ~y:4;;
    - : x:int -> int = <fun>
    

    Sadly you can’t do something like add ~x to remove the label from the argument, it’s a labelled argument, it’s a different type and that’s that unless you wrap it in a lambda.

    They also have an interesting approach to optional arguments, where you can just skip over them when applying a later label? This of course means you need a sentinel value if there are no non-optional arguments and also that optional arguments come first rather than last.

2026-03-07🔗

  1. CFFI Struct Vectors

    (asdf:load-system :cffi)
    
    (cffi:defcstruct point
      (x :int)
      (y :int))
    
    (cffi:with-foreign-object (vec '(:struct point) 4)
      (loop
        :with idx := 0
        :for i :to 4
        :do
           (cffi:with-foreign-slots 
             ((x y)
              (cffi:mem-aptr vec '(:struct point) i)
              (:struct point))
             (setf
              x (incf idx)
              y (incf idx))))
      (sb-vm:hexdump vec))
    

Footnotes🔗

1 Of Quality