aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-12-04 00:31:09 +0100
committerEelco Dolstra <edolstra@gmail.com>2019-12-04 00:31:09 +0100
commitc3c23a52ee1c5844343bc5ed075791ec7fec6413 (patch)
treebaf65223d87d2a5a5030f88208ceebab790624da /src/nix
parente721f99817bb7154d8098c902e25f84521a90b7f (diff)
parentc1d18050b4cfed9eba68d4d21b397c6cce035e37 (diff)
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/command.cc2
-rw-r--r--src/nix/command.hh2
-rw-r--r--src/nix/doctor.cc4
-rw-r--r--src/nix/run.cc2
-rw-r--r--src/nix/shell.cc2
-rw-r--r--src/nix/upgrade-nix.cc2
6 files changed, 7 insertions, 7 deletions
diff --git a/src/nix/command.cc b/src/nix/command.cc
index 4520309cd..de761166b 100644
--- a/src/nix/command.cc
+++ b/src/nix/command.cc
@@ -85,7 +85,7 @@ void StorePathCommand::run(ref<Store> store)
Strings editorFor(const Pos & pos)
{
- auto editor = getEnv("EDITOR", "cat");
+ auto editor = getEnv("EDITOR").value_or("cat");
auto args = tokenizeString<Strings>(editor);
if (pos.line > 0 && (
editor.find("emacs") != std::string::npos ||
diff --git a/src/nix/command.hh b/src/nix/command.hh
index 16f8997dd..4f3f6eb9e 100644
--- a/src/nix/command.hh
+++ b/src/nix/command.hh
@@ -213,4 +213,4 @@ struct MixEnvironment : virtual Args {
void setEnviron();
};
-} \ No newline at end of file
+}
diff --git a/src/nix/doctor.cc b/src/nix/doctor.cc
index 5f76d0019..0aa634d6e 100644
--- a/src/nix/doctor.cc
+++ b/src/nix/doctor.cc
@@ -63,7 +63,7 @@ struct CmdDoctor : StoreCommand
{
PathSet dirs;
- for (auto & dir : tokenizeString<Strings>(getEnv("PATH"), ":"))
+ for (auto & dir : tokenizeString<Strings>(getEnv("PATH").value_or(""), ":"))
if (pathExists(dir + "/nix-env"))
dirs.insert(dirOf(canonPath(dir + "/nix-env", true)));
@@ -82,7 +82,7 @@ struct CmdDoctor : StoreCommand
{
PathSet dirs;
- for (auto & dir : tokenizeString<Strings>(getEnv("PATH"), ":")) {
+ for (auto & dir : tokenizeString<Strings>(getEnv("PATH").value_or(""), ":")) {
Path profileDir = dirOf(dir);
try {
Path userEnv = canonPath(profileDir, true);
diff --git a/src/nix/run.cc b/src/nix/run.cc
index 0fbd0b8a8..2865f5bbb 100644
--- a/src/nix/run.cc
+++ b/src/nix/run.cc
@@ -115,7 +115,7 @@ struct CmdRun : InstallablesCommand, RunCommon, MixEnvironment
setEnviron();
- auto unixPath = tokenizeString<Strings>(getEnv("PATH"), ":");
+ auto unixPath = tokenizeString<Strings>(getEnv("PATH").value_or(""), ":");
while (!todo.empty()) {
Path path = todo.front();
diff --git a/src/nix/shell.cc b/src/nix/shell.cc
index 2c5142518..6d5f1603c 100644
--- a/src/nix/shell.cc
+++ b/src/nix/shell.cc
@@ -275,7 +275,7 @@ struct CmdDevShell : Common, MixEnvironment
stopProgressBar();
- auto shell = getEnv("SHELL", "bash");
+ auto shell = getEnv("SHELL").value_or("bash");
setEnviron();
diff --git a/src/nix/upgrade-nix.cc b/src/nix/upgrade-nix.cc
index 13d8504a6..e6c369a7c 100644
--- a/src/nix/upgrade-nix.cc
+++ b/src/nix/upgrade-nix.cc
@@ -101,7 +101,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
{
Path where;
- for (auto & dir : tokenizeString<Strings>(getEnv("PATH"), ":"))
+ for (auto & dir : tokenizeString<Strings>(getEnv("PATH").value_or(""), ":"))
if (pathExists(dir + "/nix-env")) {
where = dir;
break;