id int64 0 755k | file_name stringlengths 3 109 | file_path stringlengths 13 185 | content stringlengths 31 9.38M | size int64 31 9.38M | language stringclasses 1
value | extension stringclasses 11
values | total_lines int64 1 340k | avg_line_length float64 2.18 149k | max_line_length int64 7 2.22M | alphanum_fraction float64 0 1 | repo_name stringlengths 6 65 | repo_stars int64 100 47.3k | repo_forks int64 0 12k | repo_open_issues int64 0 3.4k | repo_license stringclasses 9
values | repo_extraction_date stringclasses 92
values | exact_duplicates_redpajama bool 2
classes | near_duplicates_redpajama bool 2
classes | exact_duplicates_githubcode bool 2
classes | exact_duplicates_stackv2 bool 1
class | exact_duplicates_stackv1 bool 2
classes | near_duplicates_githubcode bool 2
classes | near_duplicates_stackv1 bool 2
classes | near_duplicates_stackv2 bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,143 | profiles.hh | NixOS_nix/src/libstore/profiles.hh | #pragma once
/**
* @file
*
* Implementation of Profiles.
*
* See the manual for additional information.
*/
#include "types.hh"
#include "pathlocks.hh"
#include <optional>
#include <time.h>
namespace nix {
class StorePath;
/**
* A positive number identifying a generation for a given profile.
*
* Generati... | 7,084 | C++ | .h | 210 | 31.385714 | 124 | 0.745909 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,144 | store-api.hh | NixOS_nix/src/libstore/store-api.hh | #pragma once
///@file
#include "path.hh"
#include "derived-path.hh"
#include "hash.hh"
#include "content-address.hh"
#include "serialise.hh"
#include "lru-cache.hh"
#include "sync.hh"
#include "globals.hh"
#include "config.hh"
#include "path-info.hh"
#include "repair-flag.hh"
#include "store-dir-config.hh"
#include "s... | 30,794 | C++ | .h | 795 | 33.089308 | 157 | 0.683251 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,145 | ssh.hh | NixOS_nix/src/libstore/ssh.hh | #pragma once
///@file
#include "sync.hh"
#include "processes.hh"
#include "file-system.hh"
namespace nix {
class SSHMaster
{
private:
const std::string host;
bool fakeSSH;
const std::string keyFile;
/**
* Raw bytes, not Base64 encoding.
*/
const std::string sshPublicHostKey;
const ... | 1,536 | C++ | .h | 58 | 21.603448 | 78 | 0.665529 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,146 | fchmodat2-compat.hh | NixOS_nix/src/libstore/linux/fchmodat2-compat.hh | /*
* Determine the syscall number for `fchmodat2`.
*
* On most platforms this is 452. Exceptions can be found on
* a glibc git checkout via `rg --pcre2 'define __NR_fchmodat2 (?!452)'`.
*
* The problem is that glibc 2.39 and libseccomp 2.5.5 are needed to
* get the syscall number. However, a Nix built against ni... | 1,287 | C++ | .h | 33 | 37.454545 | 80 | 0.710295 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,147 | personality.hh | NixOS_nix/src/libstore/linux/personality.hh | #pragma once
///@file
#include <string>
namespace nix::linux {
void setPersonality(std::string_view system);
}
| 117 | C++ | .h | 6 | 17.5 | 45 | 0.771429 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,148 | buildenv.hh | NixOS_nix/src/libstore/builtins/buildenv.hh | #pragma once
///@file
#include "store-api.hh"
namespace nix {
/**
* Think of this as a "store level package attrset", but stripped down to no more than the needs of buildenv.
*/
struct Package {
Path path;
bool active;
int priority;
Package(const Path & path, bool active, int priority) : path{path}... | 1,094 | C++ | .h | 43 | 19.906977 | 109 | 0.62476 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,149 | user-lock.hh | NixOS_nix/src/libstore/unix/user-lock.hh | #pragma once
///@file
#include <memory>
#include <vector>
#include <sys/types.h>
namespace nix {
struct UserLock
{
virtual ~UserLock() { }
/**
* Get the first and last UID.
*/
std::pair<uid_t, uid_t> getUIDRange()
{
auto first = getUID();
return {first, first + getUIDCount(... | 775 | C++ | .h | 32 | 20.40625 | 78 | 0.639344 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,150 | child.hh | NixOS_nix/src/libstore/unix/build/child.hh | #pragma once
///@file
namespace nix {
/**
* Common initialisation performed in child processes.
*/
void commonChildInit();
}
| 130 | C++ | .h | 8 | 14.625 | 54 | 0.756303 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,151 | local-derivation-goal.hh | NixOS_nix/src/libstore/unix/build/local-derivation-goal.hh | #pragma once
///@file
#include "derivation-goal.hh"
#include "local-store.hh"
#include "processes.hh"
namespace nix {
struct LocalDerivationGoal : public DerivationGoal
{
LocalStore & getLocalStore();
/**
* User selected for running the builder.
*/
std::unique_ptr<UserLock> buildUser;
/**... | 8,139 | C++ | .h | 264 | 25.193182 | 134 | 0.658605 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,152 | hook-instance.hh | NixOS_nix/src/libstore/unix/build/hook-instance.hh | #pragma once
///@file
#include "logging.hh"
#include "serialise.hh"
#include "processes.hh"
namespace nix {
struct HookInstance
{
/**
* Pipes for talking to the build hook.
*/
Pipe toHook;
/**
* Pipe for the hook's standard output/error.
*/
Pipe fromHook;
/**
* Pipe for... | 567 | C++ | .h | 30 | 14.6 | 52 | 0.621673 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,153 | substitution-goal.hh | NixOS_nix/src/libstore/build/substitution-goal.hh | #pragma once
///@file
#include "worker.hh"
#include "store-api.hh"
#include "goal.hh"
#include "muxable-pipe.hh"
#include <coroutine>
#include <future>
#include <source_location>
namespace nix {
struct PathSubstitutionGoal : public Goal
{
/**
* The store path that should be realised through a substitute.
... | 2,120 | C++ | .h | 69 | 25.753623 | 150 | 0.674041 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,154 | drv-output-substitution-goal.hh | NixOS_nix/src/libstore/build/drv-output-substitution-goal.hh | #pragma once
///@file
#include <thread>
#include <future>
#include "store-api.hh"
#include "goal.hh"
#include "realisation.hh"
#include "muxable-pipe.hh"
namespace nix {
class Worker;
/**
* Substitution of a derivation output.
* This is done in three steps:
* 1. Fetch the output info from a substituter
* 2. Su... | 1,132 | C++ | .h | 36 | 28.055556 | 147 | 0.728281 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,155 | derivation-goal.hh | NixOS_nix/src/libstore/build/derivation-goal.hh | #pragma once
///@file
#include "parsed-derivations.hh"
#ifndef _WIN32
# include "user-lock.hh"
#endif
#include "outputs-spec.hh"
#include "store-api.hh"
#include "pathlocks.hh"
#include "goal.hh"
namespace nix {
using std::map;
#ifndef _WIN32 // TODO enable build hook on Windows
struct HookInstance;
#endif
typede... | 8,796 | C++ | .h | 284 | 25.295775 | 96 | 0.666193 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,156 | worker.hh | NixOS_nix/src/libstore/build/worker.hh | #pragma once
///@file
#include "types.hh"
#include "store-api.hh"
#include "goal.hh"
#include "realisation.hh"
#include "muxable-pipe.hh"
#include <future>
#include <thread>
namespace nix {
/* Forward definition. */
struct DerivationGoal;
struct PathSubstitutionGoal;
class DrvOutputSubstitutionGoal;
/**
* Workaro... | 9,104 | C++ | .h | 276 | 27.992754 | 178 | 0.682357 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,157 | goal.hh | NixOS_nix/src/libstore/build/goal.hh | #pragma once
///@file
#include "store-api.hh"
#include "build-result.hh"
#include <coroutine>
namespace nix {
/**
* Forward definition.
*/
struct Goal;
class Worker;
/**
* A pointer to a goal.
*/
typedef std::shared_ptr<Goal> GoalPtr;
typedef std::weak_ptr<Goal> WeakGoalPtr;
struct CompareGoalPtrs {
bool ... | 13,771 | C++ | .h | 379 | 29.585752 | 111 | 0.621267 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,158 | nix_api_store_internal.h | NixOS_nix/src/libstore-c/nix_api_store_internal.h | #ifndef NIX_API_STORE_INTERNAL_H
#define NIX_API_STORE_INTERNAL_H
#include "store-api.hh"
struct Store
{
nix::ref<nix::Store> ptr;
};
struct StorePath
{
nix::StorePath path;
};
#endif
| 195 | C++ | .h | 12 | 14.333333 | 32 | 0.738889 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,159 | nix_api_store.h | NixOS_nix/src/libstore-c/nix_api_store.h | #ifndef NIX_API_STORE_H
#define NIX_API_STORE_H
/**
* @defgroup libstore libstore
* @brief C bindings for nix libstore
*
* libstore is used for talking to a Nix store
* @{
*/
/** @file
* @brief Main entry for the libstore C bindings
*/
#include "nix_api_util.h"
#include <stdbool.h>
#ifdef __cplusplus
extern "... | 5,891 | C++ | .h | 165 | 33.818182 | 119 | 0.725744 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,160 | libexpr.hh | NixOS_nix/src/libexpr-test-support/tests/libexpr.hh | #pragma once
///@file
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "fetch-settings.hh"
#include "value.hh"
#include "nixexpr.hh"
#include "nixexpr.hh"
#include "eval.hh"
#include "eval-gc.hh"
#include "eval-inline.hh"
#include "eval-settings.hh"
#include "tests/libstore.hh"
namespace nix {
class L... | 4,013 | C++ | .h | 126 | 22.595238 | 109 | 0.499094 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,161 | nix_api_expr.hh | NixOS_nix/src/libexpr-test-support/tests/nix_api_expr.hh | #pragma once
///@file
#include "nix_api_expr.h"
#include "nix_api_value.h"
#include "tests/nix_api_store.hh"
#include <gtest/gtest.h>
namespace nixC {
class nix_api_expr_test : public nix_api_store_test
{
protected:
nix_api_expr_test()
{
nix_libexpr_init(ctx);
state = nix_state_create(nullpt... | 555 | C++ | .h | 25 | 18.08 | 58 | 0.641221 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,162 | context.hh | NixOS_nix/src/libexpr-test-support/tests/value/context.hh | #pragma once
///@file
#include <rapidcheck/gen/Arbitrary.h>
#include "value/context.hh"
namespace rc {
using namespace nix;
template<>
struct Arbitrary<NixStringContextElem::Opaque> {
static Gen<NixStringContextElem::Opaque> arbitrary();
};
template<>
struct Arbitrary<NixStringContextElem::Built> {
static ... | 602 | C++ | .h | 23 | 24.130435 | 58 | 0.793345 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,163 | variant-wrapper.hh | NixOS_nix/src/libutil/variant-wrapper.hh | #pragma once
///@file
// not used, but will be used by callers
#include <variant>
/**
* Force the default versions of all constructors (copy, move, copy
* assignment).
*/
#define FORCE_DEFAULT_CONSTRUCTORS(CLASS_NAME) \
CLASS_NAME(const CLASS_NAME &) = default; \
CLASS_NAME(CLASS_NAME &) = default; \
C... | 859 | C++ | .h | 27 | 28.62963 | 70 | 0.66345 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,164 | tarfile.hh | NixOS_nix/src/libutil/tarfile.hh | #pragma once
///@file
#include "serialise.hh"
#include "fs-sink.hh"
#include <archive.h>
namespace nix {
struct TarArchive
{
struct archive * archive;
Source * source;
std::vector<unsigned char> buffer;
void check(int err, const std::string & reason = "failed to extract archive (%s)");
explicit... | 1,504 | C++ | .h | 32 | 43.3125 | 112 | 0.728395 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,165 | config.hh | NixOS_nix/src/libutil/config.hh | #pragma once
///@file
#include <cassert>
#include <map>
#include <set>
#include <nlohmann/json_fwd.hpp>
#include "types.hh"
#include "experimental-features.hh"
namespace nix {
/**
* The Config class provides Nix runtime configurations.
*
* What is a Configuration?
* A collection of uniquely named Settings.
... | 11,579 | C++ | .h | 335 | 29.749254 | 119 | 0.669865 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,166 | file-path.hh | NixOS_nix/src/libutil/file-path.hh | #pragma once
///@file
#include <filesystem>
#include "types.hh"
#include "os-string.hh"
namespace nix {
/**
* Paths are just `std::filesystem::path`s.
*
* @todo drop `NG` suffix and replace the ones in `types.hh`.
*/
typedef std::list<std::filesystem::path> PathsNG;
typedef std::set<std::filesystem::path> PathS... | 998 | C++ | .h | 35 | 25.542857 | 71 | 0.692955 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,167 | exec.hh | NixOS_nix/src/libutil/exec.hh | #pragma once
#include "os-string.hh"
namespace nix {
/**
* `execvpe` is a GNU extension, so we need to implement it for other POSIX
* platforms.
*
* We use our own implementation unconditionally for consistency.
*/
int execvpe(const OsChar * file0, const OsChar * const argv[], const OsChar * const envp[]);
}
| 319 | C++ | .h | 11 | 27.181818 | 92 | 0.736842 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,168 | comparator.hh | NixOS_nix/src/libutil/comparator.hh | #pragma once
///@file
#define GENERATE_ONE_CMP(PRE, RET, QUAL, COMPARATOR, MY_TYPE, ...) \
PRE RET QUAL operator COMPARATOR(const MY_TYPE & other) const noexcept { \
__VA_OPT__(const MY_TYPE * me = this;) \
auto fields1 = std::tie( __VA_ARGS__ ); \
__VA_OPT__(me = &other;) \
auto fields2 = ... | 1,643 | C++ | .h | 47 | 32.042553 | 78 | 0.649718 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,169 | file-descriptor.hh | NixOS_nix/src/libutil/file-descriptor.hh | #pragma once
///@file
#include "types.hh"
#include "error.hh"
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
namespace nix {
struct Sink;
struct Source;
/**
* Operating System capability
*/
using Descriptor =
#if _WIN32
HANDLE
#else
int
#endif
;
const Descriptor INVALID_DESC... | 4,289 | C++ | .h | 185 | 20.772973 | 105 | 0.720845 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,170 | fmt.hh | NixOS_nix/src/libutil/fmt.hh | #pragma once
///@file
#include <boost/format.hpp>
#include <string>
#include "ansicolor.hh"
namespace nix {
/**
* A helper for writing `boost::format` expressions.
*
* These are equivalent:
*
* ```
* formatHelper(formatter, a_0, ..., a_n)
* formatter % a_0 % ... % a_n
* ```
*
* With a single argument, `fo... | 4,214 | C++ | .h | 171 | 21.327485 | 77 | 0.645009 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,171 | strings-inline.hh | NixOS_nix/src/libutil/strings-inline.hh | #pragma once
#include "strings.hh"
namespace nix {
template<class C, class CharT>
C basicTokenizeString(std::basic_string_view<CharT> s, std::basic_string_view<CharT> separators)
{
C result;
auto pos = s.find_first_not_of(separators, 0);
while (pos != s.npos) {
auto end = s.find_first_of(separato... | 2,822 | C++ | .h | 93 | 25.419355 | 101 | 0.616348 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,172 | references.hh | NixOS_nix/src/libutil/references.hh | #pragma once
///@file
#include "hash.hh"
namespace nix {
class RefScanSink : public Sink
{
StringSet hashes;
StringSet seen;
std::string tail;
public:
RefScanSink(StringSet && hashes) : hashes(hashes)
{ }
StringSet & getResult()
{ return seen; }
void operator () (std::string_view... | 1,039 | C++ | .h | 38 | 23.447368 | 85 | 0.70295 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,173 | experimental-features.hh | NixOS_nix/src/libutil/experimental-features.hh | #pragma once
///@file
#include "error.hh"
#include "types.hh"
#include <nlohmann/json_fwd.hpp>
namespace nix {
/**
* The list of available experimental features.
*
* If you update this, don’t forget to also change the map defining
* their string representation and documentation in the corresponding
* `.cc` f... | 2,469 | C++ | .h | 88 | 25.136364 | 76 | 0.753697 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,174 | archive.hh | NixOS_nix/src/libutil/archive.hh | #pragma once
///@file
#include "types.hh"
#include "serialise.hh"
#include "fs-sink.hh"
namespace nix {
/**
* dumpPath creates a Nix archive of the specified path.
*
* @param path the file system data to dump. Dumping is recursive so if
* this is a directory we dump it and all its children.
*
* @param [out] ... | 2,208 | C++ | .h | 76 | 27.026316 | 95 | 0.649032 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,175 | split.hh | NixOS_nix/src/libutil/split.hh | #pragma once
///@file
#include <optional>
#include <string_view>
#include "util.hh"
namespace nix {
/**
* If `separator` is found, we return the portion of the string before the
* separator, and modify the string argument to contain only the part after the
* separator. Otherwise, we return `std::nullopt`, and we... | 927 | C++ | .h | 28 | 29.5 | 104 | 0.709315 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
11,176 | lru-cache.hh | NixOS_nix/src/libutil/lru-cache.hh | #pragma once
///@file
#include <cassert>
#include <map>
#include <list>
#include <optional>
namespace nix {
/**
* A simple least-recently used cache. Not thread-safe.
*/
template<typename Key, typename Value>
class LRUCache
{
private:
size_t capacity;
// Stupid wrapper to get around circular dependency b... | 2,082 | C++ | .h | 81 | 19.246914 | 75 | 0.559151 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,177 | muxable-pipe.hh | NixOS_nix/src/libutil/muxable-pipe.hh | #pragma once
///@file
#include "file-descriptor.hh"
#ifdef _WIN32
# include "windows-async-pipe.hh"
#endif
#ifndef _WIN32
# include <poll.h>
#else
# include <ioapiset.h>
# include "windows-error.hh"
#endif
namespace nix {
/**
* An "muxable pipe" is a type of pipe supporting endpoints that wait
* for events on... | 1,788 | C++ | .h | 72 | 21.305556 | 77 | 0.682298 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,178 | position.hh | NixOS_nix/src/libutil/position.hh | #pragma once
/**
* @file
*
* @brief Pos and AbstractPos
*/
#include <cstdint>
#include <string>
#include <variant>
#include "source-path.hh"
namespace nix {
/**
* A position and an origin for that position (like a source file).
*/
struct Pos
{
uint32_t line = 0;
uint32_t column = 0;
struct Stdin ... | 3,342 | C++ | .h | 96 | 27.78125 | 94 | 0.601987 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,179 | compression.hh | NixOS_nix/src/libutil/compression.hh | #pragma once
///@file
#include "ref.hh"
#include "types.hh"
#include "serialise.hh"
#include <string>
namespace nix {
struct CompressionSink : BufferedSink, FinishSink
{
using BufferedSink::operator();
using BufferedSink::writeUnbuffered;
using FinishSink::finish;
};
std::string decompress(const std::s... | 790 | C++ | .h | 21 | 35.52381 | 115 | 0.770449 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,180 | suggestions.hh | NixOS_nix/src/libutil/suggestions.hh | #pragma once
///@file
#include "types.hh"
#include <set>
namespace nix {
int levenshteinDistance(std::string_view first, std::string_view second);
/**
* A potential suggestion for the cli interface.
*/
class Suggestion {
public:
/// The smaller the better
int distance;
std::string suggestion;
std... | 1,997 | C++ | .h | 82 | 19.256098 | 73 | 0.626653 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,181 | checked-arithmetic.hh | NixOS_nix/src/libutil/checked-arithmetic.hh | #pragma once
/**
* @file
*
* Checked arithmetic with classes that make it hard to accidentally make something an unchecked operation.
*/
#include <compare>
#include <concepts> // IWYU pragma: keep
#include <exception>
#include <ostream>
#include <limits>
#include <optional>
#include <type_traits>
namespace nix::c... | 4,690 | C++ | .h | 161 | 22.149068 | 117 | 0.596316 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,182 | ansicolor.hh | NixOS_nix/src/libutil/ansicolor.hh | #pragma once
/**
* @file
*
* @brief Some ANSI escape sequences.
*/
namespace nix {
#define ANSI_NORMAL "\e[0m"
#define ANSI_BOLD "\e[1m"
#define ANSI_FAINT "\e[2m"
#define ANSI_ITALIC "\e[3m"
#define ANSI_RED "\e[31;1m"
#define ANSI_GREEN "\e[32;1m"
#define ANSI_WARNING "\e[35;1m"
#define ANSI_BLUE "\e[34;1m"
#de... | 381 | C++ | .h | 18 | 19.777778 | 37 | 0.686111 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
11,183 | json-impls.hh | NixOS_nix/src/libutil/json-impls.hh | #pragma once
///@file
#include "nlohmann/json_fwd.hpp"
// Following https://github.com/nlohmann/json#how-can-i-use-get-for-non-default-constructiblenon-copyable-types
#define JSON_IMPL(TYPE) \
namespace nlohmann { \
... | 759 | C++ | .h | 13 | 52.307692 | 111 | 0.365591 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,184 | current-process.hh | NixOS_nix/src/libutil/current-process.hh | #pragma once
///@file
#include <optional>
#ifndef _WIN32
# include <sys/resource.h>
#endif
#include "types.hh"
namespace nix {
/**
* If cgroups are active, attempt to calculate the number of CPUs available.
* If cgroups are unavailable or if cpu.max is set to "max", return 0.
*/
unsigned int getMaxCPU();
/**
... | 703 | C++ | .h | 28 | 23.357143 | 76 | 0.742857 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,185 | args.hh | NixOS_nix/src/libutil/args.hh | #pragma once
///@file
#include <functional>
#include <filesystem>
#include <map>
#include <memory>
#include <optional>
#include <nlohmann/json_fwd.hpp>
#include "types.hh"
#include "experimental-features.hh"
#include "ref.hh"
namespace nix {
enum struct HashAlgorithm : char;
enum struct HashFormat : int;
class Mu... | 11,622 | C++ | .h | 360 | 25.847222 | 124 | 0.619005 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,186 | file-system.hh | NixOS_nix/src/libutil/file-system.hh | #pragma once
/**
* @file
*
* Utiltities for working with the file sytem and file paths.
*/
#include "types.hh"
#include "error.hh"
#include "logging.hh"
#include "file-descriptor.hh"
#include "file-path.hh"
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#ifdef _WIN32
# includ... | 9,470 | C++ | .h | 295 | 29.99661 | 123 | 0.720961 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,187 | closure.hh | NixOS_nix/src/libutil/closure.hh | #pragma once
///@file
#include <set>
#include <future>
#include "sync.hh"
using std::set;
namespace nix {
template<typename T>
using GetEdgesAsync = std::function<void(const T &, std::function<void(std::promise<set<T>> &)>)>;
template<typename T>
void computeClosure(
const set<T> startElts,
set<T> & res,
... | 1,738 | C++ | .h | 59 | 20.847458 | 98 | 0.520408 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,188 | executable-path.hh | NixOS_nix/src/libutil/executable-path.hh | #pragma once
///@file
#include "file-system.hh"
namespace nix {
MakeError(ExecutableLookupError, Error);
/**
* @todo rename, it is not just good for execuatable paths, but also
* other lists of paths.
*/
struct ExecutablePath
{
std::vector<std::filesystem::path> directories;
constexpr static const OsCha... | 2,400 | C++ | .h | 69 | 29.608696 | 109 | 0.658473 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,189 | ref.hh | NixOS_nix/src/libutil/ref.hh | #pragma once
///@file
#include <memory>
#include <stdexcept>
namespace nix {
/**
* A simple non-nullable reference-counted pointer. Actually a wrapper
* around std::shared_ptr that prevents null constructions.
*/
template<typename T>
class ref
{
private:
std::shared_ptr<T> p;
public:
explicit ref(const ... | 1,791 | C++ | .h | 83 | 16.481928 | 70 | 0.573207 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,190 | unix-domain-socket.hh | NixOS_nix/src/libutil/unix-domain-socket.hh | #pragma once
///@file
#include "types.hh"
#include "file-descriptor.hh"
#ifdef _WIN32
# include <winsock2.h>
#endif
#include <unistd.h>
namespace nix {
/**
* Create a Unix domain socket.
*/
AutoCloseFD createUnixDomainSocket();
/**
* Create a Unix domain socket in listen mode.
*/
AutoCloseFD createUnixDomainS... | 1,359 | C++ | .h | 71 | 17.267606 | 72 | 0.718652 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,191 | sync.hh | NixOS_nix/src/libutil/sync.hh | #pragma once
///@file
#include <cstdlib>
#include <mutex>
#include <shared_mutex>
#include <condition_variable>
#include <cassert>
#include "error.hh"
namespace nix {
/**
* This template class ensures synchronized access to a value of type
* T. It is used as follows:
*
* struct Data { int x; ... };
*
* Sy... | 2,915 | C++ | .h | 100 | 23.21 | 124 | 0.582767 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,192 | url-parts.hh | NixOS_nix/src/libutil/url-parts.hh | #pragma once
///@file
#include <string>
#include <regex>
namespace nix {
// URI stuff.
const static std::string pctEncoded = "(?:%[0-9a-fA-F][0-9a-fA-F])";
const static std::string schemeNameRegex = "(?:[a-z][a-z0-9+.-]*)";
const static std::string ipv6AddressSegmentRegex = "[0-9a-fA-F:]+(?:%\\w+)?";
const static st... | 2,455 | C++ | .h | 38 | 63.394737 | 138 | 0.624325 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,193 | source-path.hh | NixOS_nix/src/libutil/source-path.hh | #pragma once
/**
* @file
*
* @brief SourcePath
*/
#include "ref.hh"
#include "canon-path.hh"
#include "source-accessor.hh"
#include "std-hash.hh"
namespace nix {
/**
* An abstraction for accessing source files during
* evaluation. Currently, it's just a wrapper around `CanonPath` that
* accesses files in the ... | 3,471 | C++ | .h | 111 | 26.216216 | 79 | 0.652578 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,194 | url.hh | NixOS_nix/src/libutil/url.hh | #pragma once
///@file
#include "error.hh"
namespace nix {
struct ParsedURL
{
std::string url;
/// URL without query/fragment
std::string base;
std::string scheme;
std::optional<std::string> authority;
std::string path;
std::map<std::string, std::string> query;
std::string fragment;
... | 1,905 | C++ | .h | 53 | 32.849057 | 80 | 0.715225 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,195 | compute-levels.hh | NixOS_nix/src/libutil/compute-levels.hh | #pragma once
///@file
#include "types.hh"
namespace nix {
StringSet computeLevels();
}
| 91 | C++ | .h | 6 | 13.5 | 26 | 0.765432 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,196 | xml-writer.hh | NixOS_nix/src/libutil/xml-writer.hh | #pragma once
///@file
#include <iostream>
#include <string>
#include <list>
#include <map>
namespace nix {
typedef std::map<std::string, std::string> XMLAttrs;
class XMLWriter
{
private:
std::ostream & output;
bool indent;
bool closed;
std::list<std::string> pendingElems;
public:
XMLWrit... | 1,024 | C++ | .h | 45 | 18.533333 | 61 | 0.672234 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
11,197 | config-impl.hh | NixOS_nix/src/libutil/config-impl.hh | #pragma once
/**
* @file
*
* Template implementations (as opposed to mere declarations).
*
* This file is an example of the "impl.hh" pattern. See the
* contributing guide.
*
* One only needs to include this when one is declaring a
* `BaseClass<CustomType>` setting, or as derived class of such an
* instantiat... | 3,932 | C++ | .h | 117 | 29.547009 | 125 | 0.701264 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,198 | chunked-vector.hh | NixOS_nix/src/libutil/chunked-vector.hh | #pragma once
///@file
#include <cstdint>
#include <cstdlib>
#include <vector>
#include <limits>
#include "error.hh"
namespace nix {
/**
* Provides an indexable container like vector<> with memory overhead
* guarantees like list<> by allocating storage in chunks of ChunkSize
* elements instead of using a contiguo... | 1,862 | C++ | .h | 65 | 23.092308 | 75 | 0.615557 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,199 | util.hh | NixOS_nix/src/libutil/util.hh | #pragma once
///@file
#include "types.hh"
#include "error.hh"
#include "logging.hh"
#include <functional>
#include <map>
#include <sstream>
#include <optional>
#include "strings.hh"
namespace nix {
void initLibUtil();
/**
* Convert a list of strings to a null-terminated vector of `char
* *`s. The result must n... | 8,356 | C++ | .h | 289 | 25.788927 | 110 | 0.664786 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,200 | strings.hh | NixOS_nix/src/libutil/strings.hh | #pragma once
#include <list>
#include <set>
#include <string_view>
#include <string>
#include <vector>
namespace nix {
/*
* workaround for unavailable view() method (C++20) of std::ostringstream under MacOS with clang-16
*/
std::string_view toView(const std::ostringstream & os);
/**
* String tokenizer.
*
* See... | 3,043 | C++ | .h | 61 | 48.278689 | 119 | 0.768609 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,201 | signals.hh | NixOS_nix/src/libutil/signals.hh | #pragma once
///@file
#include "types.hh"
#include "error.hh"
#include "logging.hh"
#include <functional>
namespace nix {
/* User interruption. */
/**
* @note Does nothing on Windows
*/
static inline void setInterrupted(bool isInterrupted);
/**
* @note Does nothing on Windows
*/
static inline bool getInterrup... | 1,131 | C++ | .h | 50 | 20.74 | 70 | 0.746717 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,202 | os-string.hh | NixOS_nix/src/libutil/os-string.hh | #pragma once
///@file
#include <optional>
#include <string>
#include <string_view>
namespace nix {
/**
* Named because it is similar to the Rust type, except it is in the
* native encoding not WTF-8.
*
* Same as `std::filesystem::path::value_type`, but manually defined to
* avoid including a much more complex h... | 1,061 | C++ | .h | 43 | 22.813953 | 71 | 0.717542 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,203 | pool.hh | NixOS_nix/src/libutil/pool.hh | #pragma once
///@file
#include <functional>
#include <limits>
#include <list>
#include <memory>
#include <cassert>
#include "sync.hh"
#include "ref.hh"
namespace nix {
/**
* This template class implements a simple pool manager of resources
* of some type R, such as database connections. It is used as
* follows:
... | 4,555 | C++ | .h | 167 | 19.359281 | 89 | 0.512767 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,204 | repair-flag.hh | NixOS_nix/src/libutil/repair-flag.hh | #pragma once
///@file
namespace nix {
enum RepairFlag : bool { NoRepair = false, Repair = true };
}
| 103 | C++ | .h | 5 | 19 | 59 | 0.705263 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,205 | regex-combinators.hh | NixOS_nix/src/libutil/regex-combinators.hh | #pragma once
///@file
#include <string_view>
namespace nix::regex {
// TODO use constexpr string building like
// https://github.com/akrzemi1/static_string/blob/master/include/ak_toolkit/static_string.hpp
static inline std::string either(std::string_view a, std::string_view b)
{
return std::string { a } + "|" +... | 638 | C++ | .h | 23 | 25.695652 | 93 | 0.667216 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,206 | file-path-impl.hh | NixOS_nix/src/libutil/file-path-impl.hh | #pragma once
/**
* @file
*
* Pure (no IO) infrastructure just for defining other path types;
* should not be used directly outside of utilities.
*/
#include <string>
#include <string_view>
namespace nix {
/**
* Unix-style path primives.
*
* Nix'result own "logical" paths are always Unix-style. So this is alwa... | 4,334 | C++ | .h | 141 | 24.957447 | 92 | 0.620043 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,207 | canon-path.hh | NixOS_nix/src/libutil/canon-path.hh | #pragma once
///@file
#include <string>
#include <optional>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
namespace nix {
/**
* A canonical representation of a path. It ensures the following:
*
* - It always starts with a slash.
*
* - It never ends with a slash, except if the path is "... | 6,620 | C++ | .h | 195 | 28.138462 | 79 | 0.605548 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,208 | posix-source-accessor.hh | NixOS_nix/src/libutil/posix-source-accessor.hh | #pragma once
#include "source-accessor.hh"
namespace nix {
struct SourcePath;
/**
* A source accessor that uses the Unix filesystem.
*/
struct PosixSourceAccessor : virtual SourceAccessor
{
/**
* Optional root path to prefix all operations into the native file
* system. This allows prepending funny ... | 2,084 | C++ | .h | 54 | 33.5 | 113 | 0.69334 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,209 | terminal.hh | NixOS_nix/src/libutil/terminal.hh | #pragma once
///@file
#include <limits>
#include <string>
namespace nix {
/**
* Determine whether ANSI escape sequences are appropriate for the
* present output.
*/
bool isTTY();
/**
* Truncate a string to 'width' printable characters. If 'filterAll'
* is true, all ANSI escape sequences are filtered out. Otherw... | 1,010 | C++ | .h | 34 | 27.764706 | 70 | 0.740206 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,210 | error.hh | NixOS_nix/src/libutil/error.hh | #pragma once
/**
* @file
*
* @brief This file defines two main structs/classes used in nix error handling.
*
* ErrorInfo provides a standard payload of error information, with conversion to string
* happening in the logger rather than at the call site.
*
* BaseError is the ancestor of nix specific exceptions (a... | 7,439 | C++ | .h | 248 | 26.169355 | 102 | 0.658267 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,211 | environment-variables.hh | NixOS_nix/src/libutil/environment-variables.hh | #pragma once
/**
* @file
*
* Utilities for working with the current process's environment
* variables.
*/
#include <optional>
#include "types.hh"
#include "file-path.hh"
namespace nix {
static constexpr auto environmentVariablesCategory = "Options that change environment variables";
/**
* @return an environm... | 1,407 | C++ | .h | 55 | 23.836364 | 97 | 0.72571 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,212 | finally.hh | NixOS_nix/src/libutil/finally.hh | #pragma once
///@file
#include <utility>
#include <cassert>
#include <exception>
/**
* A trivial class to run a function at the end of a scope.
*/
template<typename Fn>
class [[nodiscard("Finally values must be used")]] Finally
{
private:
Fn fun;
bool movedFrom = false;
public:
Finally(Fn fun) : fun(st... | 1,761 | C++ | .h | 48 | 29.166667 | 87 | 0.615205 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,213 | hilite.hh | NixOS_nix/src/libutil/hilite.hh | #pragma once
///@file
#include <regex>
#include <vector>
#include <string>
namespace nix {
/**
* Highlight all the given matches in the given string `s` by wrapping
* them between `prefix` and `postfix`.
*
* If some matches overlap, then their union will be wrapped rather
* than the individual matches.
*/
std:... | 468 | C++ | .h | 19 | 22.263158 | 70 | 0.723596 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,214 | logging.hh | NixOS_nix/src/libutil/logging.hh | #pragma once
///@file
#include "error.hh"
#include "config.hh"
#include <nlohmann/json_fwd.hpp>
namespace nix {
typedef enum {
actUnknown = 0,
actCopyPath = 100,
actFileTransfer = 101,
actRealise = 102,
actCopyPaths = 103,
actBuilds = 104,
actBuild = 105,
actOptimiseStore = 106,
... | 6,675 | C++ | .h | 202 | 28.490099 | 108 | 0.665368 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,215 | json-utils.hh | NixOS_nix/src/libutil/json-utils.hh | #pragma once
///@file
#include <nlohmann/json.hpp>
#include <list>
#include "types.hh"
namespace nix {
enum struct ExperimentalFeature;
const nlohmann::json * get(const nlohmann::json & map, const std::string & key);
nlohmann::json * get(nlohmann::json & map, const std::string & key);
/**
* Get the value of a j... | 3,669 | C++ | .h | 103 | 32.174757 | 111 | 0.68473 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,217 | english.hh | NixOS_nix/src/libutil/english.hh | #pragma once
#include <iostream>
namespace nix {
/**
* Pluralize a given value.
*
* If `count == 1`, prints `1 {single}` to `output`, otherwise prints `{count} {plural}`.
*/
std::ostream & pluralize(
std::ostream & output,
unsigned int count,
const std::string_view single,
const std::string_view ... | 332 | C++ | .h | 14 | 21 | 89 | 0.671975 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,218 | abstract-setting-to-json.hh | NixOS_nix/src/libutil/abstract-setting-to-json.hh | #pragma once
///@file
#include <nlohmann/json.hpp>
#include "config.hh"
#include "json-utils.hh"
namespace nix {
template<typename T>
std::map<std::string, nlohmann::json> BaseSetting<T>::toJSONObject() const
{
auto obj = AbstractSetting::toJSONObject();
obj.emplace("value", value);
obj.emplace("defaultVa... | 414 | C++ | .h | 16 | 23.5 | 74 | 0.734848 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,219 | source-accessor.hh | NixOS_nix/src/libutil/source-accessor.hh | #pragma once
#include <filesystem>
#include "canon-path.hh"
#include "hash.hh"
#include "ref.hh"
namespace nix {
struct Sink;
/**
* Note there is a decent chance this type soon goes away because the problem is solved another way.
* See the discussion in https://github.com/NixOS/nix/pull/9985.
*/
enum class Syml... | 5,986 | C++ | .h | 171 | 29.561404 | 153 | 0.673653 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,220 | callback.hh | NixOS_nix/src/libutil/callback.hh | #pragma once
///@file
#include <future>
#include <functional>
namespace nix {
/**
* A callback is a wrapper around a lambda that accepts a valid of
* type T or an exception. (We abuse std::future<T> to pass the value or
* exception.)
*/
template<typename T>
class Callback
{
std::function<void(std::future<T>)... | 1,256 | C++ | .h | 42 | 24.880952 | 96 | 0.634025 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,221 | git.hh | NixOS_nix/src/libutil/git.hh | #pragma once
///@file
#include <string>
#include <string_view>
#include <optional>
#include "types.hh"
#include "serialise.hh"
#include "hash.hh"
#include "source-path.hh"
#include "fs-sink.hh"
namespace nix::git {
enum struct ObjectType {
Blob,
Tree,
//Commit,
//Tag,
};
using RawMode = uint32_t;
... | 5,274 | C++ | .h | 187 | 25.529412 | 92 | 0.721542 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,222 | hash.hh | NixOS_nix/src/libutil/hash.hh | #pragma once
///@file
#include "types.hh"
#include "serialise.hh"
#include "file-system.hh"
namespace nix {
MakeError(BadHash, Error);
enum struct HashAlgorithm : char { MD5 = 42, SHA1, SHA256, SHA512 };
const int md5HashSize = 16;
const int sha1HashSize = 20;
const int sha256HashSize = 32;
const int sha512Hash... | 5,833 | C++ | .h | 188 | 27.191489 | 97 | 0.690493 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,223 | types.hh | NixOS_nix/src/libutil/types.hh | #pragma once
///@file
#include <list>
#include <set>
#include <string>
#include <map>
#include <variant>
#include <vector>
namespace nix {
typedef std::list<std::string> Strings;
typedef std::set<std::string> StringSet;
typedef std::map<std::string, std::string> StringMap;
typedef std::map<std::string, std::string>... | 2,955 | C++ | .h | 98 | 26.153061 | 75 | 0.668781 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,224 | users.hh | NixOS_nix/src/libutil/users.hh | #pragma once
///@file
#include "types.hh"
#ifndef _WIN32
# include <sys/types.h>
#endif
namespace nix {
std::string getUserName();
#ifndef _WIN32
/**
* @return the given user's home directory from /etc/passwd.
*/
Path getHomeOf(uid_t userId);
#endif
/**
* @return $HOME or the user's home directory from /etc/pa... | 1,243 | C++ | .h | 54 | 21.296296 | 76 | 0.71185 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,225 | file-content-address.hh | NixOS_nix/src/libutil/file-content-address.hh | #pragma once
///@file
#include "source-accessor.hh"
namespace nix {
struct SourcePath;
/**
* An enumeration of the ways we can serialize file system
* objects.
*
* See `file-system-object/content-address.md#serial` in the manual for
* a user-facing description of this concept, but note that this type is also
... | 4,108 | C++ | .h | 142 | 25.704225 | 79 | 0.717325 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,226 | exit.hh | NixOS_nix/src/libutil/exit.hh | #pragma once
#include <exception>
namespace nix {
/**
* Exit the program with a given exit code.
*/
class Exit : public std::exception
{
public:
int status;
Exit() : status(0) { }
explicit Exit(int status) : status(status) { }
virtual ~Exit();
};
}
| 271 | C++ | .h | 15 | 15.6 | 50 | 0.662698 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,227 | fs-sink.hh | NixOS_nix/src/libutil/fs-sink.hh | #pragma once
///@file
#include "serialise.hh"
#include "source-accessor.hh"
#include "file-system.hh"
namespace nix {
/**
* Actions on an open regular file in the process of creating it.
*
* See `FileSystemObjectSink::createRegularFile`.
*/
struct CreateRegularFileSink : Sink
{
virtual void isExecutable() = ... | 3,153 | C++ | .h | 100 | 27.57 | 87 | 0.712211 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,228 | memory-source-accessor.hh | NixOS_nix/src/libutil/memory-source-accessor.hh | #include "source-path.hh"
#include "fs-sink.hh"
#include "variant-wrapper.hh"
namespace nix {
/**
* An source accessor for an in-memory file system.
*/
struct MemorySourceAccessor : virtual SourceAccessor
{
/**
* In addition to being part of the implementation of
* `MemorySourceAccessor`, this has a s... | 3,544 | C++ | .h | 89 | 33.606742 | 94 | 0.664917 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,229 | topo-sort.hh | NixOS_nix/src/libutil/topo-sort.hh | #pragma once
///@file
#include "error.hh"
namespace nix {
template<typename T>
std::vector<T> topoSort(std::set<T> items,
std::function<std::set<T>(const T &)> getChildren,
std::function<Error(const T &, const T &)> makeCycleError)
{
std::vector<T> sorted;
std::set<T> visited, parents;
s... | 1,044 | C++ | .h | 30 | 28.3 | 81 | 0.606394 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
11,230 | thread-pool.hh | NixOS_nix/src/libutil/thread-pool.hh | #pragma once
///@file
#include "error.hh"
#include "sync.hh"
#include <queue>
#include <functional>
#include <thread>
#include <map>
#include <atomic>
namespace nix {
MakeError(ThreadPoolShutDown, Error);
/**
* A simple thread pool that executes a queue of work items
* (lambdas).
*/
class ThreadPool
{
public:
... | 3,727 | C++ | .h | 127 | 21.677165 | 72 | 0.565303 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,231 | processes.hh | NixOS_nix/src/libutil/processes.hh | #pragma once
///@file
#include "types.hh"
#include "error.hh"
#include "file-descriptor.hh"
#include "logging.hh"
#include "ansicolor.hh"
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <signal.h>
#include <atomic>
#include <functional>
#include <map>
#include <sstream>
... | 2,750 | C++ | .h | 116 | 20.844828 | 97 | 0.698698 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,232 | serialise.hh | NixOS_nix/src/libutil/serialise.hh | #pragma once
///@file
#include <memory>
#include <type_traits>
#include "types.hh"
#include "util.hh"
#include "file-descriptor.hh"
namespace boost::context { struct stack_context; }
namespace nix {
/**
* Abstract destination of binary data.
*/
struct Sink
{
virtual ~Sink() { }
virtual void operator () ... | 12,655 | C++ | .h | 462 | 22.482684 | 106 | 0.61381 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,233 | config-global.hh | NixOS_nix/src/libutil/config-global.hh | #pragma once
///@file
#include "config.hh"
namespace nix {
struct GlobalConfig : public AbstractConfig
{
typedef std::vector<Config *> ConfigRegistrations;
static ConfigRegistrations * configRegistrations;
bool set(const std::string & name, const std::string & value) override;
void getSettings(std:... | 701 | C++ | .h | 21 | 29.333333 | 101 | 0.733533 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,234 | namespaces.hh | NixOS_nix/src/libutil/linux/namespaces.hh | #pragma once
///@file
#include <optional>
#include "types.hh"
namespace nix {
/**
* Save the current mount namespace. Ignored if called more than
* once.
*/
void saveMountNamespace();
/**
* Restore the mount namespace saved by saveMountNamespace(). Ignored
* if saveMountNamespace() was never called.
*/
void ... | 683 | C++ | .h | 26 | 24.461538 | 72 | 0.766975 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,235 | cgroup.hh | NixOS_nix/src/libutil/linux/cgroup.hh | #pragma once
///@file
#include <chrono>
#include <optional>
#include "types.hh"
namespace nix {
std::optional<Path> getCgroupFS();
std::map<std::string, std::string> getCgroups(const Path & cgroupFile);
struct CgroupStats
{
std::optional<std::chrono::microseconds> cpuUser, cpuSystem;
};
/**
* Destroy the cg... | 867 | C++ | .h | 27 | 30.259259 | 75 | 0.762651 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,236 | root.hh | NixOS_nix/src/libutil/args/root.hh | #pragma once
#include "args.hh"
namespace nix {
/**
* The concrete implementation of a collection of completions.
*
* This is exposed so that the main entry point can print out the
* collected completions.
*/
struct Completions final : AddCompletions
{
std::set<Completion> completions;
Type type = Type:... | 2,239 | C++ | .h | 69 | 28.217391 | 79 | 0.712163 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,237 | local-keys.hh | NixOS_nix/src/libutil/signature/local-keys.hh | #pragma once
///@file
#include "types.hh"
#include <map>
namespace nix {
/**
* Except where otherwise noted, Nix serializes keys and signatures in
* the form:
*
* ```
* <name>:<key/signature-in-Base64>
* ```
*/
struct BorrowedCryptoValue {
std::string_view name;
std::string_view payload;
/**
... | 2,457 | C++ | .h | 84 | 25.119048 | 96 | 0.671086 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,238 | signer.hh | NixOS_nix/src/libutil/signature/signer.hh | #pragma once
#include "types.hh"
#include "signature/local-keys.hh"
#include <map>
#include <optional>
namespace nix {
/**
* An abstract signer
*
* Derive from this class to implement a custom signature scheme.
*
* It is only necessary to implement signature of bytes and provide a
* public key.
*/
struct Sig... | 1,239 | C++ | .h | 48 | 22.4375 | 72 | 0.694397 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,239 | monitor-fd.hh | NixOS_nix/src/libutil/unix/monitor-fd.hh | #pragma once
///@file
#include <thread>
#include <atomic>
#include <cstdlib>
#include <poll.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include "signals.hh"
namespace nix {
class MonitorFdHup
{
private:
std::thread thread;
public:
MonitorFdHup(int fd)
{
thread = std::th... | 1,849 | C++ | .h | 62 | 18 | 72 | 0.463662 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,240 | signals-impl.hh | NixOS_nix/src/libutil/unix/signals-impl.hh | #pragma once
/**
* @file
*
* Implementation of some inline definitions for Unix signals, and also
* some extra Unix-only interfaces.
*
* (The only reason everything about signals isn't Unix-only is some
* no-op definitions are provided on Windows to avoid excess CPP in
* downstream code.)
*/
#include "types.h... | 2,682 | C++ | .h | 94 | 26.319149 | 85 | 0.748928 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,241 | windows-error.hh | NixOS_nix/src/libutil/windows/windows-error.hh | #pragma once
///@file
#include <errhandlingapi.h>
#include "error.hh"
namespace nix::windows {
/**
* Windows Error type.
*
* Unless you need to catch a specific error number, don't catch this in
* portable code. Catch `SystemError` instead.
*/
class WinError : public SystemError
{
public:
DWORD lastError;
... | 1,149 | C++ | .h | 42 | 23.047619 | 83 | 0.657559 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,242 | windows-async-pipe.hh | NixOS_nix/src/libutil/windows/windows-async-pipe.hh | #pragma once
///@file
#include "file-descriptor.hh"
namespace nix::windows {
/***
* An "async pipe" is a pipe that supports I/O Completion Ports so
* multiple pipes can be listened too.
*
* Unfortunately, only named pipes support that on windows, so we use
* those with randomized temp file names.
*/
class Asyn... | 518 | C++ | .h | 22 | 20.954545 | 69 | 0.735234 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,243 | signals-impl.hh | NixOS_nix/src/libutil/windows/signals-impl.hh | #pragma once
///@file
#include "types.hh"
namespace nix {
/* User interruption. */
static inline void setInterrupted(bool isInterrupted)
{
/* Do nothing for now */
}
static inline bool getInterrupted()
{
return false;
}
inline void setInterruptThrown()
{
/* Do nothing for now */
}
void inline checkIn... | 569 | C++ | .h | 32 | 15.375 | 65 | 0.702652 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.