Repository navigation
Conversation
Assisted-by: Replit
Assisted-by: Replit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
builtins.derivationdevShell that sources each module'snix-support/replit-envand setsSHELL/PATHby hand. A small helper gives the same module-only behavior as.replitmodules, without stdenv.What changed
lib.mkReplitShell { packages ? [ ], shellHook ? "", name ? "replit-devshell" }(pkgs/replit-shell/default.nix), exported next tolib.mkBundle.passthru.replitModuleId(pkgs/moduleit/shell-package.nix). This is metadata only; module outPaths are unchanged.builtins.derivation(no stdenv), withoutputs = [ "out" ](required bynix print-dev-env),SHELL= nixpkgs bash, and noPATH.packagesis one list that mixes modules (nm.replit,nm.nodejs-24) and ordinary nixpkgs packages. Non-derivations fail with an assertion.replitModuleId):nix-support/replit-envis sourced in reverse order, so the first listed module wins, as withmkShell..replit[nix]packages:bin→PATH;lib→REPLIT_LD_LIBRARY_PATH,LDFLAGS/NIX_LDFLAGS(-L);lib/pkgconfig→PKG_CONFIG_PATH(_FOR_TARGET);share→XDG_DATA_DIRS;include→CFLAGS/NIX_CFLAGS_COMPILE(-isystem);lib/girepository-1.0→GI_TYPELIB_PATH. Uses the bin/lib/dev outputs, thepropagatedBuildInputsclosure and only existing dirs. Their stdenv setup hooks don't run, so this is not a fullmkShellreplacement.PATH(the legacy order) wherever they appear in the list; among themselves they keep list order.shellHook.Usage:
Test plan
nix evalof empty and[ nm.replit nm.nodejs-24 pkgs.jq ]shells (an interleaved order gives the same hook); module outPaths unchanged;nixpkgs-fmt --check;bash -non the generated hook;git diff --check.nix print-dev-envof a fixture flake (nm.replit,nm.nodejs-24,pkgs.jq; the single-list form produces the identical devShell derivation), evaluated as the runtime does: node v24.22.1, pnpm 10.26.1 and jq 1.7.1 onPATH;REPLIT_MODULES,npm_config_prefixand the rtld loader var are set; no compiler vars.PATHorder: jq, then the nodejs-24 module entries, then system tools. Node, pnpm and jq resolve.npm i bufferutil --build-from-sourcecompiled with the system gcc/make, and the addon loads.pkgs.ripgreptopackagesrepublished the env in about 2 minutes, andrg14.1.1 worked in new shells.Rollout
liboutput only; modules and existing outputs are unchanged.PATHrelies on the Replit runtime accepting it and ignoring Nix's/path-not-set. Consumers should adopt this helper only after that runtime change is live.~ written by ⠕ Replit