From b83631bfa450e474537d08e232543b21bf8e0991 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Mon, 25 Nov 2024 13:48:43 +0000 Subject: [PATCH] Update pyshell template to use pyproject-nix --- templates | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/templates b/templates index 8c87ef4..6a849d8 100644 --- a/templates +++ b/templates @@ -192,22 +192,21 @@ nix-mode "in" n > "python3.pkgs.callPackage ./derivation.nix {" q "}") (pyshell "let" n - > "pkgs = import " (p "") " {};" n + > "pkgs = import " (p "") " { };" n + > "pyproject-nix = import (builtins.fetchGit {" n + > "url = \"https://github.com/pyproject-nix/pyproject.nix.git\";" n + > "}) { inherit (pkgs) lib; };" n > "python3 = pkgs." (p "python3") ";" n - > "in pkgs.mkShellNoCC {" n - > "packages = [" n - > "(python3.withPackages(" n - > "ps: with ps; ["n - > (p "tkinter mypy") n - > "]" n - > (p "++ (callPackage ./derivation.nix { }).dependencies") n - > "))" n - > "];" n + > "project = pyproject-nix.lib.project.loadPoetryPyproject { projectRoot = ./.; };" n + > "pythonEnv = python3.withPackages (project.renderers.withPackages { python = python3; });" n + "in" n + "pkgs.mkShellNoCC {" n + > "packages = [pythonEnv];" n > "shellHook = ''" n - > "export PYTHONPATH=$(readlink -f " (p "./") "):$PYTHONPATH" n + > "export PYTHONPATH=$(readlink -f " (p "./.") "):$PYTHONPATH" n > "export MPLBACKEND=" (p "TkAgg") n > "'';"n - > "}") + "}") (sal > "pkgs.fetchFromGitHub {" n > "owner = \"pixelifytica\";" n