aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/test.yml14
-rw-r--r--README.md6
-rw-r--r--doc/manual/images/callouts/1.gifbin889 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/10.gifbin929 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/11.gifbin202 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/12.gifbin210 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/13.gifbin209 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/14.gifbin205 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/15.gifbin210 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/2.gifbin907 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/3.gifbin914 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/4.gifbin907 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/5.gifbin916 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/6.gifbin218 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/7.gifbin907 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/8.gifbin918 -> 0 bytes
-rw-r--r--doc/manual/images/callouts/9.gifbin923 -> 0 bytes
-rw-r--r--doc/manual/local.mk7
-rw-r--r--doc/manual/style.css263
-rw-r--r--mk/README.md6
-rw-r--r--scripts/install-nix-from-closure.sh2
-rw-r--r--src/libstore/binary-cache-store.cc2
-rw-r--r--src/libstore/local-store.cc17
-rw-r--r--src/libstore/store-api.cc24
-rw-r--r--src/libstore/store-api.hh21
-rw-r--r--src/nix/local.mk2
26 files changed, 68 insertions, 296 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 000000000..87997414d
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,14 @@
+name: "Test"
+on:
+ pull_request:
+ push:
+jobs:
+ tests:
+ strategy:
+ matrix:
+ os: [ubuntu-18.04, macos]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v2
+ - uses: cachix/install-nix-action@v8
+ - run: nix-build release.nix --arg nix '{ outPath = ./.; revCount = 123; shortRev = "abcdefgh"; }' --arg systems '[ builtins.currentSystem ]' -A installerScript -A perlBindings
diff --git a/README.md b/README.md
index 48cb1685c..a953c0f71 100644
--- a/README.md
+++ b/README.md
@@ -9,11 +9,11 @@ appear with Nix.
To find out more about the tool, usage and installation instructions, please
read the manual, which is available on the Nix website at
-<http://nixos.org/nix/manual>.
+<https://nixos.org/nix/manual>.
## Contributing
-Take a look at the [Hacking Section](http://nixos.org/nix/manual/#chap-hacking)
+Take a look at the [Hacking Section](https://nixos.org/nix/manual/#chap-hacking)
of the manual. It helps you to get started with building Nix from source.
## License
@@ -21,4 +21,4 @@ of the manual. It helps you to get started with building Nix from source.
Nix is released under the LGPL v2.1
This product includes software developed by the OpenSSL Project for
-use in the [OpenSSL Toolkit](http://www.OpenSSL.org/).
+use in the [OpenSSL Toolkit](https://www.OpenSSL.org/).
diff --git a/doc/manual/images/callouts/1.gif b/doc/manual/images/callouts/1.gif
deleted file mode 100644
index 9e7a87f75..000000000
--- a/doc/manual/images/callouts/1.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/10.gif b/doc/manual/images/callouts/10.gif
deleted file mode 100644
index e80f7f8e6..000000000
--- a/doc/manual/images/callouts/10.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/11.gif b/doc/manual/images/callouts/11.gif
deleted file mode 100644
index 67f91a239..000000000
--- a/doc/manual/images/callouts/11.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/12.gif b/doc/manual/images/callouts/12.gif
deleted file mode 100644
index 54c4b42f1..000000000
--- a/doc/manual/images/callouts/12.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/13.gif b/doc/manual/images/callouts/13.gif
deleted file mode 100644
index dd5d7d9b6..000000000
--- a/doc/manual/images/callouts/13.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/14.gif b/doc/manual/images/callouts/14.gif
deleted file mode 100644
index 3d7a952a3..000000000
--- a/doc/manual/images/callouts/14.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/15.gif b/doc/manual/images/callouts/15.gif
deleted file mode 100644
index 1c9183d5b..000000000
--- a/doc/manual/images/callouts/15.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/2.gif b/doc/manual/images/callouts/2.gif
deleted file mode 100644
index 94d42a30f..000000000
--- a/doc/manual/images/callouts/2.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/3.gif b/doc/manual/images/callouts/3.gif
deleted file mode 100644
index dd3541a1b..000000000
--- a/doc/manual/images/callouts/3.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/4.gif b/doc/manual/images/callouts/4.gif
deleted file mode 100644
index 4bcbf7e31..000000000
--- a/doc/manual/images/callouts/4.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/5.gif b/doc/manual/images/callouts/5.gif
deleted file mode 100644
index 1c62b4f92..000000000
--- a/doc/manual/images/callouts/5.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/6.gif b/doc/manual/images/callouts/6.gif
deleted file mode 100644
index 23bc5555d..000000000
--- a/doc/manual/images/callouts/6.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/7.gif b/doc/manual/images/callouts/7.gif
deleted file mode 100644
index e55ce8958..000000000
--- a/doc/manual/images/callouts/7.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/8.gif b/doc/manual/images/callouts/8.gif
deleted file mode 100644
index 49375e09f..000000000
--- a/doc/manual/images/callouts/8.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/images/callouts/9.gif b/doc/manual/images/callouts/9.gif
deleted file mode 100644
index da12a4fe2..000000000
--- a/doc/manual/images/callouts/9.gif
+++ /dev/null
Binary files differ
diff --git a/doc/manual/local.mk b/doc/manual/local.mk
index 4376c3644..ce05c6234 100644
--- a/doc/manual/local.mk
+++ b/doc/manual/local.mk
@@ -4,11 +4,10 @@ ifeq ($(doc_generate),yes)
XSLTPROC = $(xsltproc) --nonet $(xmlflags) \
--param section.autolabel 1 \
--param section.label.includes.component.label 1 \
- --param html.stylesheet \'style.css\' \
--param xref.with.number.and.title 1 \
--param toc.section.depth 3 \
--param admon.style \'\' \
- --param callout.graphics.extension \'.gif\' \
+ --param callout.graphics 0 \
--param contrib.inline.enabled 0 \
--stringparam generate.toc "book toc" \
--param keep.relative.image.uris 0
@@ -66,12 +65,10 @@ $(d)/manual.html: $(d)/manual.xml $(MANUAL_SRCS) $(d)/manual.is-valid
$(docbookxsl)/profiling/profile.xsl $< | \
$(XSLTPROC) --output $@ $(docbookxsl)/xhtml/docbook.xsl -
-$(foreach file, $(d)/manual.html $(d)/style.css, $(eval $(call install-data-in, $(file), $(docdir)/manual)))
+$(foreach file, $(d)/manual.html, $(eval $(call install-data-in, $(file), $(docdir)/manual)))
$(foreach file, $(wildcard $(d)/figures/*.png), $(eval $(call install-data-in, $(file), $(docdir)/manual/figures)))
-$(foreach file, $(wildcard $(d)/images/callouts/*.gif), $(eval $(call install-data-in, $(file), $(docdir)/manual/images/callouts)))
-
$(eval $(call install-symlink, manual.html, $(docdir)/manual/index.html))
diff --git a/doc/manual/style.css b/doc/manual/style.css
deleted file mode 100644
index 592583ab0..000000000
--- a/doc/manual/style.css
+++ /dev/null
@@ -1,263 +0,0 @@
-/* Copied from http://bakefile.sourceforge.net/, which appears
- licensed under the GNU GPL. */
-
-
-/***************************************************************************
- Basic headers and text:
- ***************************************************************************/
-
-body
-{
- font-family: "Nimbus Sans L", sans-serif;
- background: white;
- margin: 2em 1em 2em 1em;
-}
-
-h1, h2, h3, h4
-{
- color: #005aa0;
-}
-
-h1 /* title */
-{
- font-size: 200%;
-}
-
-div.part h1
-{
- font-size: 240%;
-}
-
-h2 /* chapters, appendices, subtitle */
-{
- font-size: 180%;
-}
-
-div.part
-{
- margin-top: 4em;
-}
-
-/* Extra space between chapters, appendices. */
-div.chapter > div.titlepage h2, div.appendix > div.titlepage h2
-{
- margin-top: 1.5em;
-}
-
-div.section > div.titlepage h2 /* sections */
-{
- font-size: 150%;
- margin-top: 1.5em;
-}
-
-h3 /* subsections */
-{
- font-size: 125%;
-}
-
-div.simplesect h2
-{
- font-size: 110%;
-}
-
-div.appendix h3
-{
- font-size: 150%;
- margin-top: 1.5em;
-}
-
-div.refentry\.separator
-{
- margin-top: 2.5em;
- margin-bottom: 2em;
-}
-
-div.refnamediv h2, div.refsynopsisdiv h2, div.refsection h2 /* refentry parts */
-{
- margin-top: 1.4em;
- font-size: 125%;
-}
-
-div.refsection h3
-{
- font-size: 110%;
-}
-
-
-/***************************************************************************
- Examples:
- ***************************************************************************/
-
-div.example
-{
- border: 1px solid #b0b0b0;
- padding: 6px 6px;
- margin-left: 1.5em;
- margin-right: 1.5em;
- background: #f4f4f8;
- border-radius: 0.4em;
-}
-
-div.example p.title
-{
- margin-top: 0em;
-}
-
-div.example pre
-{
-}
-
-
-/***************************************************************************
- Screen dumps:
- ***************************************************************************/
-
-pre.screen, pre.programlisting
-{
- padding: 6px 6px;
- margin-left: 1.5em;
- margin-right: 1.5em;
- color: #600000;
- background: #f4f4f8;
- font-family: monospace;
-}
-
-div.example pre.programlisting
-{
- border: 0px;
- padding: 0 0;
- margin: 0 0 0 0;
-}
-
-
-/***************************************************************************
- Notes, warnings etc:
- ***************************************************************************/
-
-.note, .warning
-{
- border: 1px solid #b0b0b0;
- padding: 3px 3px;
- margin-left: 1.5em;
- margin-right: 1.5em;
- margin-bottom: 1em;
- padding: 0.3em 0.3em 0.3em 0.3em;
- background: #fffff5;
- border-radius: 0.4em;
-}
-
-div.note, div.warning
-{
- font-style: italic;
-}
-
-div.note h3, div.warning h3
-{
- color: red;
- font-size: 100%;
- padding-right: 0.5em;
- display: inline;
-}
-
-div.note p, div.warning p
-{
- margin-bottom: 0em;
-}
-
-div.note h3 + p, div.warning h3 + p
-{
- display: inline;
-}
-
-div.note h3
-{
- color: blue;
- font-size: 100%;
-}
-
-div.navfooter *
-{
- font-size: 90%;
-}
-
-
-/***************************************************************************
- Links colors and highlighting:
- ***************************************************************************/
-
-a { text-decoration: none; }
-a:hover { text-decoration: underline; }
-a:link { color: #0048b3; }
-a:visited { color: #002a6a; }
-
-
-/***************************************************************************
- Table of contents:
- ***************************************************************************/
-
-div.toc
-{
- font-size: 90%;
-}
-
-div.toc dl
-{
- margin-top: 0em;
- margin-bottom: 0em;
-}
-
-
-/***************************************************************************
- Special elements:
- ***************************************************************************/
-
-tt, code
-{
- color: #400000;
-}
-
-.term
-{
- font-weight: bold;
-
-}
-
-div.variablelist dd p, div.glosslist dd p
-{
- margin-top: 0em;
-}
-
-div.variablelist dd, div.glosslist dd
-{
- margin-left: 1.5em;
-}
-
-div.glosslist dt
-{
- font-style: italic;
-}
-
-.varname
-{
- color: #400000;
-}
-
-span.command strong
-{
- font-weight: normal;
- color: #400000;
-}
-
-div.calloutlist table
-{
-}
-
-table
-{
- border-collapse: collapse;
-}
-
-div.affiliation
-{
- font-style: italic;
-}
diff --git a/mk/README.md b/mk/README.md
deleted file mode 100644
index e4cd742b4..000000000
--- a/mk/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-This is a set of helper Makefiles for doing non-recursive builds with
-GNU Make. The canonical source can be found at
-https://github.com/edolstra/make-rules. You should copy the files
-into the `mk` subdirectory of your project.
-
-TODO: write more documentation.
diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh
index 3fea7e056..e00708f6c 100644
--- a/scripts/install-nix-from-closure.sh
+++ b/scripts/install-nix-from-closure.sh
@@ -87,7 +87,7 @@ if ! [ -e $dest ]; then
fi
if ! [ -w $dest ]; then
- echo "$0: directory $dest exists, but is not writable by you. This could indicate that another user has already performed a single-user installation of Nix on this system. If you wish to enable multi-user support see http://nixos.org/nix/manual/#ssec-multi-user. If you wish to continue with a single-user install for $USER please run 'chown -R $USER $dest' as root." >&2
+ echo "$0: directory $dest exists, but is not writable by you. This could indicate that another user has already performed a single-user installation of Nix on this system. If you wish to enable multi-user support see https://nixos.org/nix/manual/#ssec-multi-user. If you wish to continue with a single-user install for $USER please run 'chown -R $USER $dest' as root." >&2
exit 1
fi
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc
index 717faec92..3a2d84861 100644
--- a/src/libstore/binary-cache-store.cc
+++ b/src/libstore/binary-cache-store.cc
@@ -106,7 +106,7 @@ void BinaryCacheStore::writeNarInfo(ref<NarInfo> narInfo)
{
auto state_(state.lock());
- state_->pathInfoCache.upsert(hashPart, std::shared_ptr<NarInfo>(narInfo));
+ state_->pathInfoCache.upsert(hashPart, PathInfoCacheValue { .value = std::shared_ptr<NarInfo>(narInfo) });
}
if (diskCache)
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 2025af33e..ae7513ad8 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -615,7 +615,8 @@ uint64_t LocalStore::addValidPath(State & state,
{
auto state_(Store::state.lock());
- state_->pathInfoCache.upsert(storePathToHash(printStorePath(info.path)), std::make_shared<ValidPathInfo>(info));
+ state_->pathInfoCache.upsert(storePathToHash(printStorePath(info.path)),
+ PathInfoCacheValue{ .value = std::make_shared<const ValidPathInfo>(info) });
}
return id;
@@ -996,16 +997,18 @@ void LocalStore::addToStore(const ValidPathInfo & info, Source & source,
deletePath(realPath);
+ if (info.ca != "" &&
+ !((hasPrefix(info.ca, "text:") && !info.references.count(info.path))
+ || info.references.empty()))
+ settings.requireExperimentalFeature("ca-references");
+
/* While restoring the path from the NAR, compute the hash
of the NAR. */
std::unique_ptr<AbstractHashSink> hashSink;
- if (info.ca == "")
+ if (info.ca == "" || !info.references.count(info.path))
hashSink = std::make_unique<HashSink>(htSHA256);
- else {
- if (!info.references.empty())
- settings.requireExperimentalFeature("ca-references");
+ else
hashSink = std::make_unique<HashModuloSink>(htSHA256, storePathToHash(printStorePath(info.path)));
- }
LambdaSource wrapperSource([&](unsigned char * data, size_t len) -> size_t {
size_t n = source.read(data, len);
@@ -1260,7 +1263,7 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
printMsg(lvlTalkative, "checking contents of '%s'", printStorePath(i));
std::unique_ptr<AbstractHashSink> hashSink;
- if (info->ca == "")
+ if (info->ca == "" || !info->references.count(info->path))
hashSink = std::make_unique<HashSink>(info->narHash.type);
else
hashSink = std::make_unique<HashModuloSink>(info->narHash.type, storePathToHash(printStorePath(info->path)));
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index eb17d5cd2..66a9d9fb5 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -227,6 +227,14 @@ std::string Store::getUri()
return "";
}
+bool Store::PathInfoCacheValue::isKnownNow()
+{
+ std::chrono::duration ttl = didExist()
+ ? std::chrono::seconds(settings.ttlPositiveNarInfoCache)
+ : std::chrono::seconds(settings.ttlNegativeNarInfoCache);
+
+ return std::chrono::steady_clock::now() < time_point + ttl;
+}
bool Store::isValidPath(const StorePath & storePath)
{
@@ -235,9 +243,9 @@ bool Store::isValidPath(const StorePath & storePath)
{
auto state_(state.lock());
auto res = state_->pathInfoCache.get(hashPart);
- if (res) {
+ if (res && res->isKnownNow()) {
stats.narInfoReadAverted++;
- return *res != 0;
+ return res->didExist();
}
}
@@ -247,7 +255,7 @@ bool Store::isValidPath(const StorePath & storePath)
stats.narInfoReadAverted++;
auto state_(state.lock());
state_->pathInfoCache.upsert(hashPart,
- res.first == NarInfoDiskCache::oInvalid ? 0 : res.second);
+ res.first == NarInfoDiskCache::oInvalid ? PathInfoCacheValue{} : PathInfoCacheValue { .value = res.second });
return res.first == NarInfoDiskCache::oValid;
}
}
@@ -302,11 +310,11 @@ void Store::queryPathInfo(const StorePath & storePath,
{
auto res = state.lock()->pathInfoCache.get(hashPart);
- if (res) {
+ if (res && res->isKnownNow()) {
stats.narInfoReadAverted++;
- if (!*res)
+ if (!res->didExist())
throw InvalidPath("path '%s' is not valid", printStorePath(storePath));
- return callback(ref<const ValidPathInfo>(*res));
+ return callback(ref<const ValidPathInfo>(res->value));
}
}
@@ -317,7 +325,7 @@ void Store::queryPathInfo(const StorePath & storePath,
{
auto state_(state.lock());
state_->pathInfoCache.upsert(hashPart,
- res.first == NarInfoDiskCache::oInvalid ? 0 : res.second);
+ res.first == NarInfoDiskCache::oInvalid ? PathInfoCacheValue{} : PathInfoCacheValue{ .value = res.second });
if (res.first == NarInfoDiskCache::oInvalid ||
res.second->path != storePath)
throw InvalidPath("path '%s' is not valid", printStorePath(storePath));
@@ -341,7 +349,7 @@ void Store::queryPathInfo(const StorePath & storePath,
{
auto state_(state.lock());
- state_->pathInfoCache.upsert(hashPart, info);
+ state_->pathInfoCache.upsert(hashPart, PathInfoCacheValue { .value = info });
}
if (!info || info->path != parseStorePath(storePath)) {
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 88cfa5b5a..81014763d 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -16,6 +16,7 @@
#include <unordered_set>
#include <memory>
#include <string>
+#include <chrono>
namespace nix {
@@ -262,10 +263,28 @@ public:
protected:
+ struct PathInfoCacheValue {
+
+ // Time of cache entry creation or update
+ std::chrono::time_point<std::chrono::steady_clock> time_point = std::chrono::steady_clock::now();
+
+ // Null if missing
+ std::shared_ptr<const ValidPathInfo> value;
+
+ // Whether the value is valid as a cache entry. The path may not exist.
+ bool isKnownNow();
+
+ // Past tense, because a path can only be assumed to exists when
+ // isKnownNow() && didExist()
+ inline bool didExist() {
+ return value != nullptr;
+ }
+ };
+
struct State
{
// FIXME: fix key
- LRUCache<std::string, std::shared_ptr<const ValidPathInfo>> pathInfoCache;
+ LRUCache<std::string, PathInfoCacheValue> pathInfoCache;
};
Sync<State> state;
diff --git a/src/nix/local.mk b/src/nix/local.mk
index 64eb8ef7d..6483000db 100644
--- a/src/nix/local.mk
+++ b/src/nix/local.mk
@@ -24,6 +24,6 @@ $(foreach name, \
$(eval $(call install-symlink, nix, $(bindir)/$(name))))
$(eval $(call install-symlink, $(bindir)/nix, $(libexecdir)/nix/build-remote))
-src/nix-env/nix-env.cc: src/nix-env/buildenv.nix.gen.hh
+src/nix-env/user-env.cc: src/nix-env/buildenv.nix.gen.hh
$(d)/flake.cc: $(d)/flake-template.nix.gen.hh