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