liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

hostname.nix (578B)


      1 { lib, pkgs, config, ...}:
      2 let
      3   inherit (lib) mkOption types;
      4   inherit (pkgs.liminix.services) oneshot;
      5 in {
      6   options = {
      7     hostname = mkOption {
      8       description = ''
      9         System hostname of the device, as returned by gethostname(2). May or
     10         may not correspond to any name it's reachable at on any network.
     11       '';
     12       default = "liminix";
     13       type = types.nonEmptyStr;
     14     };
     15   };
     16   config = {
     17     services.hostname = oneshot {
     18       name = "hostname";
     19       up = "echo ${config.hostname} > /proc/sys/kernel/hostname";
     20       down = "true";
     21     };
     22   };
     23 }