Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a0b971dd9c19
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c87f4b9324b8
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 9, 2018

  1. nix run: Respect propagated-user-env-packages

    Also, add $path/bin to $PATH even if it doesn't exist. This makes
    'man' work properly (since it looks for ../share/man relative to $PATH
    entries).
    edolstra committed Aug 9, 2018

    Verified

    This commit was signed with the committer’s verified signature.
    edolstra Eelco Dolstra
    Copy the full SHA
    c87f4b9 View commit details
Showing with 21 additions and 2 deletions.
  1. +21 −2 src/nix/run.cc
23 changes: 21 additions & 2 deletions src/nix/run.cc
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@
#include <sys/mount.h>
#endif

#include <queue>

using namespace nix;

std::string chrootHelperName = "__run_in_chroot";
@@ -121,10 +123,27 @@ struct CmdRun : InstallablesCommand
unsetenv(var.c_str());
}

std::unordered_set<Path> done;
std::queue<Path> todo;
for (auto & path : outPaths) todo.push(path);

auto unixPath = tokenizeString<Strings>(getEnv("PATH"), ":");
for (auto & path : outPaths)
if (accessor->stat(path + "/bin").type != FSAccessor::tMissing)

while (!todo.empty()) {
Path path = todo.front();
todo.pop();
if (!done.insert(path).second) continue;

if (true)
unixPath.push_front(path + "/bin");

auto propPath = path + "/nix-support/propagated-user-env-packages";
if (accessor->stat(propPath).type == FSAccessor::tRegular) {
for (auto & p : tokenizeString<Paths>(readFile(propPath)))
todo.push(p);
}
}

setenv("PATH", concatStringsSep(":", unixPath).c_str(), 1);

std::string cmd = *command.begin();