mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-07 01:07:00 +00:00
Standardize all 'programs.<PROGRAM>.enable<SHELL>Integration' options with the following new functions: - lib.hm.shell.mkBashIntegrationOption - lib.hm.shell.mkFishIntegrationOption - lib.hm.shell.mkIonIntegrationOption - lib.hm.shell.mkNushellIntegrationOption - lib.hm.shell.mkZshIntegrationOption These functions should default to their corresponding global option: - home.shell.enableBashIntegration - home.shell.enableFishIntegration - home.shell.enableIonIntegration - home.shell.enableNushellIntegration - home.shell.enableZshIntegration All these global options default to the 'home.shell.enableShellIntegration' value. This hierarchy standardizes the shell integration and increases end-user flexibility. BREAKING CHANGE: The following inconsistent default values change from 'false' to 'true': - programs.zellij.enableBashIntegration - programs.zellij.enableFishIntegration - programs.zellij.enableZshIntegration Link: https://github.com/nix-community/home-manager/pull/6358 Co-authored-by: Robert Helgesson <robert@rycee.net>
33 lines
1.2 KiB
Nix
33 lines
1.2 KiB
Nix
{ lib }:
|
|
|
|
let
|
|
|
|
mkShellIntegrationOption = name:
|
|
{ config, baseName ? name, extraDescription ? "" }:
|
|
let attrName = "enable${baseName}Integration";
|
|
in lib.mkOption {
|
|
default = config.home.shell.${attrName};
|
|
defaultText = lib.literalMD "[](#opt-home.shell.${attrName})";
|
|
example = false;
|
|
description = "Whether to enable ${name} integration.${
|
|
lib.optionalString (extraDescription != "")
|
|
("\n\n" + extraDescription)
|
|
}";
|
|
type = lib.types.bool;
|
|
};
|
|
|
|
in rec {
|
|
# Produces a Bourne shell like variable export statement.
|
|
export = n: v: ''export ${n}="${toString v}"'';
|
|
|
|
# Given an attribute set containing shell variable names and their
|
|
# assignment, this function produces a string containing an export
|
|
# statement for each set entry.
|
|
exportAll = vars: lib.concatStringsSep "\n" (lib.mapAttrsToList export vars);
|
|
|
|
mkBashIntegrationOption = mkShellIntegrationOption "Bash";
|
|
mkFishIntegrationOption = mkShellIntegrationOption "Fish";
|
|
mkIonIntegrationOption = mkShellIntegrationOption "Ion";
|
|
mkNushellIntegrationOption = mkShellIntegrationOption "Nushell";
|
|
mkZshIntegrationOption = mkShellIntegrationOption "Zsh";
|
|
}
|