summaryrefslogtreecommitdiff
path: root/nixos/modules/location.nix
diff options
context:
space:
mode:
authorEthel Morgan <eth@ethulhu.co.uk>2020-07-01 19:43:25 +0100
committerEthel Morgan <eth@ethulhu.co.uk>2020-07-01 19:43:25 +0100
commit20d330276d1618e5c58e53eda03d25e58e042b2b (patch)
tree2ea5ca81e03bcf4a9c97f3b590257ed38ad6a5ad /nixos/modules/location.nix
parent36a2b1aeace22517b396d9ff502fa532d173cac0 (diff)
add an abstraction over location
Diffstat (limited to '')
-rw-r--r--nixos/modules/location.nix24
1 files changed, 24 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};
+ };
+}