diff options
| -rw-r--r-- | nix/libstore/build.cc | 3 | ||||
| -rw-r--r-- | nix/libstore/derivations.cc | 3 | ||||
| -rw-r--r-- | nix/libstore/derivations.hh | 2 | ||||
| -rw-r--r-- | nix/libstore/globals.cc | 6 | ||||
| -rw-r--r-- | nix/libstore/globals.hh | 4 | ||||
| -rw-r--r-- | nix/libstore/local-store.hh | 6 | ||||
| -rw-r--r-- | nix/libstore/optimise-store.cc | 3 | ||||
| -rw-r--r-- | nix/libstore/store-api.cc | 13 | ||||
| -rw-r--r-- | nix/libstore/store-api.hh | 2 | ||||
| -rw-r--r-- | nix/libutil/archive.cc | 2 | ||||
| -rw-r--r-- | nix/libutil/archive.hh | 2 | ||||
| -rw-r--r-- | nix/libutil/hash.cc | 4 | ||||
| -rw-r--r-- | nix/libutil/hash.hh | 7 | ||||
| -rw-r--r-- | nix/libutil/util.cc | 7 | ||||
| -rw-r--r-- | nix/libutil/util.hh | 8 | ||||
| -rw-r--r-- | nix/local.mk | 2 | ||||
| -rw-r--r-- | nix/nix-daemon/guix-daemon.cc | 17 | ||||
| -rw-r--r-- | nix/nix-daemon/nix-daemon.cc | 2 | ||||
| -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 | ||
| 3370 | string drvsLogDir = "drvs"; | ||
| 3371 | |||
| 3372 | |||
| 3373 | Path DerivationGoal::openLogFile() | 3370 | Path 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 | ||
| 214 | DrvHashes 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(). */ |
| 78 | typedef std::map<Path, Hash> DrvHashes; | 78 | typedef std::map<Path, Hash> DrvHashes; |
| 79 | 79 | ||
| 80 | extern DrvHashes drvHashes; | 80 | inline 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 | ||
| 20 | Settings settings; | ||
| 21 | |||
| 22 | |||
| 23 | Settings::Settings() | 20 | Settings::Settings() |
| 24 | { | 21 | { |
| 25 | keepFailed = false; | 22 | keepFailed = false; |
| @@ -205,7 +202,4 @@ Settings::SettingsMap Settings::getOverrides() | |||
| 205 | } | 202 | } |
| 206 | 203 | ||
| 207 | 204 | ||
| 208 | const 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. |
| 230 | extern Settings settings; | 230 | inline Settings settings; |
| 231 | 231 | ||
| 232 | 232 | ||
| 233 | extern const string nixVersion; | 233 | inline 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 { | |||
| 19 | const int nixSchemaVersion = 7; | 19 | const int nixSchemaVersion = 7; |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | extern string drvsLogDir; | 22 | inline std::string drvsLogDir {"drvs"}; |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | struct Derivation; | 25 | struct Derivation; |
| @@ -293,6 +293,8 @@ void canonicaliseTimestampAndPermissions(const Path & path); | |||
| 293 | MakeError(PathInUse, Error); | 293 | MakeError(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. */ |
| 296 | extern const size_t deduplicationMinSize; | 296 | /* Any file smaller than this is not considered for deduplication. |
| 297 | Keep in sync with (guix store deduplication). */ | ||
| 298 | inline 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 | ||
| 17 | namespace nix { | 17 | namespace nix { |
| 18 | 18 | ||
| 19 | /* Any file smaller than this is not considered for deduplication. | ||
| 20 | Keep in sync with (guix store deduplication). */ | ||
| 21 | const size_t deduplicationMinSize = 8192; | ||
| 22 | 19 | ||
| 23 | static void makeWritable(const Path & path) | 20 | static 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) | |||
| 253 | template PathSet readStorePaths(Source & from); | 253 | template PathSet readStorePaths(Source & from); |
| 254 | 254 | ||
| 255 | } | 255 | } |
| 256 | |||
| 257 | |||
| 258 | #include "local-store.hh" | ||
| 259 | #include "serialise.hh" | ||
| 260 | |||
| 261 | |||
| 262 | namespace nix { | ||
| 263 | |||
| 264 | |||
| 265 | std::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. */ |
| 366 | extern std::shared_ptr<StoreAPI> store; | 366 | inline 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 | ||
| 25 | static string caseHackSuffix = "~nix~case~hack~"; | 25 | static string caseHackSuffix = "~nix~case~hack~"; |
| 26 | 26 | ||
| 27 | PathFilter defaultPathFilter; | ||
| 28 | |||
| 29 | 27 | ||
| 30 | static void dumpContents(const Path & path, size_t size, | 28 | static 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 | ||
| 53 | extern PathFilter defaultPathFilter; | 53 | inline PathFilter defaultPathFilter; |
| 54 | 54 | ||
| 55 | void dumpPath(const Path & path, Sink & sink, | 55 | void 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 | ||
| 107 | const string base32Chars = "0123456789abcdfghijklmnpqrsvwxyz"; | ||
| 108 | |||
| 109 | |||
| 110 | string printHash32(const Hash & hash) | 106 | string 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 | ||
| 9 | namespace nix { | 10 | namespace nix { |
| 10 | 11 | ||
| 11 | 12 | // omitted: E O U T | |
| 12 | extern const string base32Chars; | 13 | inline const string base32Chars {"0123456789abcdfghijklmnpqrsvwxyz"}; |
| 13 | 14 | ||
| 14 | typedef enum { | 15 | typedef 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)). */ |
| 82 | struct PathFilter; | ||
| 83 | extern PathFilter defaultPathFilter; | ||
| 84 | typedef std::pair<Hash, unsigned long long> HashResult; | 83 | typedef std::pair<Hash, unsigned long long> HashResult; |
| 85 | HashResult hashPath(HashType ht, const Path & path, | 84 | HashResult 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 | ||
| 603 | LogType logType = ltPretty; | ||
| 604 | Verbosity verbosity = lvlInfo; | ||
| 605 | |||
| 606 | static int nestingLevel = 0; | 603 | static int nestingLevel = 0; |
| 607 | 604 | ||
| 608 | 605 | ||
| @@ -691,9 +688,6 @@ void writeToStderr(const string & s) | |||
| 691 | } | 688 | } |
| 692 | 689 | ||
| 693 | 690 | ||
| 694 | void (*_writeToStderr) (const unsigned char * buf, size_t count) = 0; | ||
| 695 | |||
| 696 | |||
| 697 | void readFull(int fd, unsigned char * buf, size_t count) | 691 | void 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 | ||
| 1253 | volatile sig_atomic_t _isInterrupted = 0; | ||
| 1254 | 1247 | ||
| 1255 | void _interrupted() | 1248 | void _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 | ||
| 135 | extern LogType logType; | 135 | inline LogType logType {ltPretty}; |
| 136 | extern Verbosity verbosity; /* suppress msgs > this */ | 136 | inline Verbosity verbosity {lvlInfo}; /* suppress msgs > this */ |
| 137 | 137 | ||
| 138 | class Nest | 138 | class Nest |
| 139 | { | 139 | { |
| @@ -167,7 +167,7 @@ void warnOnce(bool & haveWarned, std::string_view fs); | |||
| 167 | 167 | ||
| 168 | void writeToStderr(const string & s); | 168 | void writeToStderr(const string & s); |
| 169 | 169 | ||
| 170 | extern void (*_writeToStderr) (const unsigned char * buf, size_t count); | 170 | inline 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 | ||
| 326 | extern volatile sig_atomic_t _isInterrupted; | 326 | inline volatile sig_atomic_t _isInterrupted = 0; |
| 327 | 327 | ||
| 328 | void _interrupted(); | 328 | void _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 | ||
| 115 | guix_daemon_headers = \ | 115 | guix_daemon_headers = \ |
| 116 | %D%/nix-daemon/shared.hh | 116 | %D%/nix-daemon/nix-daemon.hh |
| 117 | 117 | ||
| 118 | if HAVE_LIBBZ2 | 118 | if 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'. */ | ||
| 46 | volatile ::sig_atomic_t blockInt; | ||
| 47 | char **argvSaved; | ||
| 48 | |||
| 49 | using namespace nix; | 44 | using namespace nix; |
| 50 | 45 | ||
| 51 | /* Entry point in `nix-daemon.cc'. */ | ||
| 52 | extern 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 | ||
| 26 | extern volatile ::sig_atomic_t blockInt; | 28 | /* Variables used by `nix-daemon.cc'. */ |
| 29 | inline volatile ::sig_atomic_t blockInt; | ||
| 30 | inline char **argvSaved; | ||
| 27 | 31 | ||
| 28 | extern char **argvSaved; | 32 | /* Entry point in `nix-daemon.cc'. */ |
| 33 | void run (const std::vector<int> &); | ||
