Move python template update

This commit is contained in:
Evie Litherland-Smith 2024-10-02 17:12:02 +01:00
parent 4f60cda7ba
commit 877f896ef5

View file

@ -154,7 +154,6 @@ nix-mode
> " '';") > " '';")
(pkgs "pkgs = import " (p "<nixpkgs>") " {};") (pkgs "pkgs = import " (p "<nixpkgs>") " {};")
(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> (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> "stdenv.mkDerivation rec {" n> "pname = \"" (p "" pkgn nil) "\";" n> "version = \"" p "\";" n n>
@ -169,25 +168,33 @@ nix-mode
"platforms = platforms." "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> "}" (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 "<nixpkgs>") " {};" 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 (pyderivation "{ buildPythonPackage, " (p "poetry-core" build) ", " (p "" dependencies) "}:" n
> "(self: super: {" n "buildPythonPackage {" n
> (s package) " =" n > "pname = \"" (p "package") "\";" n
> "super." package ".overridePythonAttrs" n > "version = \"" (p "0.1.0") "\";" n
> "(old: {" n > "src = ./.;" n
> "buildInputs = (old.buildInputs or []) ++ [super." (p "setuptools" ) "];" n > "build-system = [ " (s build)" ];" n
> "});" n > "dependencies = [ " (string-replace "," "" dependencies) " ];" n
> "});" q) > "}")
(pydefault "let" n
> "pkgs = import " (p "<nixpkgs>") " { };" n
> "python3 = pkgs." (p "python3.override { packageOverrides = final: prev: {}; }") ";" n
"in" n
> "python3.pkgs.callPackage ./derivation.nix {" q "}")
(pyshell "let" n
> "pkgs = import " (p "<nixpkgs>") " {};" 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 python-base-mode
@ -202,36 +209,6 @@ python-base-mode
(logg "logger = logging.getLogger(__name__)") (logg "logger = logging.getLogger(__name__)")
(nimp "raise NotImplementedError") (nimp "raise NotImplementedError")
nix-mode
(pkgs "pkgs = import " (p "<nixpkgs>") " {};")
(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 "<nixpkgs>") " { };" n
> "python3 = " (p "pkgs.python3") ";" n
"in" n
> "python3.pkgs.callPackage ./derivation.nix {" q "}")
(pyshell "let" n
> "pkgs = import " (p "<nixpkgs>") " {};" 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 envrc-file-mode
;; (python "CC=\"$(nix build nixpkgs#stdenv.cc.cc.lib --print-out-paths --no-link)\"" n ;; (python "CC=\"$(nix build nixpkgs#stdenv.cc.cc.lib --print-out-paths --no-link)\"" n