aquafire / python_devshell.nix

Last active 6 months ago

Like 0

aquafire revised this gist 9 months ago · d2b1df7

1 file changed, 53 insertions

python_devshell.nix (file created)
@@ -0,0 +1,53 @@
1 + {
2 + description = "Python DevShell — ОДИН Python!";
3 +
4 + inputs = {
5 + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 + devshell.url = "github:numtide/devshell";
7 + devshell.inputs.nixpkgs.follows = "nixpkgs";
8 + };
9 +
10 + outputs =
11 + {
12 + nixpkgs,
13 + devshell,
14 + flake-utils,
15 + ...
16 + }:
17 + flake-utils.lib.eachDefaultSystem (
18 + system:
19 + let
20 + pkgs = nixpkgs.legacyPackages.${system};
21 +
22 + # python
23 + python311 = pkgs.python311;
24 +
25 + in
26 + {
27 + devShells.default = devshell.legacyPackages.${system}.mkShell {
28 + packages = [
29 + python311
30 + python311.pkgs.black
31 + python311.pkgs.isort
32 + python311.pkgs.mypy
33 + python311.pkgs.ruff
34 + python311.pkgs.uv
35 + ];
36 +
37 + commands = [
38 + {
39 + name = "check";
40 + help = "Check python code";
41 + command = "ruff check";
42 + category = "python-tools";
43 + }
44 + ];
45 +
46 + devshell.startup.setup.text = ''
47 + echo "🚀 Python dev shell started!"
48 + '';
49 +
50 + };
51 + }
52 + );
53 + }