2024-04-06 21:05:17 +00:00
|
|
|
{ config, lib, pkgs, sources, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
self = sources.self;
|
|
|
|
|
2024-04-19 01:38:50 +00:00
|
|
|
formatDate = date: with lib.strings;
|
2024-04-06 21:05:17 +00:00
|
|
|
let
|
2024-04-19 01:38:50 +00:00
|
|
|
year = substring 0 4 date;
|
|
|
|
month = substring 4 2 date;
|
|
|
|
day = substring 6 2 date;
|
|
|
|
hour = substring 8 2 date;
|
|
|
|
minute = substring 10 2 date;
|
|
|
|
second = substring 12 2 date;
|
2024-04-06 21:05:17 +00:00
|
|
|
in
|
|
|
|
"${year}-${month}-${day} ${hour}:${minute}:${second} UTC";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
system.nixos.label = "${config.system.nixos.release}-haccfiles-${self.shortRev or self.dirtyShortRev}";
|
|
|
|
users.motd = ''
|
|
|
|
Welcome to ${config.networking.hostName}, running NixOS ${config.system.nixos.release}!
|
|
|
|
Built from haccfiles ${self.rev or self.dirtyRev}.
|
|
|
|
Last commit was at ${formatDate self.lastModifiedDate}.
|
|
|
|
${if self ? dirtyRev then "\nPlease remember to commit your changes.\n" else ""}
|
|
|
|
'';
|
2024-04-07 14:30:57 +00:00
|
|
|
|
|
|
|
# used by monit
|
|
|
|
environment.etc."haccfiles-commit".text = self.rev or self.dirtyRev;
|
2024-05-02 20:33:47 +00:00
|
|
|
environment.etc."haccfiles-timestamp".text = builtins.toString self.lastModified;
|
2024-04-06 21:05:17 +00:00
|
|
|
}
|