Update-motd for NixOS

NixOS doesn’t seem to have dynamic motd support similar to update-motd on Ubuntu, where a set of scripts are run every time a user logs in to generate the motd for that user.

Am I correct that this does not currently exist in NixOS and if not could such a thing be implemented? I’m willing to try to work on such a feature but I’m not very familiar with PAM, so any suggestions or pointers are welcome.

It’s not entirely unsupported, though not shown in NixOS search for some reason: https://github.com/NixOS/nixpkgs/blob/880992dcc006a5e00dd0591446fdf723e6a51a64/nixos/modules/security/pam.nix#L1434

i.e., you can get a non-static file on the file system that you can dynamically update by whatever mechanism you prefer to change the message being shown.

There’s no predefined method for updating it, though, which appears to be what you’re looking for. I think the module I linked is where you’d get started on creating such. I wonder if a nice systemd-ey way using dependencies on user@.service would be possible.