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:
parent
a95b258c74
commit
7aef991aa2
32
templates
32
templates
|
@ -207,7 +207,7 @@ nix-mode
|
||||||
|
|
||||||
(pkgs "pkgs = import " (p "<nixpkgs>") " {};")
|
(pkgs "pkgs = import " (p "<nixpkgs>") " {};")
|
||||||
(poetry2nix "poetry2nix = (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};")
|
(poetry2nix "poetry2nix = (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};")
|
||||||
(pythonshell "let" n
|
(pyshell "let" n
|
||||||
> "pkgs = import " (p "<nixpkgs>") " {};" n
|
> "pkgs = import " (p "<nixpkgs>") " {};" n
|
||||||
> "in pkgs.mkShellNoCC {" n
|
> "in pkgs.mkShellNoCC {" n
|
||||||
> "packages = with pkgs; [" 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
|
> "export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib" n
|
||||||
> "'';" n
|
> "'';" n
|
||||||
> "}")
|
> "}")
|
||||||
(poetryshell "# See https://github.com/nix-community/poetry2nix/blob/master/docs/edgecases.md#cases" n
|
(pyderivation "{ buildPythonPackage, " (p "poetry-core" build) ", " (p "" dependencies) "}:" n
|
||||||
"# for edgecases like setuptools not found" n
|
"buildPythonPackage {" n
|
||||||
"let" n
|
> "pname = \"" (p "package") "\";" n
|
||||||
> "pkgs = import " (p "<nixpkgs>") " {};" n
|
> "version = \"" (p "0.1.0") "\";" n
|
||||||
> "poetry2nix = (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};" n
|
> "src = ./.;" n
|
||||||
> "poetryEnv = let " n
|
> "build-system = [ " (s build)" ];" n
|
||||||
> "projectDir = " (p "./.") ";" n
|
> "dependencies = [ " (string-replace "," "" dependencies) " ];" n
|
||||||
> "in (poetry2nix.mkPoetryEnv {" n
|
> "}")
|
||||||
> "inherit projectDir;" n
|
(pydefault "let" n
|
||||||
> "overrides = poetry2nix.defaultPoetryOverrides;" n
|
> "pkgs = import " (p "<nixpkgs>") " { };" n
|
||||||
> "python = " (p "pkgs.python3Full") ";" n
|
> "python3 = " (p "pkgs.python3") ";" n
|
||||||
> "editablePackageSources = {" (p "package") "= projectDir;};" n
|
|
||||||
> "extraPackages = (ps: [" q "]);" n
|
|
||||||
> "preferWheels = true;" n
|
|
||||||
> "groups = [\"dev\"];" n
|
|
||||||
> "extras = [\"*\"];" n
|
|
||||||
> "});" n
|
|
||||||
"in" n
|
"in" n
|
||||||
> "poetryEnv.env")
|
> "python3.pkgs.callPackage ./derivation.nix {" q "}")
|
||||||
|
|
||||||
envrc-file-mode
|
envrc-file-mode
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue