aboutsummaryrefslogtreecommitdiff
path: root/snowfall/modules/nixos/system/default.nix
blob: 96c5654b7144044db9aaa6715d53b37540e14312 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ 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;
    };

    timezone = mkOption {
      default = "America/Los_Angeles";
      type = nullOr str;
    };
  };

  config = {
    nix.settings.experimental-features = [ "nix-command" "flakes" ];
  
    networking.hostName = cfg.hostname;
    networking.hostId = cfg.id;

    time.timeZone = cfg.timezone;
  };
}