fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6cfg = config . programs . rtx ; 7tomlFormat = pkgs . formats . toml { }; 8in { 9meta . maintainers = [ hm . maintainers . pedorich-n ]; 10 11options = { 12programs . rtx = { 13enable = mkEnableOption "RTX. Runtime Executor (asdf Rust clone)" ; 14 15package = mkPackageOption pkgs "rtx" { }; 16 17enableBashIntegration = mkEnableOption "Bash Integration" // { 18default = true ; 19}; 20 21enableZshIntegration = mkEnableOption "Zsh Integration" // { 22default = true ; 23}; 24 25enableFishIntegration = mkEnableOption "Fish Integration" // { 26default = true ; 27}; 28 29settings = mkOption { 30type = tomlFormat . type ; 31default = { }; 32example = literalExpression '' 33tools = { 34node = "lts"; 35python = ["3.10" "3.11"]; 36}; 37 38settings = { 39verbose = false; 40experimental = false; 41}; 42'' ; 43description = '' 44Settings written to {file}`$XDG_CONFIG_HOME/rtx/config.toml`. 45 46See <https://github.com/jdxcode/rtx#global-config-configrtxconfigtoml> 47for details on supported values. 48 49::: {.warning} 50Modifying the `tools` section doesn't make RTX install them. 51You have to manually run `rtx install` to install the tools. 52::: 53'' ; 54}; 55}; 56}; 57 58config = mkIf cfg . enable { 59home . packages = [ cfg . package ]; 60 61xdg . configFile . "rtx/config.toml" = mkIf ( cfg . settings != { }) { 62source = tomlFormat . generate "rtx-settings" cfg . settings ; 63}; 64 65programs = { 66bash . initExtra = mkIf cfg . enableBashIntegration '' 67eval "$( ${ getExe cfg . package } activate bash)" 68'' ; 69 70zsh . initExtra = mkIf cfg . enableZshIntegration '' 71eval "$( ${ getExe cfg . package } activate zsh)" 72'' ; 73 74fish . interactiveShellInit = mkIf cfg . enableFishIntegration '' 75${ getExe cfg . package } activate fish | source 76'' ; 77}; 78}; 79}