2023-03-08 23:11:59 +01:00
|
|
|
{ lib, pkgs, config, ...}:
|
|
|
|
let
|
|
|
|
inherit (lib) mkOption types;
|
|
|
|
inherit (pkgs.liminix.services) oneshot;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
hostname = mkOption {
|
2023-08-12 22:13:22 +02:00
|
|
|
description = ''
|
|
|
|
System hostname of the device, as returned by gethostname(2). May or
|
|
|
|
may not correspond to any name it's reachable at on any network.
|
|
|
|
'';
|
2023-03-08 23:11:59 +01:00
|
|
|
default = "liminix";
|
|
|
|
type = types.nonEmptyStr;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
services.hostname = oneshot {
|
2024-09-08 00:31:15 +02:00
|
|
|
name = "hostname-${builtins.substring 0 12 (builtins.hashString "sha256" config.hostname)}";
|
2023-03-08 23:11:59 +01:00
|
|
|
up = "echo ${config.hostname} > /proc/sys/kernel/hostname";
|
|
|
|
down = "true";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|