diff --git a/machine/backyard/default.nix b/machine/backyard/default.nix index 2720ae6..01bdcf6 100644 --- a/machine/backyard/default.nix +++ b/machine/backyard/default.nix @@ -17,14 +17,6 @@ # Enable networking networking.networkmanager.enable = true; - # Set your time zone. - time.timeZone = "UTC"; - - services.ntp = { - enable = true; - servers = [ "time.nist.gov" ]; - }; - # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; diff --git a/modules/beatific.nix b/modules/beatific.nix index c248743..2d0c366 100644 --- a/modules/beatific.nix +++ b/modules/beatific.nix @@ -1,18 +1,34 @@ { config, lib, pkgs, ... }: let - inherit (lib) mkOption types; + inherit (lib) mkIf mkMerge mkOption types; cfg = config.beatific; in { options = { - beatific.hostName = mkOption { - type = types.str; - description = "Hostname"; + beatific = { + hostName = mkOption { + type = types.str; + description = "Hostname"; + }; + + defaults = { + time = mkOption { + type = types.bool; + description = "Default time zone and NTP"; + default = true; + }; + }; }; }; - config = let - in { - networking.hostName = cfg.hostName; - }; + config = mkMerge [ + { + networking.hostName = cfg.hostName; + } + (mkIf cfg.defaults.time { + time.timeZone = "UTC"; + services.ntp.enable = true; + services.ntp.servers = [ "time.nist.gov" ]; + }) + ]; }