Compare commits
24 Commits
unix-sourc
...
2.25.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
218cd6c16c | ||
|
|
61950c3375 | ||
|
|
282bfbdacb | ||
|
|
14432ea4a2 | ||
|
|
8d51c90872 | ||
|
|
118d50992c | ||
|
|
9f9b2ed48c | ||
|
|
eb50683e81 | ||
|
|
c381199e97 | ||
|
|
072ebeee79 | ||
|
|
3501c737d3 | ||
|
|
12eff94815 | ||
|
|
89f4ac3d2c | ||
|
|
1dbe60e073 | ||
|
|
4e2824ce93 | ||
|
|
3bc3e55736 | ||
|
|
d97ebe519a | ||
|
|
f87f87120a | ||
|
|
5ae53d4730 | ||
|
|
7bc52df684 | ||
|
|
3e883b9eaf | ||
|
|
6b96c66302 | ||
|
|
9213bf55ce | ||
|
|
5c5a737885 |
@@ -241,14 +241,14 @@ let
|
||||
mkdir -p $out/nix/var/nix/profiles/per-user/root
|
||||
|
||||
ln -s ${profile} $out/nix/var/nix/profiles/default-1-link
|
||||
ln -s $out/nix/var/nix/profiles/default-1-link $out/nix/var/nix/profiles/default
|
||||
ln -s /nix/var/nix/profiles/default-1-link $out/nix/var/nix/profiles/default
|
||||
ln -s /nix/var/nix/profiles/default $out/root/.nix-profile
|
||||
|
||||
ln -s ${channel} $out/nix/var/nix/profiles/per-user/root/channels-1-link
|
||||
ln -s $out/nix/var/nix/profiles/per-user/root/channels-1-link $out/nix/var/nix/profiles/per-user/root/channels
|
||||
ln -s /nix/var/nix/profiles/per-user/root/channels-1-link $out/nix/var/nix/profiles/per-user/root/channels
|
||||
|
||||
mkdir -p $out/root/.nix-defexpr
|
||||
ln -s $out/nix/var/nix/profiles/per-user/root/channels $out/root/.nix-defexpr/channels
|
||||
ln -s /nix/var/nix/profiles/per-user/root/channels $out/root/.nix-defexpr/channels
|
||||
echo "${channelURL} ${channelName}" > $out/root/.nix-channels
|
||||
|
||||
mkdir -p $out/bin $out/usr/bin
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
officialRelease = false;
|
||||
officialRelease = true;
|
||||
|
||||
linux32BitSystems = [ "i686-linux" ];
|
||||
linux64BitSystems = [ "x86_64-linux" "aarch64-linux" ];
|
||||
@@ -220,7 +220,7 @@
|
||||
# for which we don't apply the full build matrix such as cross or static.
|
||||
inherit (nixpkgsFor.${system}.native)
|
||||
changelog-d;
|
||||
default = self.packages.${system}.nix-ng;
|
||||
default = self.packages.${system}.nix;
|
||||
nix-manual = nixpkgsFor.${system}.native.nixComponents.nix-manual;
|
||||
nix-internal-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-internal-api-docs;
|
||||
nix-external-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-external-api-docs;
|
||||
|
||||
@@ -95,6 +95,8 @@
|
||||
nix-functional-tests
|
||||
];
|
||||
passthru = prevAttrs.passthru // {
|
||||
inherit (nix-cli) version;
|
||||
|
||||
/**
|
||||
These are the libraries that are part of the Nix project. They are used
|
||||
by the Nix CLI and other tools.
|
||||
|
||||
@@ -32,16 +32,6 @@ InstallableDerivedPath InstallableDerivedPath::parse(
|
||||
// store path.
|
||||
[&](const ExtendedOutputsSpec::Default &) -> DerivedPath {
|
||||
auto storePath = store->followLinksToStorePath(prefix);
|
||||
// Remove this prior to stabilizing the new CLI.
|
||||
if (storePath.isDerivation()) {
|
||||
auto oldDerivedPath = DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(storePath),
|
||||
.outputs = OutputsSpec::All { },
|
||||
};
|
||||
warn(
|
||||
"The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '%s'",
|
||||
oldDerivedPath.to_string(*store));
|
||||
};
|
||||
return DerivedPath::Opaque {
|
||||
.path = std::move(storePath),
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ struct CacheImpl : Cache
|
||||
{
|
||||
auto state(_state.lock());
|
||||
|
||||
auto dbPath = getCacheDir() + "/fetcher-cache-v2.sqlite";
|
||||
auto dbPath = getCacheDir() + "/fetcher-cache-v3.sqlite";
|
||||
createDirs(dirOf(dbPath));
|
||||
|
||||
state->db = SQLite(dbPath);
|
||||
|
||||
@@ -57,4 +57,9 @@ TEST(filterANSIEscapes, utf8)
|
||||
ASSERT_EQ(filterANSIEscapes("f𐍈𐍈bär", true, 4), "f𐍈𐍈b");
|
||||
}
|
||||
|
||||
TEST(filterANSIEscapes, osc8)
|
||||
{
|
||||
ASSERT_EQ(filterANSIEscapes("\e]8;;http://example.com\e\\This is a link\e]8;;\e\\"), "This is a link");
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
|
||||
@@ -602,7 +602,11 @@ std::pair<AutoCloseFD, Path> createTempFile(const Path & prefix)
|
||||
|
||||
void createSymlink(const Path & target, const Path & link)
|
||||
{
|
||||
fs::create_symlink(target, link);
|
||||
try {
|
||||
fs::create_symlink(target, link);
|
||||
} catch (fs::filesystem_error & e) {
|
||||
throw SysError("creating symlink '%1%' -> '%2%'", link, target);
|
||||
}
|
||||
}
|
||||
|
||||
void replaceSymlink(const fs::path & target, const fs::path & link)
|
||||
@@ -615,10 +619,16 @@ void replaceSymlink(const fs::path & target, const fs::path & link)
|
||||
fs::create_symlink(target, tmp);
|
||||
} catch (fs::filesystem_error & e) {
|
||||
if (e.code() == std::errc::file_exists) continue;
|
||||
throw;
|
||||
throw SysError("creating symlink '%1%' -> '%2%'", tmp, target);
|
||||
}
|
||||
|
||||
try {
|
||||
fs::rename(tmp, link);
|
||||
} catch (fs::filesystem_error & e) {
|
||||
if (e.code() == std::errc::file_exists) continue;
|
||||
throw SysError("renaming '%1%' to '%2%'", tmp, link);
|
||||
}
|
||||
|
||||
fs::rename(tmp, link);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -250,8 +250,6 @@ void setWriteTime(const std::filesystem::path & path, const struct stat & st);
|
||||
/**
|
||||
* Create a symlink.
|
||||
*
|
||||
* In the process of being deprecated for
|
||||
* `std::filesystem::create_symlink`.
|
||||
*/
|
||||
void createSymlink(const Path & target, const Path & link);
|
||||
|
||||
|
||||
@@ -45,6 +45,13 @@ std::string filterANSIEscapes(std::string_view s, bool filterAll, unsigned int w
|
||||
while (i != s.end() && *i >= 0x20 && *i <= 0x2f) e += *i++;
|
||||
// eat final byte
|
||||
if (i != s.end() && *i >= 0x40 && *i <= 0x7e) e += last = *i++;
|
||||
} else if (i != s.end() && *i == ']') {
|
||||
// OSC
|
||||
e += *i++;
|
||||
// eat ESC
|
||||
while (i != s.end() && *i != '\e') e += *i++;
|
||||
// eat backslash
|
||||
if (i != s.end() && *i == '\\') e += last = *i++;
|
||||
} else {
|
||||
if (i != s.end() && *i >= 0x40 && *i <= 0x5f) e += *i++;
|
||||
}
|
||||
|
||||
@@ -340,13 +340,15 @@ static void main_nix_build(int argc, char * * argv)
|
||||
exprs = {state->parseStdin()};
|
||||
else
|
||||
for (auto i : remainingArgs) {
|
||||
auto baseDir = inShebang && !packages ? absPath(dirOf(script)) : i;
|
||||
|
||||
if (fromArgs)
|
||||
if (fromArgs) {
|
||||
auto shebangBaseDir = absPath(dirOf(script));
|
||||
exprs.push_back(state->parseExprFromString(
|
||||
std::move(i),
|
||||
(inShebang && compatibilitySettings.nixShellShebangArgumentsRelativeToScript) ? lookupFileArg(*state, baseDir) : state->rootPath(".")
|
||||
(inShebang && compatibilitySettings.nixShellShebangArgumentsRelativeToScript)
|
||||
? lookupFileArg(*state, shebangBaseDir)
|
||||
: state->rootPath(".")
|
||||
));
|
||||
}
|
||||
else {
|
||||
auto absolute = i;
|
||||
try {
|
||||
|
||||
@@ -941,7 +941,7 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
|
||||
}
|
||||
continue;
|
||||
} else
|
||||
fs::create_symlink(target, to2);
|
||||
createSymlink(target, to2);
|
||||
}
|
||||
else
|
||||
throw Error("file '%s' has unsupported type", from2);
|
||||
|
||||
@@ -139,12 +139,12 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
|
||||
|
||||
Category category() override { return catSecondary; }
|
||||
|
||||
void printSize(uint64_t value)
|
||||
void printSize(std::ostream & str, uint64_t value)
|
||||
{
|
||||
if (humanReadable)
|
||||
std::cout << fmt("\t%s", renderSize(value, true));
|
||||
str << fmt("\t%s", renderSize(value, true));
|
||||
else
|
||||
std::cout << fmt("\t%11d", value);
|
||||
str << fmt("\t%11d", value);
|
||||
}
|
||||
|
||||
void run(ref<Store> store, StorePaths && storePaths) override
|
||||
@@ -154,11 +154,11 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
|
||||
pathLen = std::max(pathLen, store->printStorePath(storePath).size());
|
||||
|
||||
if (json) {
|
||||
std::cout << pathInfoToJSON(
|
||||
logger->cout(pathInfoToJSON(
|
||||
*store,
|
||||
// FIXME: preserve order?
|
||||
StorePathSet(storePaths.begin(), storePaths.end()),
|
||||
showClosureSize).dump();
|
||||
showClosureSize).dump());
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -167,30 +167,32 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
|
||||
auto info = store->queryPathInfo(storePath);
|
||||
auto storePathS = store->printStorePath(info->path);
|
||||
|
||||
std::cout << storePathS;
|
||||
std::ostringstream str;
|
||||
|
||||
str << storePathS;
|
||||
|
||||
if (showSize || showClosureSize || showSigs)
|
||||
std::cout << std::string(std::max(0, (int) pathLen - (int) storePathS.size()), ' ');
|
||||
str << std::string(std::max(0, (int) pathLen - (int) storePathS.size()), ' ');
|
||||
|
||||
if (showSize)
|
||||
printSize(info->narSize);
|
||||
printSize(str, info->narSize);
|
||||
|
||||
if (showClosureSize) {
|
||||
StorePathSet closure;
|
||||
store->computeFSClosure(storePath, closure, false, false);
|
||||
printSize(getStoreObjectsTotalSize(*store, closure));
|
||||
printSize(str, getStoreObjectsTotalSize(*store, closure));
|
||||
}
|
||||
|
||||
if (showSigs) {
|
||||
std::cout << '\t';
|
||||
str << '\t';
|
||||
Strings ss;
|
||||
if (info->ultimate) ss.push_back("ultimate");
|
||||
if (info->ca) ss.push_back("ca:" + renderContentAddress(*info->ca));
|
||||
for (auto & sig : info->sigs) ss.push_back(sig);
|
||||
std::cout << concatStringsSep(" ", ss);
|
||||
str << concatStringsSep(" ", ss);
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
logger->cout(str.str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ expectStderr 1 nix develop --unset-env-var FOO --set-env-var FOO 'BAR' --no-writ
|
||||
grepQuiet "error: Cannot set environment variable 'FOO' that is unset with '--unset-env-var'"
|
||||
|
||||
# Check that multiple `--ignore-env`'s are okay.
|
||||
expectStderr 0 nix develop --ignore-env --set-env-var FOO 'BAR' --ignore-env .#hello
|
||||
expectStderr 0 nix develop --ignore-env --set-env-var FOO 'BAR' --ignore-env .#hello < /dev/null
|
||||
|
||||
# Determine the bashInteractive executable.
|
||||
nix build --no-write-lock-file './nixpkgs#bashInteractive' --out-link ./bash-interactive
|
||||
|
||||
@@ -167,6 +167,35 @@ EOF
|
||||
chmod a+x $TEST_ROOT/marco/polo/default.nix
|
||||
(cd $TEST_ROOT/marco && ./polo/default.nix | grepQuiet "Polo")
|
||||
|
||||
# https://github.com/NixOS/nix/issues/11892
|
||||
mkdir $TEST_ROOT/issue-11892
|
||||
cat >$TEST_ROOT/issue-11892/shebangscript <<EOF
|
||||
#!$(type -P env) nix-shell
|
||||
#! nix-shell -I nixpkgs=$shellDotNix
|
||||
#! nix-shell -p 'callPackage (import ./my_package.nix) {}'
|
||||
#! nix-shell -i bash
|
||||
set -euxo pipefail
|
||||
my_package
|
||||
EOF
|
||||
cat >$TEST_ROOT/issue-11892/my_package.nix <<EOF
|
||||
{ stdenv, shell, ... }:
|
||||
stdenv.mkDerivation {
|
||||
name = "my_package";
|
||||
buildCommand = ''
|
||||
mkdir -p \$out/bin
|
||||
( echo "#!\${shell}"
|
||||
echo "echo 'ok' 'baz11892'"
|
||||
) > \$out/bin/my_package
|
||||
cat \$out/bin/my_package
|
||||
chmod a+x \$out/bin/my_package
|
||||
'';
|
||||
}
|
||||
EOF
|
||||
chmod a+x $TEST_ROOT/issue-11892/shebangscript
|
||||
$TEST_ROOT/issue-11892/shebangscript \
|
||||
| tee /dev/stderr \
|
||||
| grepQuiet "ok baz11892"
|
||||
|
||||
|
||||
#####################
|
||||
# Flake equivalents #
|
||||
|
||||
@@ -37,7 +37,7 @@ let pkgs = rec {
|
||||
mkdir -p $out
|
||||
ln -s ${setupSh} $out/setup
|
||||
'';
|
||||
};
|
||||
} // { inherit mkDerivation; };
|
||||
|
||||
shellDrv = mkDerivation {
|
||||
name = "shellDrv";
|
||||
@@ -94,5 +94,9 @@ let pkgs = rec {
|
||||
chmod a+rx $out/bin/ruby
|
||||
'';
|
||||
|
||||
inherit (cfg) shell;
|
||||
|
||||
callPackage = f: args: f (pkgs // args);
|
||||
|
||||
inherit pkgs;
|
||||
}; in pkgs
|
||||
|
||||
Reference in New Issue
Block a user