diff options
author | Ethel Morgan <eth@ethulhu.co.uk> | 2020-07-01 19:43:25 +0100 |
---|---|---|
committer | Ethel Morgan <eth@ethulhu.co.uk> | 2020-07-01 19:43:25 +0100 |
commit | 20d330276d1618e5c58e53eda03d25e58e042b2b (patch) | |
tree | 2ea5ca81e03bcf4a9c97f3b590257ed38ad6a5ad | |
parent | 36a2b1aeace22517b396d9ff502fa532d173cac0 (diff) |
add an abstraction over location
Diffstat (limited to '')
-rw-r--r-- | nixos/modules/location.nix | 24 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/nixos/modules/location.nix b/nixos/modules/location.nix new file mode 100644 index 0000000..a99aaa7 --- /dev/null +++ b/nixos/modules/location.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: +with lib; + +let + cfg = config.eth; + + locations = { + London = { + latitude = 51.5074; + longitude = 0.1278; + }; + }; + +in { + options.eth.location = mkOption { + type = types.nullOr (types.enum (builtins.attrNames locations)); + default = null; + description = "City name."; + }; + + config = mkIf (cfg.location != null) { + location = locations.${cfg.location}; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b0d788c..92b2cf6 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -2,6 +2,7 @@ ./hardware/keyboard.nix ./hardware/linode.nix ./hardware/yubikey.nix + ./location.nix ./nix.nix ./programs/dwm.nix ./services/ambience.nix |