mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
uv: init module
This commit is contained in:
parent
a0461b67ff
commit
1d2d6b9568
6 changed files with 107 additions and 0 deletions
56
modules/programs/uv.nix
Normal file
56
modules/programs/uv.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
literalExpression
|
||||
;
|
||||
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
cfg = config.programs.uv;
|
||||
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.maintainers; [ mirkolenz ];
|
||||
|
||||
options.programs.uv = {
|
||||
enable = mkEnableOption "uv";
|
||||
|
||||
package = mkPackageOption pkgs "uv" { };
|
||||
|
||||
settings = mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
python-downloads = "never";
|
||||
python-preference = "only-system";
|
||||
pip.index-url = "https://test.pypi.org/simple";
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Configuration written to
|
||||
{file}`$XDG_CONFIG_HOME/uv/uv.toml`.
|
||||
See <https://docs.astral.sh/uv/configuration/files/>
|
||||
and <https://docs.astral.sh/uv/reference/settings/>
|
||||
for more information.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."uv/uv.toml" = lib.mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "uv-config" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue