split home-manager into their own submodules
This commit is contained in:
31
modules/dev/python/common.nix
Normal file
31
modules/dev/python/common.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{ pkgs }:
|
||||
let
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
pipenv
|
||||
pyright
|
||||
;
|
||||
inherit (pkgs.python3Packages)
|
||||
black
|
||||
editorconfig
|
||||
flake8
|
||||
isort
|
||||
pyflakes
|
||||
pylint
|
||||
pytest
|
||||
speedtest-cli
|
||||
;
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit packages;
|
||||
devShell = pkgs.mkShell {
|
||||
inherit packages;
|
||||
name = "python-dev-shell";
|
||||
shellHook = ''
|
||||
echo "🐍 Python dev environment"
|
||||
which python
|
||||
'';
|
||||
description = "Python development shell";
|
||||
};
|
||||
}
|
||||
36
modules/dev/python/home.nix
Normal file
36
modules/dev/python/home.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
osConfig ? null,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
python = import ./common.nix { inherit pkgs; };
|
||||
hm = inputs.self.lib.hmModule {
|
||||
inherit
|
||||
config
|
||||
inputs
|
||||
osConfig
|
||||
;
|
||||
optionPath = [
|
||||
"dev"
|
||||
"python"
|
||||
];
|
||||
};
|
||||
cfg = config.my.dev.python;
|
||||
in
|
||||
{
|
||||
options.my.dev.python.enable = lib.mkEnableOption "Install Python tools globally";
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
my.dev.python.enable = lib.mkDefault hm.enabledByDefault;
|
||||
}
|
||||
(lib.mkIf cfg.enable {
|
||||
home.packages = python.packages;
|
||||
xdg.configFile."python/pythonrc".source = ../../../dotfiles/pythonrc;
|
||||
home.sessionVariables.PYTHONSTARTUP = "\${XDG_CONFIG_HOME}/python/pythonrc";
|
||||
})
|
||||
];
|
||||
}
|
||||
26
modules/dev/python/nixos.nix
Normal file
26
modules/dev/python/nixos.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
python = import ./common.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
options = {
|
||||
my.dev.python = {
|
||||
enable = lib.mkEnableOption "Install Python tools globally";
|
||||
users = lib.mkOption {
|
||||
type = inputs.self.lib.usersOptionType lib;
|
||||
default = config.my.toggleUsers.dev;
|
||||
description = "Users to install Python packages for";
|
||||
};
|
||||
};
|
||||
devShells.python = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = python.devShell;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user