aboutsummaryrefslogtreecommitdiff
path: root/src/nix-channel
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-07-24 14:02:05 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-08-02 12:54:48 -0400
commit9b908fa70a07219a110ddd63ec3593c2c2269918 (patch)
tree484f4a4fb02229f0ce79ba40cfd7945fad1e7896 /src/nix-channel
parentd00469ebf94dba4ae30120c1ba36085ac20443b8 (diff)
Factor out `nix-defexpr` path computation
Avoid duplicated code, and also avoid "on the fly" path construction (which makes it harder to keep track of which paths we use). The factored out code doesn't create the Nix state dir anymore, but this is fine because other in nix-env and nix-channel does: - nix-channel: Line 158 in this commit - nix-env: Line 1407 in this commit
Diffstat (limited to 'src/nix-channel')
-rwxr-xr-xsrc/nix-channel/nix-channel.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nix-channel/nix-channel.cc b/src/nix-channel/nix-channel.cc
index c1c8edd1d..95f401441 100755
--- a/src/nix-channel/nix-channel.cc
+++ b/src/nix-channel/nix-channel.cc
@@ -5,6 +5,7 @@
#include "store-api.hh"
#include "legacy.hh"
#include "fetchers.hh"
+#include "eval-settings.hh" // for defexpr
#include "util.hh"
#include <fcntl.h>
@@ -165,7 +166,7 @@ static int main_nix_channel(int argc, char ** argv)
// Figure out the name of the `.nix-channels' file to use
auto home = getHome();
channelsList = settings.useXDGBaseDirectories ? createNixStateDir() + "/channels" : home + "/.nix-channels";
- nixDefExpr = settings.useXDGBaseDirectories ? createNixStateDir() + "/defexpr" : home + "/.nix-defexpr";
+ nixDefExpr = getNixDefExpr();
// Figure out the name of the channels profile.
profile = profilesDir() + "/channels";