mirror of
https://github.com/NixOS/nix
synced 2024-10-18 00:16:11 -04:00
Compare commits
16 commits
50adc3df10
...
935c32eee5
Author | SHA1 | Date | |
---|---|---|---|
935c32eee5 | |||
1cd48008f0 | |||
2e2c7f3b14 | |||
c196011d23 | |||
7bd0c70b37 | |||
f51974d698 | |||
ed184f0b61 | |||
facc502bc8 | |||
fd8a4a86d9 | |||
16320f6d24 | |||
3f9ff10786 | |||
de41e46175 | |||
0e5a5303ad | |||
781ff7672e | |||
5d35424445 | |||
794007cab7 |
|
@ -29,11 +29,7 @@ We aim to achieve this by improving the contributor experience and attracting mo
|
|||
|
||||
## Members
|
||||
|
||||
- Eelco Dolstra (@edolstra) – Team lead
|
||||
- Valentin Gagarin (@fricklerhandwerk)
|
||||
- Thomas Bereknyei (@tomberek)
|
||||
- Robert Hensing (@roberth)
|
||||
- John Ericson (@Ericson2314)
|
||||
See https://nixos.org/community/teams/nix/ for the current team membership.
|
||||
|
||||
The team is on Github as [@NixOS/nix-team](https://github.com/orgs/NixOS/teams/nix-team).
|
||||
|
||||
|
|
6
maintainers/onboarding.md
Normal file
6
maintainers/onboarding.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
# Onboarding a new team member
|
||||
|
||||
- https://github.com/NixOS/nixos-homepage/
|
||||
- https://github.com/orgs/NixOS/teams/nix-team
|
||||
- Matrix room
|
|
@ -332,6 +332,36 @@ EvalState::EvalState(
|
|||
|
||||
EvalState::~EvalState()
|
||||
{
|
||||
auto profileFile = getEnv("NIX_PROFILE_FILE");
|
||||
|
||||
std::map<PosIdx, std::string> cachedPositions;
|
||||
|
||||
if (!profileFile.has_value()) {
|
||||
return;
|
||||
}
|
||||
std::ofstream profileStream(profileFile.value());
|
||||
if (!profileStream) {
|
||||
return;
|
||||
}
|
||||
for (auto & [stack, count] : callCount) {
|
||||
auto first = true;
|
||||
for (auto & pos : stack) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
profileStream << ";";
|
||||
}
|
||||
if (auto it = cachedPositions.find(pos); it != cachedPositions.end()) {
|
||||
profileStream << it->second;
|
||||
} else {
|
||||
std::stringstream posStr;
|
||||
posStr << positions[pos];
|
||||
cachedPositions[pos] = posStr.str();
|
||||
profileStream << posStr.str();
|
||||
}
|
||||
}
|
||||
profileStream << " " << count << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1448,15 +1478,36 @@ void ExprOpHasAttr::eval(EvalState & state, Env & env, Value & v)
|
|||
v.mkBool(true);
|
||||
}
|
||||
|
||||
|
||||
void ExprLambda::eval(EvalState & state, Env & env, Value & v)
|
||||
{
|
||||
v.mkLambda(&env, this);
|
||||
}
|
||||
|
||||
static const std::chrono::duration SAMPLE_INTERVAL = std::chrono::microseconds(10);
|
||||
namespace {
|
||||
class SampleStack {
|
||||
EvalState & state;
|
||||
public:
|
||||
SampleStack(EvalState & state, const PosIdx pos) : state(state) {
|
||||
state.stack.push_back(pos);
|
||||
}
|
||||
~SampleStack() {
|
||||
auto now = std::chrono::high_resolution_clock::now();
|
||||
if (now - state.lastStackSample > SAMPLE_INTERVAL) {
|
||||
state.callCount[state.stack] += 1;
|
||||
state.lastStackSample = now;
|
||||
}
|
||||
if (state.stack.size() > 0) {
|
||||
state.stack.pop_back();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value & vRes, const PosIdx pos)
|
||||
{
|
||||
auto _level = addCallDepth(pos);
|
||||
SampleStack _sample(*this, pos);
|
||||
|
||||
auto trace = settings.traceFunctionCalls
|
||||
? std::make_unique<FunctionCallTrace>(positions[pos])
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "search-path.hh"
|
||||
#include "repl-exit-status.hh"
|
||||
#include "ref.hh"
|
||||
#include "pos-idx.hh"
|
||||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
|
@ -363,6 +364,10 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
std::vector<PosIdx> stack = {};
|
||||
std::map<std::vector<PosIdx>, int> callCount = {};
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> lastStackSample = std::chrono::high_resolution_clock::now();
|
||||
|
||||
EvalState(
|
||||
const LookupPath & _lookupPath,
|
||||
ref<Store> store,
|
||||
|
@ -838,6 +843,7 @@ private:
|
|||
|
||||
bool countCalls;
|
||||
|
||||
|
||||
typedef std::map<std::string, size_t> PrimOpCalls;
|
||||
PrimOpCalls primOpCalls;
|
||||
|
||||
|
|
|
@ -157,7 +157,11 @@ struct PathInputScheme : InputScheme
|
|||
});
|
||||
storePath = store->addToStoreFromDump(*src, "source");
|
||||
}
|
||||
input.attrs.insert_or_assign("lastModified", uint64_t(mtime));
|
||||
|
||||
/* Trust the lastModified value supplied by the user, if
|
||||
any. It's not a "secure" attribute so we don't care. */
|
||||
if (!input.getLastModified())
|
||||
input.attrs.insert_or_assign("lastModified", uint64_t(mtime));
|
||||
|
||||
return {makeStorePathAccessor(store, *storePath), std::move(input)};
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "strings.hh"
|
||||
#include "signals.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
@ -1579,6 +1580,8 @@ void LocalDerivationGoal::startDaemon()
|
|||
FdSink(remote.get()),
|
||||
NotTrusted, daemon::Recursive);
|
||||
debug("terminated daemon connection");
|
||||
} catch (const Interrupted &) {
|
||||
debug("interrupted daemon connection");
|
||||
} catch (SystemError &) {
|
||||
ignoreExceptionExceptInterrupt();
|
||||
}
|
||||
|
|
|
@ -225,8 +225,15 @@ struct LocalDerivationGoal : public DerivationGoal
|
|||
*/
|
||||
void writeStructuredAttrs();
|
||||
|
||||
/**
|
||||
* Start an in-process nix daemon thread for recursive-nix.
|
||||
*/
|
||||
void startDaemon();
|
||||
|
||||
/**
|
||||
* Stop the in-process nix daemon thread.
|
||||
* @see startDaemon
|
||||
*/
|
||||
void stopDaemon();
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,10 +110,15 @@ void ThreadPool::doWork(bool mainThread)
|
|||
propagate it. */
|
||||
try {
|
||||
std::rethrow_exception(exc);
|
||||
} catch (const Interrupted &) {
|
||||
// The interrupted state may be picked up by multiple
|
||||
// workers, which is expected, so we should ignore
|
||||
// it silently and let the first one bubble up,
|
||||
// rethrown via the original state->exception.
|
||||
} catch (const ThreadPoolShutDown &) {
|
||||
// Similarly expected.
|
||||
} catch (std::exception & e) {
|
||||
if (!dynamic_cast<ThreadPoolShutDown*>(&e))
|
||||
ignoreExceptionExceptInterrupt();
|
||||
} catch (...) {
|
||||
ignoreExceptionExceptInterrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,3 +6,6 @@ touch "$TEST_ROOT/foo" -t 202211111111
|
|||
# We only check whether 2022-11-1* **:**:** is the last modified date since
|
||||
# `lastModified` is transformed into UTC in `builtins.fetchTarball`.
|
||||
[[ "$(nix eval --impure --raw --expr "(builtins.fetchTree \"path://$TEST_ROOT/foo\").lastModifiedDate")" =~ 2022111.* ]]
|
||||
|
||||
# Check that we can override lastModified for "path:" inputs.
|
||||
[[ "$(nix eval --impure --expr "(builtins.fetchTree { type = \"path\"; path = \"$TEST_ROOT/foo\"; lastModified = 123; }).lastModified")" = 123 ]]
|
||||
|
|
Loading…
Reference in a new issue