From 7aef991aa2ec13cec20225b15c4713569cd7f5cf Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Mon, 12 Aug 2024 13:47:24 +0100 Subject: [PATCH] Add templates for python derivation.nix and default.nix Remove poetryshell template, but keep poetry2nix template for cases I still want it --- templates | 56 +++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/templates b/templates index 7ac4085..804b24a 100644 --- a/templates +++ b/templates @@ -207,37 +207,31 @@ nix-mode (pkgs "pkgs = import " (p "") " {};") (poetry2nix "poetry2nix = (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};") -(pythonshell "let" n - > "pkgs = import " (p "") " {};" n - > "in pkgs.mkShellNoCC {" n - > "packages = with pkgs; [" n - > "poetry" n - > (p "python3Full") n - > q n - > "];" n - > "shellHook = ''" n - > "export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib" n - > "'';" n - > "}") -(poetryshell "# See https://github.com/nix-community/poetry2nix/blob/master/docs/edgecases.md#cases" n - "# for edgecases like setuptools not found" n - "let" n - > "pkgs = import " (p "") " {};" n - > "poetry2nix = (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};" n - > "poetryEnv = let " n - > "projectDir = " (p "./.") ";" n - > "in (poetry2nix.mkPoetryEnv {" n - > "inherit projectDir;" n - > "overrides = poetry2nix.defaultPoetryOverrides;" n - > "python = " (p "pkgs.python3Full") ";" n - > "editablePackageSources = {" (p "package") "= projectDir;};" n - > "extraPackages = (ps: [" q "]);" n - > "preferWheels = true;" n - > "groups = [\"dev\"];" n - > "extras = [\"*\"];" n - > "});" n - "in" n - > "poetryEnv.env") +(pyshell "let" n + > "pkgs = import " (p "") " {};" n + > "in pkgs.mkShellNoCC {" n + > "packages = with pkgs; [" n + > "poetry" n + > (p "python3Full") n + > q n + > "];" n + > "shellHook = ''" n + > "export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib" n + > "'';" n + > "}") +(pyderivation "{ buildPythonPackage, " (p "poetry-core" build) ", " (p "" dependencies) "}:" n + "buildPythonPackage {" n + > "pname = \"" (p "package") "\";" n + > "version = \"" (p "0.1.0") "\";" n + > "src = ./.;" n + > "build-system = [ " (s build)" ];" n + > "dependencies = [ " (string-replace "," "" dependencies) " ];" n + > "}") +(pydefault "let" n + > "pkgs = import " (p "") " { };" n + > "python3 = " (p "pkgs.python3") ";" n + "in" n + > "python3.pkgs.callPackage ./derivation.nix {" q "}") envrc-file-mode