Compare commits

...

24 Commits

Author SHA1 Message Date
Eelco Dolstra
218cd6c16c Merge pull request #11981 from h0nIg/patch-2
docker: Fix command "nix profile install", Don't require --impure (fix for 2.25)
2024-11-29 12:53:47 +01:00
h0nIg
61950c3375 docker: Fix command "nix profile install", Don't require --impure 2024-11-27 13:35:18 +01:00
Jörg Thalheim
282bfbdacb Merge pull request #11973 from NixOS/mergify/bp/2.25-maintenance/pr-11959
more readable errors if symlinks cannot be created (backport #11959)
2024-11-27 08:04:06 +01:00
Jörg Thalheim
14432ea4a2 Merge pull request #11962 from NixOS/mergify/bp/2.25-maintenance/pr-11915
Bump fetcher cache version (backport #11915)
2024-11-27 07:23:52 +01:00
Jörg Thalheim
8d51c90872 more readable errors if symlinks cannot be created
Before:

filesystem error: cannot create symlink: Permission denied [/nix/store/1s2p3a4rs172336hj2l8n20nz74hf71j-nix-eval-jobs-2.24.1.drv] [/1s2p3a4rs172336hj2l8n20nz74hf71j-nix-eval-jobs-2.24.1.drv.tmp-2772352-1316231068]

Now:

creating symlink '/wfxz2q489c811n08cdqj7ywxm3n4z6m5-nix-eval-jobs-2.24.1.drv.tmp-2971297-324653080' -> '/nix/store/wfxz2q489c811n08cdqj7ywxm3n4z6m5-nix-eval-jobs-2.24.1.drv': Permission denied

(cherry picked from commit 5b8728d393)

# Conflicts:
#	src/nix/flake.cc
2024-11-27 07:21:10 +01:00
Eelco Dolstra
118d50992c Merge pull request #11968 from NixOS/mergify/bp/2.25-maintenance/pr-11878
Remove warning that interpretation of .drv has changed (backport #11878)
2024-11-26 14:51:50 +01:00
Eelco Dolstra
9f9b2ed48c Merge pull request #11966 from NixOS/mergify/bp/2.25-maintenance/pr-11876
Filter OSC 8 correctly (backport #11876)
2024-11-26 14:10:16 +01:00
Eelco Dolstra
eb50683e81 Merge pull request #11965 from NixOS/mergify/bp/2.25-maintenance/pr-11884
nix path-info: Don't write to std::cout directly (backport #11884)
2024-11-26 13:58:42 +01:00
Eelco Dolstra
c381199e97 Merge pull request #11964 from NixOS/mergify/bp/2.25-maintenance/pr-11901
tests/functional/flakes/develop.sh: Don't hang (backport #11901)
2024-11-26 13:35:14 +01:00
Eelco Dolstra
072ebeee79 Merge pull request #11963 from NixOS/mergify/bp/2.25-maintenance/pr-11902
Fix issue #11892 (backport #11902)
2024-11-26 13:16:35 +01:00
Robert Hensing
3501c737d3 Remove warning that interpretation of .drv has changed
This was first tagged as 2.15.0, 1½ years ago; plenty of time for
everyone to catch up.

By now, the warning is causing more confusion than that it is helpful,
because passing a `.drv` or `drvPath` has legitimate use cases.

(cherry picked from commit f534a7a524)
2024-11-26 11:27:41 +00:00
Jack Wilsdon
12eff94815 Filter OSC 8 correctly
This allows Nix to use lowdown 1.2.0 which outputs OSC-8 links.

(cherry picked from commit 1301f8434d)
2024-11-26 11:20:35 +00:00
Eelco Dolstra
89f4ac3d2c nix path-info: Don't write to std::cout directly
This interferes with the progress bar, resulting in output like

  evaluating derivation 'git+file:///home/eelco/Dev/nix-master#packages.x86_64-linux.default'/nix/store/zz8v96j5md952x0mxfix12xqnvq5qv5x-nix-2.26.0pre20241114_a95f6ea.drv

(cherry picked from commit 33a0fa882f)
2024-11-26 11:20:35 +00:00
Eelco Dolstra
1dbe60e073 tests/functional/flakes/develop.sh: Don't hang
The bash shell started by `nix develop` waited forever for stdin
input.

Fixes #11827.

(cherry picked from commit 428af8c66f)
2024-11-26 11:19:33 +00:00
Robert Hensing
4e2824ce93 Bump fetcher cache version
We're getting more reports in https://github.com/NixOS/nix/issues/10985

It appears that something hasn't gone right process-wise.
I find this mistake not to be worth investigating, but rather something
to pay attention to going forward.

Let's nip this in the bud.

Closes https://github.com/NixOS/nix/issues/10985

(cherry picked from commit e948c8e033)
2024-11-26 11:19:29 +00:00
Robert Hensing
3bc3e55736 Fix issue 11892
It seems that I copied the expression for baseDir thoughtlessly and
did not come back to it.

- `baseDir` was only used in the `fromArgs` branch.
- `fromArgs` is true when `packages` is true.

(cherry picked from commit c4b95dbdd1)
2024-11-26 11:19:29 +00:00
Eelco Dolstra
d97ebe519a Bump version 2024-11-14 11:37:15 +01:00
Eelco Dolstra
f87f87120a Bump version 2024-11-13 21:04:28 +01:00
Eelco Dolstra
5ae53d4730 nix-everything: Pass through a version attribute
The existence of this attribute is assumed by the Determinate
Installer packaging and maybe others.

(cherry picked from commit 06769eb2bf)
2024-11-13 14:49:51 +01:00
Eelco Dolstra
7bc52df684 Merge pull request #11861 from DeterminateSystems/nix-2.25-default
[2.25] Make the default package point to the old build
2024-11-12 17:12:12 +01:00
Eelco Dolstra
3e883b9eaf Make the default package point to the old build
There are some differences that are causing issues, like the fact that
nix-ng doesn't have a version attribute.
2024-11-12 16:26:40 +01:00
Eelco Dolstra
6b96c66302 Merge pull request #11856 from nix-windows/fix-windows-env-var-arg-order
[Backport 2.25] Fix argument order in the Windows implementation of `getEnvOs`
2024-11-12 11:04:59 +01:00
Eelco Dolstra
9213bf55ce Bump version 2024-11-11 17:08:24 +01:00
Eelco Dolstra
5c5a737885 Mark stable release 2024-11-11 15:14:57 +01:00
16 changed files with 90 additions and 41 deletions

View File

@@ -1 +1 @@
2.25.0
2.25.3

View File

@@ -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

View File

@@ -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;

View File

@@ -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.

View File

@@ -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),
};

View File

@@ -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);

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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++;
}

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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());
}
}

View File

@@ -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

View File

@@ -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 #

View File

@@ -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