aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
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;