{ config, lib, pkgs, ... }: { options.custom = with lib; { shell = { packages = mkOption { type = with types; attrsOf (oneOf [ str attrs package ]); default = { }; apply = custom.mkShellPackages; description = '' Attrset of shell packages to install and add to pkgs.custom overlay (for compatibility across multiple shells). Both string and attr values will be passed as arguments to writeShellApplicationCompletions ''; example = '' shell.packages = { myPackage1 = "echo 'Hello, World!'"; myPackage2 = { runtimeInputs = [ pkgs.hello ]; text = "hello --greeting 'Hi'"; }; } ''; }; additionalSourceFile = mkOption { type = types.nullOr types.path; default = ./custom.sh; }; }; }; config = { programs.bash = lib.mkIf (config.custom.shell.additionalSourceFile != null) { bashrcExtra = lib.mkAfter '' source ${config.custom.shell.additionalSourceFile} ''; }; programs.zsh = lib.mkIf (config.custom.shell.additionalSourceFile != null) { initExtra = lib.mkAfter '' source ${config.custom.shell.additionalSourceFile} ''; }; }; }