Skip to content

Commit

Permalink
home/color-pickers: enable option, assert Darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
tomodachi94 committed Dec 4, 2024
1 parent 595bda4 commit 7357057
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion home/darwin/color-pickers/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
10 changes: 8 additions & 2 deletions home/darwin/color-pickers/module.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{ 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";
};
};

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
Expand Down

0 comments on commit 7357057

Please sign in to comment.