36a53d9f26
This process was automated by [my fork of `nix-doc-munge`]. All conversions were automatically checked to produce the same DocBook result when converted back, modulo minor typographical/formatting differences on the acceptable-to-desirable spectrum. To reproduce this commit, run: $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \ nix shell nixpkgs#coreutils \ -c find . -name '*.nix' \ -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \ {} + $ ./format [my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge/tree/home-manager
83 lines
2.2 KiB
Nix
83 lines
2.2 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.programs.pyenv;
|
|
|
|
tomlFormat = pkgs.formats.toml { };
|
|
|
|
in {
|
|
meta.maintainers = with lib.maintainers; [ tmarkus ];
|
|
|
|
options.programs.pyenv = {
|
|
enable = lib.mkEnableOption (lib.mdDoc "pyenv");
|
|
|
|
package = lib.mkOption {
|
|
type = lib.types.package;
|
|
default = pkgs.pyenv;
|
|
defaultText = lib.literalExpression "pkgs.pyenv";
|
|
description = lib.mdDoc "The package to use for pyenv.";
|
|
};
|
|
|
|
enableBashIntegration = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = lib.mdDoc ''
|
|
Whether to enable pyenv's Bash integration.
|
|
'';
|
|
};
|
|
|
|
enableZshIntegration = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = lib.mdDoc ''
|
|
Whether to enable pyenv's Zsh integration.
|
|
'';
|
|
};
|
|
|
|
enableFishIntegration = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = lib.mdDoc ''
|
|
Whether to enable pyenv's Fish integration.
|
|
'';
|
|
};
|
|
|
|
rootDirectory = lib.mkOption {
|
|
type = lib.types.path;
|
|
apply = toString;
|
|
default = "${config.xdg.dataHome}/pyenv";
|
|
defaultText = "\${config.xdg.dataHome}/pyenv";
|
|
description = lib.mdDoc ''
|
|
The pyenv root directory ({env}`PYENV_ROOT`).
|
|
|
|
::: {.note}
|
|
This deviates from upstream, which uses {file}`$HOME/.pyenv`.
|
|
The default path in Home Manager is set according to the XDG
|
|
base directory specification.
|
|
:::
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# Always add the configured `pyenv` package.
|
|
home.packages = [ cfg.package ];
|
|
|
|
programs.bash.initExtra = lib.mkIf cfg.enableBashIntegration ''
|
|
export PYENV_ROOT="${cfg.rootDirectory}"
|
|
eval "$(${lib.getExe cfg.package} init - bash)"
|
|
'';
|
|
|
|
programs.zsh.initExtra = lib.mkIf cfg.enableZshIntegration ''
|
|
export PYENV_ROOT="${cfg.rootDirectory}"
|
|
eval "$(${lib.getExe cfg.package} init - zsh)"
|
|
'';
|
|
|
|
programs.fish.interactiveShellInit = lib.mkIf cfg.enableFishIntegration ''
|
|
set -Ux PYENV_ROOT "${cfg.rootDirectory}"
|
|
${lib.getExe cfg.package} init - fish | source
|
|
'';
|
|
};
|
|
}
|