liminix/modules/hostname.nix
catvayor 7eff028b02
All checks were successful
build liminix / build_zyxel-nwa50ax_mips (pull_request) Successful in 19s
build liminix / build_vm_qemu_mips (pull_request) Successful in 20s
build liminix / test_shell_customization (pull_request) Successful in 20s
build liminix / test_hostapd (pull_request) Successful in 21s
fix: hostname at early boot
2024-10-04 11:21:46 +02:00

31 lines
773 B
Nix

{ lib, pkgs, config, ...}:
let
inherit (lib) mkOption types;
in {
options = {
hostname = mkOption {
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.
'';
default = "liminix";
type = types.nonEmptyStr;
};
hostname-script = mkOption {
description = ''
Script that outputs the system hostname on stdin.
'';
default = pkgs.writeScript "hostname-gen" ''
#!/bin/sh
echo ${config.hostname}
'';
defaultText = ''
pkgs.writeScript "hostname-gen" '''
#!/bin/sh
echo ''${config.hostname}
'''
'';
type = types.package;
};
};
}