migrating dev environments to output

This commit is contained in:
Danilo Reyes 2025-04-18 20:57:36 -06:00
parent e7883be1f1
commit ecb9f386ce
4 changed files with 60 additions and 28 deletions

View File

@ -3,6 +3,7 @@
pkgs, pkgs,
inputs, inputs,
outputs, outputs,
config,
... ...
}: }:
{ {

View File

@ -84,6 +84,10 @@
workstation = createConfig "workstation" inputs.nixpkgs; workstation = createConfig "workstation" inputs.nixpkgs;
miniserver = createConfig "miniserver" inputs.nixpkgs-small; miniserver = createConfig "miniserver" inputs.nixpkgs-small;
server = createConfig "server" inputs.nixpkgs-small; server = createConfig "server" inputs.nixpkgs-small;
shell = createConfig "shell" inputs.nixpkgs;
};
devShells.${system} = {
python = self.nixosConfigurations.shell.config.devShells.python;
}; };
}; };
} }

View File

@ -0,0 +1,7 @@
{ ... }:
{
imports = [
../../base.nix
../../stylix.nix
];
}

View File

@ -4,34 +4,54 @@
pkgs, pkgs,
... ...
}: }:
let
python = pkgs.python3.withPackages (
ps:
builtins.attrValues {
inherit (ps)
black # Python code formatter
editorconfig # follow rules of contributin
flake8 # wraper for pyflakes, pycodestyle and mccabe
isort # sort Python imports
pyflakes # checks source code for errors
pylint # bug and style checker for python
pytest # tests
speedtest-cli # check internet speed from the comand line
;
}
);
packages =
[ python ]
++ builtins.attrValues {
inherit (pkgs)
pipenv # python development workflow for humans
pyright # LSP
;
};
in
{ {
options.my.dev.python.enable = lib.mkEnableOption "enable"; options = {
config = lib.mkIf config.my.dev.python.enable { my.dev.python.enable = lib.mkEnableOption "Install Python tools globally";
home-manager.users.jawz.xdg.configFile."python/pythonrc".source = ../../dotfiles/pythonrc; devShells.python = lib.mkOption {
environment.variables.PYTHONSTARTUP = "\${XDG_CONFIG_HOME}/python/pythonrc"; type = lib.types.package;
users.users.jawz.packages = default = pkgs.mkShell {
builtins.attrValues { inherit packages;
inherit (pkgs) name = "python-dev-shell";
pipenv # python development workflow for humans shellHook = ''
pyright # LSP echo "🐍 Python dev environment"
; which python
} '';
++ [ description = "Python development shell";
(pkgs.python3.withPackages ( };
ps: };
builtins.attrValues {
inherit (ps)
black # Python code formatter
editorconfig # follow rules of contributin
flake8 # wraper for pyflakes, pycodestyle and mccabe
isort # sort Python imports
pyflakes # checks source code for errors
pylint # bug and style checker for python
pytest # tests
speedtest-cli # check internet speed from the comand line
;
}
))
];
}; };
config = lib.mkMerge [
(lib.mkIf config.my.dev.python.enable {
users.users.jawz.packages = packages;
})
{
home-manager.users.jawz.xdg.configFile."python/pythonrc".source = ../../dotfiles/pythonrc;
environment.variables.PYTHONSTARTUP = "\${XDG_CONFIG_HOME}/python/pythonrc";
}
];
} }