{ pkgs
, lib
, config
, ... }: with lib; let
  cfg = config.global.id;
in {
  options.global.id = mkOption {
    type = with types; str;
    description = "systemd machine id";
  };

  config = {
    environment.etc.machine-id.text = cfg + "\n";
    networking.hostId = substring 0 8 cfg;
  };
}
