Display contact info in NixOS boot stage 1

I’d like to print my contact info in case someone finds my laptop and turns it on. (I know, a physical sticker would be a better idea :yum: - but I’m a geek…)
It would need to happen in (before?) stage 1 before the disk encryption password entry.

I thought to patch the stage-1-init.sh - but how can I use a patched thing (somehow related to system.build I guess?)

… and - is it a bad idea? :sweat_smile:

2 Likes

You can just add something like this to configuration.nix

boot.initrd.preDeviceCommands = ''
  echo I am tennox
'';

Though this won’t work with systemd initrd. For that, it’s trickier because systemd owns the console instead of PID 1 just being a shell script.

In either case, I’d be tempted to make a plymouth theme that displays this stuff. That way you could even have it display a qr code with all the relevant information in it.

3 Likes

Thanks, preDeviceCommands gets the job done:

Perhaps there should be a dedicated option for displaying messages at the top.

3 Likes

Amazing! Thanks for the quick reply & easy solution :heart:
(sorry for taking long to reply :sweat_smile:)

boot.initrd.preDeviceCommands = ''
 echo -e "If found, please contact:\nManuel ...\n+49...\nemail@domain.org" \
   | ${pkgs.neo-cowsay}/bin/cowsay --bold --aurora -f dragon
'';
4 Likes

How did you do the frame and indentation?

1 Like

The frame is box-drawing characters, for now just in a string literal e.g.:

info '┌─────────┐'
info '│ Example │'
info '└─────────┘'

I’d prefer to do it programmatically but haven’t looked into that yet.

1 Like

Got a framing function now, used here.

2 Likes

This is so cute. Thank you for this.

1 Like