set hostname before dhcp client runs

This commit is contained in:
Daniel Barlow
2023-03-08 22:11:59 +00:00
parent 2318c54037
commit 91c0147919
4 changed files with 30 additions and 5 deletions

19
modules/hostname.nix Normal file
View File

@@ -0,0 +1,19 @@
{ lib, pkgs, config, ...}:
let
inherit (lib) mkOption types;
inherit (pkgs.liminix.services) oneshot;
in {
options = {
hostname = mkOption {
default = "liminix";
type = types.nonEmptyStr;
};
};
config = {
services.hostname = oneshot {
name = "hostname";
up = "echo ${config.hostname} > /proc/sys/kernel/hostname";
down = "true";
};
};
}