From 877f896ef5feebd6939b07c2533403207cf6080e Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Wed, 2 Oct 2024 17:12:02 +0100 Subject: [PATCH] Move python template update --- templates | 75 +++++++++++++++++++------------------------------------ 1 file changed, 26 insertions(+), 49 deletions(-) diff --git a/templates b/templates index 7e2e673..bf370fc 100644 --- a/templates +++ b/templates @@ -154,7 +154,6 @@ nix-mode > " '';") (pkgs "pkgs = import " (p "") " {};") -(poetry2nix "poetry2nix = (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};") (gitpackage "{ lib" n ", stdenv" n ", fetchFromGitHub" n ", " (p "inputs") n ", " (p "inputs") n "}:" n n> "stdenv.mkDerivation rec {" n> "pname = \"" (p "" pkgn nil) "\";" n> "version = \"" p "\";" n n> @@ -169,25 +168,33 @@ nix-mode "platforms = platforms." (p (completing-read "Platform: " '("all" "allBut" "arm" "cygwin" "darwin" "freebsd" "gnu" "i686" "illumos" "linux" "mesaPlatforms" "mips" "netbsd" "none" "openbsd" "unix" "x86"))) ";" n> q "};" n> "}" ) -(pythonshell "let" n - > "pkgs = import " (p "") " {};" n - > "python = pkgs." (p "python3") ";" n - > "in pkgs.mkShell {" n - > "packages = with pkgs; [ poetry uv " q "];" n - > "shellHook = ''" n - > "export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.libz}/lib" n - > "${pkgs.poetry}/bin/poetry env use ${python}/bin/python3" n - > "'';" n - > "}") -(poetryoverride "overrides = poetry2nix.defaultPoetryOverrides.extend" n - > "(self: super: {" n - > (s package) " =" n - > "super." package ".overridePythonAttrs" n - > "(old: {" n - > "buildInputs = (old.buildInputs or []) ++ [super." (p "setuptools" ) "];" n - > "});" n - > "});" q) +(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 = pkgs." (p "python3.override { packageOverrides = final: prev: {}; }") ";" n + "in" n + > "python3.pkgs.callPackage ./derivation.nix {" q "}") +(pyshell "let" n + > "pkgs = import " (p "") " {};" n + > "python3 = pkgs." (p "python3") ";" n + > "in pkgs.mkShellNoCC {" n + > "packages = [" n + > "(python3.withPackages(" n + > "ps: with ps; ["n + > (p "tkinter") n + > q n + > "]" n + > "))" n + > "];" n + > "}") python-base-mode @@ -202,36 +209,6 @@ python-base-mode (logg "logger = logging.getLogger(__name__)") (nimp "raise NotImplementedError") -nix-mode - -(pkgs "pkgs = import " (p "") " {};") -(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 "}") -(pyshell "let" n - > "pkgs = import " (p "") " {};" n - > "python = pkgs." (p "python3.override { self=python; packageOverrides = final: prev: {}; }") ";"n - > "in pkgs.mkShellNoCC {" n - > "packages = [" n - > "(python.withPackages(" n - > "ps: with ps; ["n - > (p "tkinter") n - > q n - > "]" n - > "))" n - > "];" n - > "}") - envrc-file-mode ;; (python "CC=\"$(nix build nixpkgs#stdenv.cc.cc.lib --print-out-paths --no-link)\"" n