Browse Source

daemon: Add "/guix" to default 'nixLibexecDir'.

This makes it easier to run the uninstalled daemon.

* nix/local.mk (libstore_a_CPPFLAGS): Append "/guix" to
NIX_LIBEXEC_DIR.
* build-aux/pre-inst-env.in (NIX_LIBEXEC_DIR): Adjust comment.
* nix/libstore/builtins.cc (builtinDownload): Remove SUBDIR and its
use.
* nix/libstore/local-store.cc (runAuthenticationProgram): Ditto.
* nix/libstore/gc.cc (addAdditionalRoots): Remove "/guix" prefix.
* nix/nix-daemon/guix-daemon.cc (main): Ditto.
wip-deploy2
Ludovic Courtès 3 years ago
parent
commit
959eaa1eb8
No known key found for this signature in database GPG Key ID: 90B11993D9AEBB5
  1. 2
      build-aux/pre-inst-env.in
  2. 10
      nix/libstore/builtins.cc
  3. 2
      nix/libstore/gc.cc
  4. 10
      nix/libstore/local-store.cc
  5. 2
      nix/local.mk
  6. 14
      nix/nix-daemon/guix-daemon.cc

2
build-aux/pre-inst-env.in

@ -45,7 +45,7 @@ export PATH
# Daemon helpers.
NIX_ROOT_FINDER="$abs_top_builddir/nix/scripts/list-runtime-roots"
NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'guix-authenticate'
NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'authenticate', etc.
export NIX_ROOT_FINDER NIX_LIBEXEC_DIR

10
nix/libstore/builtins.cc

@ -1,5 +1,5 @@
/* GNU Guix --- Functional package management for GNU
Copyright (C) 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
Copyright (C) 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
This file is part of GNU Guix.
@ -50,13 +50,7 @@ static void builtinDownload(const Derivation &drv,
/* Tell it about options such as "print-extended-build-trace". */
setenv("_NIX_OPTIONS", settings.pack().c_str(), 1);
/* XXX: Hack our way to use the 'download' script from 'LIBEXECDIR/guix'
or just 'LIBEXECDIR', depending on whether we're running uninstalled or
not. */
const string subdir = getenv("GUIX_UNINSTALLED") != NULL
? "" : "/guix";
const string program = settings.nixLibexecDir + subdir + "/download";
const string program = settings.nixLibexecDir + "/download";
execv(program.c_str(), (char *const *) argv);
throw SysError(format("failed to run download program '%1%'") % program);

2
nix/libstore/gc.cc

@ -340,7 +340,7 @@ Roots LocalStore::findRoots()
static void addAdditionalRoots(StoreAPI & store, PathSet & roots)
{
Path rootFinder = getEnv("NIX_ROOT_FINDER",
settings.nixLibexecDir + "/guix/list-runtime-roots");
settings.nixLibexecDir + "/list-runtime-roots");
if (rootFinder.empty()) return;

10
nix/libstore/local-store.cc

@ -1224,14 +1224,8 @@ static void checkSecrecy(const Path & path)
static std::string runAuthenticationProgram(const Strings & args)
{
/* Use the 'authenticate' script from 'LIBEXECDIR/guix' or just
'LIBEXECDIR', depending on whether we're uninstalled or not. */
const bool installed = getenv("GUIX_UNINSTALLED") == NULL;
const string program = settings.nixLibexecDir
+ (installed ? "/guix" : "")
+ "/authenticate";
return runProgram(program, false, args);
return runProgram(settings.nixLibexecDir + "/authenticate",
false, args);
}
void LocalStore::exportPath(const Path & path, bool sign,

2
nix/local.mk

@ -110,7 +110,7 @@ libstore_a_CPPFLAGS = \
-DNIX_STATE_DIR=\"$(localstatedir)/guix\" \
-DNIX_LOG_DIR=\"$(localstatedir)/log/guix\" \
-DGUIX_CONFIGURATION_DIRECTORY=\"$(sysconfdir)/guix\" \
-DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \
-DNIX_LIBEXEC_DIR=\"$(libexecdir)/guix\" \
-DNIX_BIN_DIR=\"$(bindir)\" \
-DDEFAULT_CHROOT_DIRS="\"\""

14
nix/nix-daemon/guix-daemon.cc

@ -480,7 +480,7 @@ main (int argc, char *argv[])
{
std::string build_hook;
build_hook = settings.nixLibexecDir + "/guix/offload";
build_hook = settings.nixLibexecDir + "/offload";
setenv ("NIX_BUILD_HOOK", build_hook.c_str (), 1);
}
#else
@ -498,16 +498,8 @@ main (int argc, char *argv[])
format ("build log compression: %1%") % settings.logCompression);
if (settings.useSubstitutes)
{
/* XXX: Hack our way to use the 'substitute' script from
'LIBEXECDIR/guix' or just 'LIBEXECDIR', depending on whether
we're running uninstalled or not. */
const string subdir = getenv("GUIX_UNINSTALLED") != NULL
? "" : "/guix";
settings.substituters.push_back (settings.nixLibexecDir
+ subdir + "/substitute");
}
settings.substituters.push_back (settings.nixLibexecDir
+ "/substitute");
else
/* Clear the substituter list to make sure nothing ever gets
substituted, regardless of the client's settings. */

Loading…
Cancel
Save