From c9864074f9f8dc4cb6cd7119a3356d219765d2ff Mon Sep 17 00:00:00 2001 From: winston Date: Sun, 18 Feb 2024 13:49:48 +0100 Subject: [PATCH] refactor: better macOS exclusive options --- machines/common/darwin/default.nix | 1 + machines/common/darwin/options.nix | 8 ++++++++ machines/lib.nix | 8 -------- 3 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 machines/common/darwin/options.nix diff --git a/machines/common/darwin/default.nix b/machines/common/darwin/default.nix index 9471184..b616dc7 100644 --- a/machines/common/darwin/default.nix +++ b/machines/common/darwin/default.nix @@ -1,4 +1,5 @@ {lib, ...}: { + imports = [./options.nix]; # manipulate the global /etc/zshenv for PATH, etc. programs.zsh.enable = true; diff --git a/machines/common/darwin/options.nix b/machines/common/darwin/options.nix new file mode 100644 index 0000000..7b08a6a --- /dev/null +++ b/machines/common/darwin/options.nix @@ -0,0 +1,8 @@ +{lib, ...}: let + inherit (lib) mkOption types; +in { + options.location = { + latitude = mkOption {type = types.nullOr types.float;}; + longitude = mkOption {type = types.nullOr types.float;}; + }; +} diff --git a/machines/lib.nix b/machines/lib.nix index 3bc3112..66a7ec3 100644 --- a/machines/lib.nix +++ b/machines/lib.nix @@ -74,14 +74,6 @@ ./${host} home-manager.${module}.home-manager ] - ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ - { - options.location = { - latitude = mkOption {type = types.nullOr types.float;}; - longitude = mkOption {type = types.nullOr types.float;}; - }; - } - ] ++ [(hmCommonConfig {inherit username;})] ++ extraModules; specialArgs = {inherit inputs;};