75 lines
1.7 KiB
Nix
75 lines
1.7 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
lang_support_id = "python";
|
|
inherit (config.grimmShared) enable tooling graphical;
|
|
pyLibs =
|
|
python-pkgs: with python-pkgs; [
|
|
requests
|
|
matplotlib
|
|
numpy
|
|
scipy
|
|
pygobject3
|
|
pandas
|
|
];
|
|
|
|
inherit (lib)
|
|
mkIf
|
|
types
|
|
mkOption
|
|
mapAttrsToList
|
|
concatLines
|
|
getExe
|
|
elem
|
|
;
|
|
in
|
|
{
|
|
config = mkIf (enable && tooling.enable && (elem lang_support_id tooling.supportedLangs)) {
|
|
environment.systemPackages = [
|
|
(pkgs.python3.withPackages pyLibs)
|
|
] ++ lib.optionals graphical (with pkgs; [ jetbrains.pycharm-community ]);
|
|
|
|
programs.xonsh = {
|
|
enable = true;
|
|
config =
|
|
(
|
|
let
|
|
cfg = config.programs.starship;
|
|
settingsFormat = pkgs.formats.toml { };
|
|
settingsFile = settingsFormat.generate "starship.toml" cfg.settings;
|
|
in
|
|
''
|
|
$STARSHIP_CONFIG="${settingsFile}"
|
|
$SHELL="${getExe config.programs.xonsh.package}"
|
|
execx($(${getExe pkgs.starship} init xonsh))
|
|
''
|
|
)
|
|
+ concatLines (
|
|
mapAttrsToList (
|
|
name: value: "aliases[\"${name}\"] = '''${value}'''"
|
|
) config.environment.shellAliases
|
|
);
|
|
# package = pkgs.xonsh.wrapper.override { extraPackages = pyLibs; };
|
|
};
|
|
|
|
grimmShared.tooling.lang_servers = [
|
|
{
|
|
lsp.package = pkgs.python311Packages.python-lsp-server;
|
|
fmt = {
|
|
package = pkgs.yapf;
|
|
includes = [ "*.py" ];
|
|
options = [ "-i" ];
|
|
};
|
|
}
|
|
];
|
|
};
|
|
|
|
options.grimmShared.tooling.supportedLangs = mkOption {
|
|
type = types.listOf (types.enum [ lang_support_id ]);
|
|
};
|
|
}
|