{ pkgs, config, lib, ... }: with lib; with lib.custom; let cfg = config.scripts; in { options.scripts = with types; { enable = mkBoolOpt false "Enable custom scripts"; onepassword = { enable = mkBoolOpt false "Enable 1Password search utility"; }; }; config = mkIf cfg.enable { home.packages = with pkgs; [ (writeShellScriptBin "opsearch" (builtins.readFile ./opsearch.sh)) ] ++ ( if cfg.onepassword.enable then with pkgs; [ jq wl-clipboard ] else [] ); # Ensure the scripts directory exists and copy scripts there home.file = { ".local/bin/opsearch.sh" = { source = ./opsearch.sh; executable = true; }; # Add fish function for 1Password search if fish is enabled ".config/fish/functions/ops.fish" = mkIf cfg.onepassword.enable { source = ../shell/fish/functions/ops.fish; executable = true; }; }; }; }