{ lib, flake-parts-lib, inputs, ... }: let inherit (lib) mkOption mkPackageOption types; inherit (flake-parts-lib) mkPerSystemOption; in { options.perSystem = mkPerSystemOption ( { pkgs, config, ... }: { options = { weznix = { wezterm = mkPackageOption pkgs "wezterm" { }; configDirectory = mkOption { type = types.str; default = "~/.config/wezterm"; description = '' Location of wezterm config directory (see config.weznix.wrapConfig). ''; }; luaPath = mkOption { type = types.path; description = '' Path to wezterm config directory. This path is copied into the nix store. ''; }; mainFile = mkOption { type = types.str; default = "init"; apply = lib.removeSuffix ".lua"; description = "Name of the main *.lua file to load"; }; wrapConfig = mkOption { type = types.either types.bool types.str; default = "WEZDEV"; description = '' true -> use config in nix store false -> use config in ${config.weznix.configDirectory} ENVVAR -> if $ENVVAR == 1 then use config in ${config.weznix.configDirectory} else use config in nix store ''; }; extraLuaInit = mkOption { type = types.lines; default = ""; description = '' Extra lua code to place in the generated wezterm.lua. This is likely unnecessary. ''; }; extraPATH = mkOption { type = types.listOf types.package; default = [ ]; description = "Extra packages to add to wezterm's $PATH"; }; extraWrapperArgs = mkOption { type = types.listOf types.str; default = [ ]; description = "Extra arguments to pass to `wrapProgram`"; }; pass = mkOption { type = types.lazyAttrsOf types.anything; default = { }; description = '' Anything else to pass into the lua config. These values can then be accessed in your lua config from the table `require('weznix')`. ''; }; }; }; config = { packages = { weznix = pkgs.callPackage ../pkgs/weznix.nix { inherit (config.weznix) wezterm; nixToLua = import inputs.nixToLua; } { inherit (config.weznix) configDirectory luaPath wrapConfig mainFile extraLuaInit extraPATH extraWrapperArgs pass ; }; }; }; } ); }