Skip to content

Commit

Permalink
Merge pull request #386 from replit/dstewart/feat/add-uv
Browse files Browse the repository at this point in the history
feat/add uv
  • Loading branch information
blast-hardcheese authored Sep 5, 2024
2 parents c72ce7a + fda1d3d commit b861a30
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 41 deletions.
64 changes: 30 additions & 34 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@
name = "nixpkgs-unstable-patched";
src = nixpkgs-unstable;
patches = [
# rexml breaks this version of nixpkgs
./patches/rexml.patch
# rexml broke solargraph at some point in the past.
# Attempting to run:
# echo 'x = (5 + "hey")' > main.rb
# /nix/store/.../ruby /nix/store/.../bin/solargraph typecheck main.rb
# curently emits a bunch of "Unrecognized RBS type:" warnings, followed by
# "0 problems found."
# This patch used to apply, but even when massaged to apply to the
# current unstable HEAD, still produces the same result:
# ./patches/rexml.patch
];
};

Expand Down
4 changes: 4 additions & 0 deletions pkgs/modules/R/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ in
R project for statistical computing.
'';

replit.packages = [
pkgs.R
];

replit.runners.r = {
name = "R";
language = "r";
Expand Down
2 changes: 2 additions & 0 deletions pkgs/modules/python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ in
python3-wrapper
pip-wrapper
poetry-wrapper
pkgs.uv
];

replit.runners.python = {
Expand Down Expand Up @@ -160,6 +161,7 @@ in
PYTHONUSERBASE = userbase;
PYTHONPATH = "${sitecustomize}:${pip.pip}/${python.sitePackages}";
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.
Expand Down
5 changes: 5 additions & 0 deletions pkgs/upgrade-map/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ let
"bun-0.7" = "bun-1.0";
"dart-3.0" = "dart-3.1";
"dart-3.1" = "dart-3.2";
"dart-3.2" = "dart-3.3";
"dart-3.3" = "dart-3.4";
"dart-3.4" = "dart-3.5";
"elixir-1_16" = "elixir-1_17";
"go" = "go-1.19";
"r-4.3" = "r-4.4";
"rust" = "rust-1.69";
"rust-1.69" = "rust-1.70";
"rust-1.70" = "rust-1.72";
Expand Down
6 changes: 5 additions & 1 deletion scripts/build_changed_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import subprocess
import argparse
import re
from textwrap import dedent

nix_store_path_pattern = re.compile(r'/nix/store/([0-9a-z]+)')

Expand Down Expand Up @@ -46,7 +47,10 @@ def verify_no_existing_modules_removed(upstream_module_versions, current_module_
upstream_modules = {version[0] for version in upstream_module_versions}
modules = {version[0] for version in current_module_versions}
diff = upstream_modules - modules
assert len(diff) == 0, "module(s) deleted: %r" % diff
assert len(diff) == 0, dedent(f"""\
module(s) deleted: {repr(diff)}
You may want to add new entries to ./pkgs/upgrade-map
""")

def main():
parser = argparse.ArgumentParser(
Expand Down
11 changes: 7 additions & 4 deletions scripts/ci_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ git grep writeShellScriptBin | grep -v "Please use writeShellApplication" && \
(echo "Please use writeShellApplication instead of writeShellScriptBin" && \
exit 1) || true

NIX_FLAGS="--extra-experimental-features nix-command --extra-experimental-features flakes --extra-experimental-features discard-references"
NIX_FLAGS=(
--extra-experimental-features nix-command
--extra-experimental-features flakes
)

echo "Evaluate modules derivations"
nix eval $NIX_FLAGS .#modules --json
nix eval "${NIX_FLAGS[@]}" .#modules --json

nix develop $NIX_FLAGS
nix develop "${NIX_FLAGS[@]}" --command echo Hello, world

python scripts/build_changed_modules.py main
nix-shell -p python312 --command 'python scripts/build_changed_modules.py main'

0 comments on commit b861a30

Please sign in to comment.