-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdefault.nix
More file actions
73 lines (62 loc) · 1.95 KB
/
default.nix
File metadata and controls
73 lines (62 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ python, pypkgs }:
{ pkgs-unstable, pkgs-23_05, lib, ... }:
let
pythonVersion = lib.versions.majorMinor python.version;
pkgs = pkgs-unstable;
pylibs-dir = ".pythonlibs";
userbase = "$REPL_HOME/${pylibs-dir}";
pythonUtils = import ../../python-utils {
inherit pkgs python pypkgs;
};
python-ld-library-path = pythonUtils.python-ld-library-path;
sitecustomize = pkgs.callPackage ../python/sitecustomize.nix { };
binary-wrapped-python = pkgs.callPackage ../../python-wrapped {
inherit pkgs python python-ld-library-path;
};
in
{
id = "python-base-${pythonVersion}";
name = "Python Tools";
displayVersion = pythonVersion;
description = ''
Basic module for Python. Includes the interpreter and basic Replit
configuration but nothing else. This may be combined with the
ty module.
'';
replit.packages = [
binary-wrapped-python
pypkgs.pip
pkgs.poetry
pkgs.uv
];
replit.runners.python = {
name = "Python ${pythonVersion}";
displayVersion = python.version;
fileParam = true;
language = "python3";
start = "${python}/bin/python3 $file";
defaultEntrypoints = [ "main.py" "app.py" "run.py" ];
};
replit.dev.packagers.upmPython = {
name = "Python packager";
language = "python3";
ignoredPackages = [ "unit_tests" ];
ignoredPaths = [ pylibs-dir ];
features = {
packageSearch = true;
guessImports = true;
enabledForHosting = false;
};
};
replit.env = {
PYTHONUSERBASE = userbase;
PYTHONPATH = "${sitecustomize}";
REPLIT_PYTHONPATH = "${userbase}/${python.sitePackages}:${pypkgs.setuptools}/${python.sitePackages}";
UV_PROJECT_ENVIRONMENT = "$REPL_HOME/.pythonlibs";
# Even though it is set-default in the wrapper, add it to the
# environment too, so that when someone wants to override it,
# they can keep the defaults if they want to.
PYTHON_LD_LIBRARY_PATH = python-ld-library-path;
PATH = "${userbase}/bin";
};
}