rye: update & use globally

This commit is contained in:
ItsDrike 2024-06-27 19:14:42 +02:00
parent 2da382b4dc
commit 8a6311b896
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
4 changed files with 26 additions and 16 deletions

View file

@ -1,6 +1,5 @@
{
imports = [
./python.nix
./ipython.nix
./poetry.nix
./rye.nix

View file

@ -1,14 +0,0 @@
{
lib,
pkgs,
osConfig,
...
}: let
inherit (lib) mkIf;
cfg = osConfig.myOptions.home-manager.programs.coding.python;
in {
config = mkIf cfg.enable {
home.packages = with pkgs; [ python312 ];
};
}

View file

@ -1,14 +1,38 @@
{
lib,
pkgs,
config,
osConfig,
...
}: let
inherit (lib) mkIf;
cfg = osConfig.myOptions.home-manager.programs.coding.python;
toTOML = name: (pkgs.formats.toml {}).generate "${name}";
in {
config = mkIf cfg.enable {
home.packages = with pkgs; [ rye ];
home = {
packages = with pkgs; [ rye ];
sessionVariables = {
RYE_HOME = "${config.xdg.configHome}/rye";
};
# Add rye python shims to path.
# Rye provides python executables that will automatically pick up on the python
# from a virtual environment, if we're in a directory (project) with one. If not,
# rye will fall back to system python. That is, if behavior.global-python=false,
# otherwise, we can actually use a python version from rye as our global python.
sessionPath = [
"${config.xdg.configHome}/rye/shims"
];
};
# see: <https://rye.astral.sh/guide/config/#config-file>
xdg.configFile."rye/config.toml".source = toTOML "config.toml" {
default.license = "GPL-3.0-or-later";
behavior.global-python=true;
};
};
}

View file

@ -79,6 +79,7 @@
# Language package managers
".local/share/cargo"
".local/share/go"
".config/rye"
];
extraFiles = [
".config/gtk-3.0/bookmarks"