aboutsummaryrefslogtreecommitdiff
path: root/snowfall/modules/nixos/system/default.nix
blob: 9fa39021453979b4348e4d79a7be2c089d5d76ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{ options, config, lib, namespace, ... }:

with lib; with lib.${namespace}; let
  cfg = config.${namespace}.system;
in {
  options.${namespace}.system = with types; {
    hostname = mkOption {
      type = strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
    };

    id = mkOption {
      default = null;
      type = nullOr str;
    };
  };

  config = {
    networking.hostName = cfg.hostname;
    networking.hostId = cfg.id;
  };
}