dotfiles/shell-modules/languages/python.nix

36 lines
716 B
Nix
Raw Normal View History

2025-02-09 00:11:07 +00:00
{
pkgs,
lib,
config,
...
}:
with lib;
2025-02-09 22:45:15 +00:00
let
packages = config.python.packages;
pythonPackage = pkgs.python3.withPackages packages;
in
2025-02-09 00:11:07 +00:00
{
options.python = {
enable = mkEnableOption "Python";
packages = mkOption {
type = types.functionTo (types.listOf types.package) // {
merge =
loc: defs: p:
lib.concatMap (def: (def.value p)) defs;
};
default = p: [ ];
description = "Python packages to install";
};
# TODO: Add option to directly read from requirements.txt, maybe with mach-nix
};
config = mkIf config.python.enable {
2025-02-09 22:45:15 +00:00
packages = [
pythonPackage
];
env.PYTHONINTERPRETER = "${pythonPackage}/bin/python";
2025-02-09 00:11:07 +00:00
};
}