Create nix module drumknotty which manages worblehat and dibbler for skrot. #129

Open
vegardbm wants to merge 9 commits from drumknotty into main
Owner

DrumknoTTY is a nix module that owns the screen session that skrot runs. Inside the screen session it spawns two windows and programs: dibbler and worblehat. This is essentially done to deploy worblehat. Both dibbler and worblehat each have a module that allows them to start in a screen session, but this essentially combines these two modules into one.

DrumknoTTY is a nix module that owns the screen session that skrot runs. Inside the screen session it spawns two windows and programs: dibbler and worblehat. This is essentially done to deploy worblehat. Both dibbler and worblehat each have a module that allows them to start in a screen session, but this essentially combines these two modules into one.
Author
Owner

This might also require updating some inputs such as worblehat.

This might also require updating some inputs such as worblehat.
oysteikt was assigned by vegardbm 2026-03-19 17:28:15 +01:00
oysteikt was unassigned by vegardbm 2026-03-19 17:28:23 +01:00
vegardbm requested review from Owners 2026-03-19 18:36:06 +01:00
Owner

Kan/vil du slå sammen noen commits her, typ fixupe de fix-commitene i en interactive rebase eller noe, sånn at det blir en håndfull gode commits når vi merger inn i main?

Kan/vil du slå sammen noen commits her, typ fixupe de fix-commitene i en interactive rebase eller noe, sånn at det blir en håndfull gode commits når vi merger inn i main?
Author
Owner

Jeg har allerede slått sammen en del av commitsa med en interactive rebase, men ikke så mange for det meste typos og slikt.

Jeg har allerede slått sammen en del av commitsa med en interactive rebase, men ikke så mange for det meste typos og slikt.
Author
Owner

Greien er at ting ikke egentlig funker i det hele tatt før siste commit her da, men jeg kan slå sammen sånn at man ender opp med commits som har en successful nix flake eval.

Greien er at ting ikke egentlig funker i det hele tatt før siste commit her da, men jeg kan slå sammen sånn at man ender opp med commits som har en successful nix flake eval.
Owner

Nice, ser bra ut nå! Er det denne konfigen som kjører live på skrot, eller er den ellers testet?
Vent gjerne på ordentlig oysteikt-review, men jeg ser ingen blinkende varsellys her ved gjennomlesing

Nice, ser bra ut nå! Er det denne konfigen som kjører live på skrot, eller er den ellers testet? Vent gjerne på ordentlig oysteikt-review, men jeg ser ingen blinkende varsellys her ved gjennomlesing
Author
Owner

Den kjører ikke live på skrot siden den rebygger seg tilbake til forrige versjon på natten, men jeg har spesifikt testet det på skrot ja.

Den kjører ikke live på skrot siden den rebygger seg tilbake til forrige versjon på natten, men jeg har spesifikt testet det på skrot ja.
Author
Owner

Jeg tror nok oysteikt har en del kommentarer på det her siden det i praksis dupliserer modulene til både dibbler og worblehat. Det er jo mulig å flytte kode og deuplisere, men det er et utgangspunkt som fungerer.

Jeg tror nok oysteikt har en del kommentarer på det her siden det i praksis dupliserer modulene til både dibbler og worblehat. Det er jo mulig å flytte kode og deuplisere, men det er et utgangspunkt som fungerer.
Author
Owner

Det er derimot ett problem, og det er at worblehat er default når den starter opp. Det er fordi screen alltid starter på vinduet som nyligst ble lagd, og jeg har ikke funnet ut en kommando som lar deg bestemme hvilket vindu man skal koble til først.

Det er derimot ett problem, og det er at worblehat er default når den starter opp. Det er fordi screen alltid starter på vinduet som nyligst ble lagd, og jeg har ikke funnet ut en kommando som lar deg bestemme hvilket vindu man skal koble til først.
Author
Owner

Nå skal det problemet være løst.

Nå skal det problemet være løst.
Author
Owner

Et annet problem er at screen bruker 0-indexing, noe som er upraktisk i forhold til keybinds. Det er fordi at man kan bytte mellom vinduer basert på index, og 0 og 1 er langt unna hverandre. Antakeligvis kan man konfigurere dette da.

Et annet problem er at screen bruker 0-indexing, noe som er upraktisk i forhold til keybinds. Det er fordi at man kan bytte mellom vinduer basert på index, og 0 og 1 er langt unna hverandre. Antakeligvis kan man konfigurere dette da.
oysteikt added 1 commit 2026-03-26 09:27:20 +01:00
modules/drumknotty: split into several parts
All checks were successful
Eval nix flake / evals (pull_request) Successful in 8m44s
Eval nix flake / evals (push) Successful in 9m59s
e64b75f5c5
This also fixes a few issues, such as enabling `createLocalDatabase` for
multiple programs, and wraps all the screen logic within a screenrc
file. Some assertions were also added to avoid some easy-to-make
mistakes.
oysteikt force-pushed drumknotty from 395102c182 to e64b75f5c5 2026-03-26 09:27:20 +01:00 Compare
oysteikt approved these changes 2026-03-26 09:37:15 +01:00
oysteikt left a comment
Owner

If it works in the current state, feel free to merge. The comments I left are mostly things that could be fixed later

If it works in the current state, feel free to merge. The comments I left are mostly things that could be fixed later
flake.nix Outdated
@@ -191,2 +194,4 @@
self.nixosModules.drumknotty
inputs.disko.nixosModules.disko
inputs.dibbler.nixosModules.default
inputs.worblehat.nixosModules.default
Owner

I don't think the dibbler and worblehat modules are being used anymore, now that all config is made through the drumknotty module. The overlays need to stay though

I don't think the `dibbler` and `worblehat` modules are being used anymore, now that all config is made through the drumknotty module. The overlays need to stay though
Author
Owner

Don't you just have to remove the two lines?

Don't you just have to remove the two lines?
Owner

Sure, that would fix it here at least. Not sure what to do about the leftover modules in the long run, they are kinda useful for testing but might become a pain to maintain.

Sure, that would fix it here at least. Not sure what to do about the leftover modules in the long run, they are kinda useful for testing but might become a pain to maintain.
@@ -0,0 +74,4 @@
extraGroups = [ "lp" ];
isNormalUser = true;
# TODO: make this display the error log or error message in case that
Owner

This is 100% gonna bootloop in the future, should probably be made a priority despite not being necessary.

This is 100% gonna bootloop in the future, should probably be made a priority despite not being necessary.
@@ -0,0 +166,4 @@
config = "/etc/worblehat/config.toml";
};
in lib.optionals cfg.worblehat.enable [
"screen -t worblehat ${lib.getExe cfg.worblehat.package} ${worblehatArgs} cli"
Owner

Using screen windows for now is probably fine, but it would be kinda nice at some point to add a hotkey daemon or something that would let you press a single key to toggle windows. Maybe actkbd? Then we can bind it to a numpad key or something, and add a label on top of the key to press or use the numpad that is (were?) hanging on the wall.

Using screen windows for now is probably fine, but it would be kinda nice at some point to add a hotkey daemon or something that would let you press a single key to toggle windows. Maybe `actkbd`? Then we can bind it to a numpad key or something, and add a label on top of the key to press or use the numpad that is (were?) hanging on the wall.
@@ -0,0 +95,4 @@
requiredBy = [ "drumknotty-screen-session.service" ];
before = [ "drumknotty-screen-session.service" ];
after = [ "postgresql.service" ];
Owner

You'll likely want something along the lines of restartTriggers = config.environment.etc."dibbler/dibbler.toml".source here, and for every other unit that should restart whenever the content of that file changes. Same for worblehat

You'll likely want something along the lines of `restartTriggers = config.environment.etc."dibbler/dibbler.toml".source` here, and for every other unit that should restart whenever the content of that file changes. Same for worblehat
@@ -0,0 +149,4 @@
ensureClauses.login = true;
}];
};
Owner

Should probably add some sort of unit here that handles database migrations before startup, can be done in another pr

Should probably add some sort of unit here that handles database migrations before startup, can be done in another pr
vegardbm added 1 commit 2026-03-26 11:47:06 +01:00
remove unused modules dibbler and worblehat
All checks were successful
Eval nix flake / evals (push) Successful in 8m47s
Eval nix flake / evals (pull_request) Successful in 9m57s
d3562899d4
vegardbm reviewed 2026-03-31 00:26:40 +02:00
@@ -0,0 +138,4 @@
ExecStart =
let
screenrc = let
Author
Owner

Why use screenrc? This is not necessary.

Why use screenrc? This is not necessary.
Owner

It simplified the logic quite a bit. If we want to be able to toggle worblehat/dibbler separately, we would've needed to make the command added to ExecStart conditionally worblehat or dibbler, and the same conditionals in the ExecStartPost (as not to start worblehat twice if dibbler was disabled).

By just providing the screenrc script to screen, it removes the need to shuffle head and tail between two directives. The code for generating this file could likely be improved though.

It simplified the logic quite a bit. If we want to be able to toggle worblehat/dibbler separately, we would've needed to make the command added to `ExecStart` conditionally worblehat or dibbler, and the same conditionals in the `ExecStartPost` (as not to start worblehat twice if dibbler was disabled). By just providing the screenrc script to screen, it removes the need to shuffle head and tail between two directives. The code for generating this file could likely be improved though.
Author
Owner

Ok, that is fair.

Ok, that is fair.
vegardbm marked this conversation as resolved
All checks were successful
Eval nix flake / evals (push) Successful in 8m47s
Eval nix flake / evals (pull_request) Successful in 9m57s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin drumknotty:drumknotty
git checkout drumknotty
Sign in to join this conversation.