From 73570573632096b5da1fbe1a4c743fe66f2f7a9d Mon Sep 17 00:00:00 2001 From: Tomodachi94 Date: Wed, 4 Dec 2024 18:39:56 +0000 Subject: [PATCH] home/color-pickers: enable option, assert Darwin --- home/darwin/color-pickers/default.nix | 6 +++++- home/darwin/color-pickers/module.nix | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/home/darwin/color-pickers/default.nix b/home/darwin/color-pickers/default.nix index c50ddcc..538f09b 100644 --- a/home/darwin/color-pickers/default.nix +++ b/home/darwin/color-pickers/default.nix @@ -1,5 +1,9 @@ { pkgs, tomopkgs, ... }: { imports = [ ./module.nix ]; - home.colorPickers = [ tomopkgs.${pkgs.system}.developercolorpicker ]; + + home.colorPickers = { + enable = pkgs.stdenv.hostPlatform.isDarwin; + colorPickers = [ tomopkgs.${pkgs.system}.developercolorpicker ]; + }; } diff --git a/home/darwin/color-pickers/module.nix b/home/darwin/color-pickers/module.nix index ba02caf..3f1bf16 100644 --- a/home/darwin/color-pickers/module.nix +++ b/home/darwin/color-pickers/module.nix @@ -1,7 +1,8 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: { options = { - home.colorPickers = lib.mkOption { + colorPickers.enable = lib.mkEnableOption "install color pickers to ~/Library/ColorPickers"; + colorPickers.colorPickers = lib.mkOption { type = lib.types.listOf lib.types.package; default = [ ]; description = "List of packages whose color pickers should be linked"; @@ -9,6 +10,11 @@ }; config = { + assertions = [{ + assertion = config.home.colorPickers.enable && (config.home.colorPickers != []) && !pkgs.stdenv.hostPlatform.isDarwin; + message = "Must use Darwin to install color pickers."; + }]; + home.activation.linkColorPickers = lib.hm.dag.entryAfter [ "linkGeneration" ] '' rm -rf ${config.home.homeDirectory}/Library/ColorPickers/* mkdir -p ${config.home.homeDirectory}/Library/ColorPickers