Skip to content

Commit

Permalink
Rebase to 2.25.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dramforever committed Dec 16, 2024
1 parent 808b585 commit 8da1a67
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 43 deletions.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions nix-patches/nix-environment.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index cc416a4d6..a3e348a21 100644
index b64e73c26..62364e2ea 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -122,6 +122,8 @@ void loadConfFile()
@@ -112,6 +112,8 @@ void loadConfFile(AbstractConfig & config)
~/.nix/nix.conf or the command line. */
globalConfig.resetOverridden();
config.resetOverridden();

+ settings.environment.overridden = settings.environment.hasInherited;
+
auto files = settings.nixUserConfFiles;
for (auto file = files.rbegin(); file != files.rend(); file++) {
globalConfig.applyConfigFile(*file);
@@ -319,6 +321,60 @@ Paths PluginFilesSetting::parse(const std::string & str) const
return BaseSetting<Paths>::parse(str);
applyConfigFile(*file);
@@ -308,6 +310,60 @@ unsigned int MaxBuildJobsSetting::parse(const std::string & str) const
}
}

+void EnvironmentSetting::appendOrSet(Strings newValue, bool append)
Expand Down Expand Up @@ -70,13 +70,13 @@ index cc416a4d6..a3e348a21 100644
+ }
+}

void initPlugins()
static void preloadNSS()
{
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 27caf42c4..c9819e1dc 100644
index ff3df46ba..58650bbbd 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -55,6 +55,24 @@ const uint32_t maxIdsPerBuild =
@@ -39,6 +39,24 @@ const uint32_t maxIdsPerBuild =
#endif
;

Expand All @@ -101,8 +101,8 @@ index 27caf42c4..c9819e1dc 100644
class Settings : public Config {

unsigned int getDefaultCores();
@@ -1094,6 +1112,23 @@ public:
store paths of the latest Nix release.
@@ -1236,6 +1254,23 @@ public:
Set it to 1 to warn on all paths.
)"
};
+
Expand Down Expand Up @@ -197,12 +197,12 @@ index 000000000..08c5a6e3f
+
+killDaemon
diff --git a/tests/functional/local.mk b/tests/functional/local.mk
index 21dabca88..ccd492e8f 100644
index e50b5eaf1..86618c7e2 100644
--- a/tests/functional/local.mk
+++ b/tests/functional/local.mk
@@ -97,6 +97,7 @@ nix_tests = \
@@ -84,6 +84,7 @@ nix_tests = \
post-hook.sh \
function-trace.sh \
flakes/config.sh \
fmt.sh \
+ environment.sh \
eval-store.sh \
Expand Down
39 changes: 20 additions & 19 deletions nix-patches/nix-flake-default.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc
index 0fe956ec0..00c62b870 100644
index 227bb64ed..72727e00f 100644
--- a/src/libcmd/installables.cc
+++ b/src/libcmd/installables.cc
@@ -21,6 +21,7 @@
Expand All @@ -10,7 +10,7 @@ index 0fe956ec0..00c62b870 100644

#include <regex>
#include <queue>
@@ -45,6 +46,23 @@ void completeFlakeInputPath(
@@ -47,6 +48,23 @@ void completeFlakeInputPath(
}
}

Expand All @@ -34,7 +34,7 @@ index 0fe956ec0..00c62b870 100644
MixFlakeOptions::MixFlakeOptions()
{
auto category = "Common flake-related options";
@@ -326,22 +344,37 @@ void completeFlakeRefWithFragment(
@@ -328,22 +346,37 @@ void completeFlakeRefWithFragment(
/* Look for flake output attributes that match the
prefix. */
try {
Expand All @@ -61,33 +61,34 @@ index 0fe956ec0..00c62b870 100644
prefixRoot = ".";
}
- auto flakeRefS = std::string(prefix.substr(0, hash));

- // TODO: ideally this would use the command base directory instead of assuming ".".
- auto flakeRef = parseFlakeRef(fetchSettings, expandTilde(flakeRefS), absPath("."));
+
+ auto flakeRefS =
+ isAttrPath
+ ? std::string(installablesSettings.getDefaultFlake(prefix))
+ : expandTilde(std::string(prefix.substr(0, hash)));
+
+ // FIXME: do tilde expansion.

// TODO: ideally this would use the command base directory instead of assuming ".".
- auto flakeRef = parseFlakeRef(fetchSettings, expandTilde(flakeRefS), fs::current_path().string());
+ auto flakeRef = parseFlakeRef(
+ fetchSettings,
+ flakeRefS,
+ isAttrPath ? std::optional<std::string>{} : absPath("."));
+ isAttrPath ? std::optional<std::string>{} : fs::current_path().string());

auto evalCache = openEvalCache(*evalState,
std::make_shared<flake::LockedFlake>(lockFlake(
@@ -352,6 +385,7 @@ void completeFlakeRefWithFragment(
@@ -354,6 +387,7 @@ void completeFlakeRefWithFragment(
if (prefixRoot == "."){
attrPathPrefixes.clear();
}
+
/* Complete 'fragment' relative to all the
attrpath prefixes as well as the root of the
flake. */
@@ -377,7 +411,12 @@ void completeFlakeRefWithFragment(
@@ -378,8 +412,14 @@ void completeFlakeRefWithFragment(
auto attrPath2 = (*attr)->getAttrPath(attr2);
/* Strip the attrpath prefix. */
attrPath2.erase(attrPath2.begin(), attrPath2.begin() + attrPathPrefix.size());
+
// FIXME: handle names with dots
- completions.add(flakeRefS + "#" + prefixRoot + concatStringsSep(".", evalState->symbols.resolve(attrPath2)));
+ std::string resolvedAttrPath2 = prefixRoot + concatStringsSep(".", evalState->symbols.resolve(attrPath2));
Expand All @@ -99,7 +100,7 @@ index 0fe956ec0..00c62b870 100644
}
}
}
@@ -414,7 +453,7 @@ void completeFlakeRef(AddCompletions & completions, ref<Store> store, std::strin
@@ -416,7 +456,7 @@ void completeFlakeRef(AddCompletions & completions, ref<Store> store, std::strin
if (!hasPrefix(prefix, "flake:") && hasPrefix(from, "flake:")) {
std::string from2(from, 6);
if (hasPrefix(from2, prefix))
Expand All @@ -108,7 +109,7 @@ index 0fe956ec0..00c62b870 100644
} else {
if (hasPrefix(from, prefix))
completions.add(from);
@@ -539,8 +578,13 @@ Installables SourceExprCommand::parseInstallables(
@@ -541,8 +581,13 @@ Installables SourceExprCommand::parseInstallables(
}

try {
Expand Down Expand Up @@ -147,10 +148,10 @@ index bf5759230..e4cd3494a 100644
enum class Realise {
/**
diff --git a/src/nix/search.cc b/src/nix/search.cc
index 7f8504d3f..f6e0891c0 100644
index c8d0b9e96..73a79b5c7 100644
--- a/src/nix/search.cc
+++ b/src/nix/search.cc
@@ -25,8 +25,9 @@ std::string wrap(std::string prefix, std::string s)
@@ -26,8 +26,9 @@ std::string wrap(std::string prefix, std::string s)
return concatStrings(prefix, s, ANSI_NORMAL);
}

Expand All @@ -161,7 +162,7 @@ index 7f8504d3f..f6e0891c0 100644
std::vector<std::string> res;
std::vector<std::string> excludeRes;

@@ -42,6 +43,24 @@ struct CmdSearch : InstallableValueCommand, MixJSON
@@ -43,6 +44,24 @@ struct CmdSearch : InstallableValueCommand, MixJSON
excludeRes.push_back(s);
}},
});
Expand All @@ -186,7 +187,7 @@ index 7f8504d3f..f6e0891c0 100644
}

std::string description() override
@@ -64,14 +83,21 @@ struct CmdSearch : InstallableValueCommand, MixJSON
@@ -65,14 +84,21 @@ struct CmdSearch : InstallableValueCommand, MixJSON
};
}

Expand All @@ -211,10 +212,10 @@ index 7f8504d3f..f6e0891c0 100644
std::vector<std::regex> regexes;
std::vector<std::regex> excludeRegexes;
diff --git a/tests/functional/flakes/flakes.sh b/tests/functional/flakes/flakes.sh
index 26b91eda7..3aab7bb29 100755
index 5e901c5d1..a7e42b6f8 100755
--- a/tests/functional/flakes/flakes.sh
+++ b/tests/functional/flakes/flakes.sh
@@ -214,7 +214,7 @@ nix build -o "$TEST_ROOT/result" flake1#foo
@@ -217,7 +217,7 @@ nix build -o "$TEST_ROOT/result" flake1#foo
[[ -e "$TEST_ROOT/result/hello" ]]

# Test packages.default.
Expand Down
8 changes: 4 additions & 4 deletions nix-patches/nix-search-meta.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
diff --git a/src/nix/search.cc b/src/nix/search.cc
index c92ed1663..8371bbd20 100644
index c8d0b9e96..1510b2955 100644
--- a/src/nix/search.cc
+++ b/src/nix/search.cc
@@ -9,6 +9,8 @@
#include "eval-cache.hh"
@@ -11,6 +11,8 @@
#include "attr-path.hh"
#include "hilite.hh"
#include "strings-inline.hh"
+#include "fmt.hh"
+#include "value-to-json.hh"

#include <regex>
#include <fstream>
@@ -153,10 +155,13 @@ struct CmdSearch : InstallableValueCommand, MixJSON
@@ -155,10 +157,13 @@ struct CmdSearch : InstallableValueCommand, MixJSON
{
results++;
if (json) {
Expand Down

0 comments on commit 8da1a67

Please sign in to comment.