Add templates for python derivation.nix and default.nix

Remove poetryshell template, but keep poetry2nix template for cases I
still want it
This commit is contained in:
Evie Litherland-Smith 2024-08-12 13:47:24 +01:00
parent a95b258c74
commit 7aef991aa2

View file

@ -207,7 +207,7 @@ nix-mode
(pkgs "pkgs = import " (p "<nixpkgs>") " {};")
(poetry2nix "poetry2nix = (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};")
(pythonshell "let" n
(pyshell "let" n
> "pkgs = import " (p "<nixpkgs>") " {};" n
> "in pkgs.mkShellNoCC {" n
> "packages = with pkgs; [" n
@ -219,25 +219,19 @@ nix-mode
> "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
(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
> "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
> "python3 = " (p "pkgs.python3") ";" n
"in" n
> "poetryEnv.env")
> "python3.pkgs.callPackage ./derivation.nix {" q "}")
envrc-file-mode