summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nix/libstore/build.cc3
-rw-r--r--nix/libstore/derivations.cc3
-rw-r--r--nix/libstore/derivations.hh2
-rw-r--r--nix/libstore/globals.cc6
-rw-r--r--nix/libstore/globals.hh4
-rw-r--r--nix/libstore/local-store.hh6
-rw-r--r--nix/libstore/optimise-store.cc3
-rw-r--r--nix/libstore/store-api.cc13
-rw-r--r--nix/libstore/store-api.hh2
-rw-r--r--nix/libutil/archive.cc2
-rw-r--r--nix/libutil/archive.hh2
-rw-r--r--nix/libutil/hash.cc4
-rw-r--r--nix/libutil/hash.hh7
-rw-r--r--nix/libutil/util.cc7
-rw-r--r--nix/libutil/util.hh8
-rw-r--r--nix/local.mk2
-rw-r--r--nix/nix-daemon/guix-daemon.cc17
-rw-r--r--nix/nix-daemon/nix-daemon.cc2
-rw-r--r--nix/nix-daemon/nix-daemon.hh (renamed from nix/nix-daemon/shared.hh)9
19 files changed, 30 insertions, 72 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 9010ca4e200..935f7aacf83 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -3367,9 +3367,6 @@ void DerivationGoal::registerOutputs()
3367} 3367}
3368 3368
3369 3369
3370string drvsLogDir = "drvs";
3371
3372
3373Path DerivationGoal::openLogFile() 3370Path DerivationGoal::openLogFile()
3374{ 3371{
3375 logSize = 0; 3372 logSize = 0;
diff --git a/nix/libstore/derivations.cc b/nix/libstore/derivations.cc
index f05296702b3..b6203b1e385 100644
--- a/nix/libstore/derivations.cc
+++ b/nix/libstore/derivations.cc
@@ -211,9 +211,6 @@ bool isFixedOutputDrv(const Derivation & drv)
211} 211}
212 212
213 213
214DrvHashes drvHashes;
215
216
217/* Returns the hash of a derivation modulo fixed-output 214/* Returns the hash of a derivation modulo fixed-output
218 subderivations. A fixed-output derivation is a derivation with one 215 subderivations. A fixed-output derivation is a derivation with one
219 output (`out') for which an expected hash and hash algorithm are 216 output (`out') for which an expected hash and hash algorithm are
diff --git a/nix/libstore/derivations.hh b/nix/libstore/derivations.hh
index 8d5e4d05d46..0fbab3a7a4a 100644
--- a/nix/libstore/derivations.hh
+++ b/nix/libstore/derivations.hh
@@ -77,7 +77,7 @@ Hash hashDerivationModulo(StoreAPI & store, Derivation drv);
77/* Memoisation of hashDerivationModulo(). */ 77/* Memoisation of hashDerivationModulo(). */
78typedef std::map<Path, Hash> DrvHashes; 78typedef std::map<Path, Hash> DrvHashes;
79 79
80extern DrvHashes drvHashes; 80inline DrvHashes drvHashes;
81 81
82/* Split a string specifying a derivation and a set of outputs 82/* Split a string specifying a derivation and a set of outputs
83 (/nix/store/hash-foo!out1,out2,...) into the derivation path and 83 (/nix/store/hash-foo!out1,out2,...) into the derivation path and
diff --git a/nix/libstore/globals.cc b/nix/libstore/globals.cc
index 8551fea56c0..885ba4eafc1 100644
--- a/nix/libstore/globals.cc
+++ b/nix/libstore/globals.cc
@@ -17,9 +17,6 @@ namespace nix {
17#define DEFAULT_SOCKET_PATH "/daemon-socket/socket" 17#define DEFAULT_SOCKET_PATH "/daemon-socket/socket"
18 18
19 19
20Settings settings;
21
22
23Settings::Settings() 20Settings::Settings()
24{ 21{
25 keepFailed = false; 22 keepFailed = false;
@@ -205,7 +202,4 @@ Settings::SettingsMap Settings::getOverrides()
205} 202}
206 203
207 204
208const string nixVersion = PACKAGE_VERSION;
209
210
211} 205}
diff --git a/nix/libstore/globals.hh b/nix/libstore/globals.hh
index 7cfa06e76c1..c2824789ede 100644
--- a/nix/libstore/globals.hh
+++ b/nix/libstore/globals.hh
@@ -227,10 +227,10 @@ private:
227 227
228 228
229// FIXME: don't use a global variable. 229// FIXME: don't use a global variable.
230extern Settings settings; 230inline Settings settings;
231 231
232 232
233extern const string nixVersion; 233inline const string nixVersion {PACKAGE_VERSION};
234 234
235 235
236} 236}
diff --git a/nix/libstore/local-store.hh b/nix/libstore/local-store.hh
index 20d3c3c8930..4d529b37a44 100644
--- a/nix/libstore/local-store.hh
+++ b/nix/libstore/local-store.hh
@@ -19,7 +19,7 @@ namespace nix {
19const int nixSchemaVersion = 7; 19const int nixSchemaVersion = 7;
20 20
21 21
22extern string drvsLogDir; 22inline std::string drvsLogDir {"drvs"};
23 23
24 24
25struct Derivation; 25struct Derivation;
@@ -293,6 +293,8 @@ void canonicaliseTimestampAndPermissions(const Path & path);
293MakeError(PathInUse, Error); 293MakeError(PathInUse, Error);
294 294
295/* Size below which a file is not considered for deduplication. */ 295/* Size below which a file is not considered for deduplication. */
296extern const size_t deduplicationMinSize; 296/* Any file smaller than this is not considered for deduplication.
297 Keep in sync with (guix store deduplication). */
298inline const size_t deduplicationMinSize {8192};
297 299
298} 300}
diff --git a/nix/libstore/optimise-store.cc b/nix/libstore/optimise-store.cc
index d69c43e9978..54aa166c344 100644
--- a/nix/libstore/optimise-store.cc
+++ b/nix/libstore/optimise-store.cc
@@ -16,9 +16,6 @@
16 16
17namespace nix { 17namespace nix {
18 18
19/* Any file smaller than this is not considered for deduplication.
20 Keep in sync with (guix store deduplication). */
21const size_t deduplicationMinSize = 8192;
22 19
23static void makeWritable(const Path & path) 20static void makeWritable(const Path & path)
24{ 21{
diff --git a/nix/libstore/store-api.cc b/nix/libstore/store-api.cc
index 1067e44a8e2..26d44f78b19 100644
--- a/nix/libstore/store-api.cc
+++ b/nix/libstore/store-api.cc
@@ -253,16 +253,3 @@ template<class T> T readStorePaths(Source & from)
253template PathSet readStorePaths(Source & from); 253template PathSet readStorePaths(Source & from);
254 254
255} 255}
256
257
258#include "local-store.hh"
259#include "serialise.hh"
260
261
262namespace nix {
263
264
265std::shared_ptr<StoreAPI> store;
266
267
268}
diff --git a/nix/libstore/store-api.hh b/nix/libstore/store-api.hh
index 32a8f2c795f..affa98b179d 100644
--- a/nix/libstore/store-api.hh
+++ b/nix/libstore/store-api.hh
@@ -363,7 +363,7 @@ Paths topoSortPaths(StoreAPI & store, const PathSet & paths);
363 363
364/* For now, there is a single global store API object, but we'll 364/* For now, there is a single global store API object, but we'll
365 purify that in the future. */ 365 purify that in the future. */
366extern std::shared_ptr<StoreAPI> store; 366inline std::shared_ptr<StoreAPI> store;
367 367
368 368
369/* Display a set of paths in human-readable form (i.e., between quotes 369/* Display a set of paths in human-readable form (i.e., between quotes
diff --git a/nix/libutil/archive.cc b/nix/libutil/archive.cc
index fa9f4398e3c..938fe8d4492 100644
--- a/nix/libutil/archive.cc
+++ b/nix/libutil/archive.cc
@@ -24,8 +24,6 @@ static string archiveVersion1 = "nix-archive-1";
24 24
25static string caseHackSuffix = "~nix~case~hack~"; 25static string caseHackSuffix = "~nix~case~hack~";
26 26
27PathFilter defaultPathFilter;
28
29 27
30static void dumpContents(const Path & path, size_t size, 28static void dumpContents(const Path & path, size_t size,
31 Sink & sink) 29 Sink & sink)
diff --git a/nix/libutil/archive.hh b/nix/libutil/archive.hh
index 9b83a5f288f..03716ab469f 100644
--- a/nix/libutil/archive.hh
+++ b/nix/libutil/archive.hh
@@ -50,7 +50,7 @@ struct PathFilter
50 virtual bool operator () (const Path & path) { return true; } 50 virtual bool operator () (const Path & path) { return true; }
51}; 51};
52 52
53extern PathFilter defaultPathFilter; 53inline PathFilter defaultPathFilter;
54 54
55void dumpPath(const Path & path, Sink & sink, 55void dumpPath(const Path & path, Sink & sink,
56 PathFilter & filter = defaultPathFilter); 56 PathFilter & filter = defaultPathFilter);
diff --git a/nix/libutil/hash.cc b/nix/libutil/hash.cc
index 57b369d4a9b..ac9eb14514b 100644
--- a/nix/libutil/hash.cc
+++ b/nix/libutil/hash.cc
@@ -103,10 +103,6 @@ unsigned int hashLength32(const Hash & hash)
103} 103}
104 104
105 105
106// omitted: E O U T
107const string base32Chars = "0123456789abcdfghijklmnpqrsvwxyz";
108
109
110string printHash32(const Hash & hash) 106string printHash32(const Hash & hash)
111{ 107{
112 Hash hash2(hash); 108 Hash hash2(hash);
diff --git a/nix/libutil/hash.hh b/nix/libutil/hash.hh
index 1a6b35f074b..cedb5077c16 100644
--- a/nix/libutil/hash.hh
+++ b/nix/libutil/hash.hh
@@ -2,14 +2,15 @@
2 2
3#include <gcrypt.h> 3#include <gcrypt.h>
4 4
5#include "archive.hh"
5#include "types.hh" 6#include "types.hh"
6#include "serialise.hh" 7#include "serialise.hh"
7 8
8 9
9namespace nix { 10namespace nix {
10 11
11 12// omitted: E O U T
12extern const string base32Chars; 13inline const string base32Chars {"0123456789abcdfghijklmnpqrsvwxyz"};
13 14
14typedef enum { 15typedef enum {
15 htUnknown = 0, 16 htUnknown = 0,
@@ -79,8 +80,6 @@ Hash hashFile(HashType ht, const Path & path);
79 80
80/* Compute the hash of the given path. The hash is defined as 81/* Compute the hash of the given path. The hash is defined as
81 (essentially) hashString(ht, dumpPath(path)). */ 82 (essentially) hashString(ht, dumpPath(path)). */
82struct PathFilter;
83extern PathFilter defaultPathFilter;
84typedef std::pair<Hash, unsigned long long> HashResult; 83typedef std::pair<Hash, unsigned long long> HashResult;
85HashResult hashPath(HashType ht, const Path & path, 84HashResult hashPath(HashType ht, const Path & path,
86 PathFilter & filter = defaultPathFilter); 85 PathFilter & filter = defaultPathFilter);
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc
index 22022db51a5..ed1a371dfe1 100644
--- a/nix/libutil/util.cc
+++ b/nix/libutil/util.cc
@@ -600,9 +600,6 @@ void createSymlink(const Path & target, const Path & link)
600} 600}
601 601
602 602
603LogType logType = ltPretty;
604Verbosity verbosity = lvlInfo;
605
606static int nestingLevel = 0; 603static int nestingLevel = 0;
607 604
608 605
@@ -691,9 +688,6 @@ void writeToStderr(const string & s)
691} 688}
692 689
693 690
694void (*_writeToStderr) (const unsigned char * buf, size_t count) = 0;
695
696
697void readFull(int fd, unsigned char * buf, size_t count) 691void readFull(int fd, unsigned char * buf, size_t count)
698{ 692{
699 while (count) { 693 while (count) {
@@ -1250,7 +1244,6 @@ void keepOnExec(int fd)
1250////////////////////////////////////////////////////////////////////// 1244//////////////////////////////////////////////////////////////////////
1251 1245
1252 1246
1253volatile sig_atomic_t _isInterrupted = 0;
1254 1247
1255void _interrupted() 1248void _interrupted()
1256{ 1249{
diff --git a/nix/libutil/util.hh b/nix/libutil/util.hh
index 436c378cb6e..42cb60ea0d4 100644
--- a/nix/libutil/util.hh
+++ b/nix/libutil/util.hh
@@ -132,8 +132,8 @@ typedef enum {
132 ltFlat /* no nesting */ 132 ltFlat /* no nesting */
133} LogType; 133} LogType;
134 134
135extern LogType logType; 135inline LogType logType {ltPretty};
136extern Verbosity verbosity; /* suppress msgs > this */ 136inline Verbosity verbosity {lvlInfo}; /* suppress msgs > this */
137 137
138class Nest 138class Nest
139{ 139{
@@ -167,7 +167,7 @@ void warnOnce(bool & haveWarned, std::string_view fs);
167 167
168void writeToStderr(const string & s); 168void writeToStderr(const string & s);
169 169
170extern void (*_writeToStderr) (const unsigned char * buf, size_t count); 170inline void (*_writeToStderr) (const unsigned char * buf, size_t count) = 0;
171 171
172 172
173/* Wrappers arount read()/write() that read/write exactly the 173/* Wrappers arount read()/write() that read/write exactly the
@@ -323,7 +323,7 @@ void commonChildInit(Pipe & logPipe);
323 323
324/* User interruption. */ 324/* User interruption. */
325 325
326extern volatile sig_atomic_t _isInterrupted; 326inline volatile sig_atomic_t _isInterrupted = 0;
327 327
328void _interrupted(); 328void _interrupted();
329 329
diff --git a/nix/local.mk b/nix/local.mk
index 819131b5d44..2c93670843c 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -113,7 +113,7 @@ guix_daemon_LDADD = \
113 $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS) 113 $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS)
114 114
115guix_daemon_headers = \ 115guix_daemon_headers = \
116 %D%/nix-daemon/shared.hh 116 %D%/nix-daemon/nix-daemon.hh
117 117
118if HAVE_LIBBZ2 118if HAVE_LIBBZ2
119 119
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index af09839932f..341e39c2907 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -17,12 +17,12 @@
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */ 18 along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include <config.h> 20#include "config.h"
21 21
22#include <types.hh> 22#include "types.hh"
23#include "shared.hh" 23#include "nix-daemon.hh"
24#include <globals.hh> 24#include "globals.hh"
25#include <util.hh> 25#include "util.hh"
26 26
27#include <gcrypt.h> 27#include <gcrypt.h>
28 28
@@ -36,20 +36,13 @@
36#include <netdb.h> 36#include <netdb.h>
37#include <strings.h> 37#include <strings.h>
38#include <exception> 38#include <exception>
39#include <iostream>
40#include <format> 39#include <format>
41 40
42#include <libintl.h> 41#include <libintl.h>
43#include <locale.h> 42#include <locale.h>
44 43
45/* Variables used by `nix-daemon.cc'. */
46volatile ::sig_atomic_t blockInt;
47char **argvSaved;
48
49using namespace nix; 44using namespace nix;
50 45
51/* Entry point in `nix-daemon.cc'. */
52extern void run (const std::vector<int> &);
53 46
54 47
55/* Command-line options. */ 48/* Command-line options. */
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 3890adb2c74..b3cdb699ac2 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -1,5 +1,5 @@
1#include "config.h" 1#include "config.h"
2#include "shared.hh" 2#include "nix-daemon.hh"
3#include "local-store.hh" 3#include "local-store.hh"
4#include "util.hh" 4#include "util.hh"
5#include "serialise.hh" 5#include "serialise.hh"
diff --git a/nix/nix-daemon/shared.hh b/nix/nix-daemon/nix-daemon.hh
index 98ec97410b7..8791c4f21fd 100644
--- a/nix/nix-daemon/shared.hh
+++ b/nix/nix-daemon/nix-daemon.hh
@@ -20,9 +20,14 @@
20 20
21#pragma once 21#pragma once
22 22
23#include <vector>
24
23#include <stdlib.h> 25#include <stdlib.h>
24#include <signal.h> 26#include <signal.h>
25 27
26extern volatile ::sig_atomic_t blockInt; 28/* Variables used by `nix-daemon.cc'. */
29inline volatile ::sig_atomic_t blockInt;
30inline char **argvSaved;
27 31
28extern char **argvSaved; 32/* Entry point in `nix-daemon.cc'. */
33void run (const std::vector<int> &);