Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bd3f3b324 | ||
|
|
ca3fc1693b | ||
|
|
4449b0da74 | ||
|
|
0c2fdd2f3c | ||
|
|
9ea29ea517 | ||
|
|
cd5fc45524 | ||
|
|
e60b90192a | ||
|
|
a45a7e8011 | ||
|
|
97fffd8765 | ||
|
|
3df1658ba1 | ||
|
|
56b8911766 | ||
|
|
c75907e47b | ||
|
|
5c87c40a5e | ||
|
|
59acf3b75c | ||
|
|
96ee5450d9 | ||
|
|
0f5c37c242 | ||
|
|
04a47e93f6 | ||
|
|
a673084733 | ||
|
|
d772a8b3dc | ||
|
|
f0a4f19087 | ||
|
|
8690b6f138 | ||
|
|
0624cf0f59 | ||
|
|
ee3f0b7a8b |
No files matched your search
+1
-1
@@ -14,7 +14,7 @@ queue_rules:
|
||||
pull_request_rules:
|
||||
- name: merge using the merge queue
|
||||
conditions:
|
||||
- base=master
|
||||
- base~=master|.+-maintenance
|
||||
- label~=merge-queue|dependencies
|
||||
actions:
|
||||
queue: {}
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ static char buf[1024];]],
|
||||
AC_LANG_POP(C++)
|
||||
|
||||
|
||||
AC_CHECK_FUNCS([statvfs pipe2])
|
||||
AC_CHECK_FUNCS([statvfs pipe2 close_range])
|
||||
|
||||
|
||||
# Check for lutimes, optionally used for changing the mtime of
|
||||
|
||||
@@ -223,6 +223,10 @@
|
||||
default = self.packages.${system}.nix-ng;
|
||||
nix-internal-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-internal-api-docs;
|
||||
nix-external-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-external-api-docs;
|
||||
nix-all-output-paths = nixpkgsFor.${system}.native.callPackage ./packaging/nix-all-output-paths.nix {
|
||||
packages =
|
||||
lib.mapAttrs (system: packages: packages.nix) self.packages;
|
||||
};
|
||||
}
|
||||
# We need to flatten recursive attribute sets of derivations to pass `flake check`.
|
||||
// flatMapAttrs
|
||||
|
||||
@@ -508,7 +508,7 @@
|
||||
''^tests/functional/ca/concurrent-builds\.sh$''
|
||||
''^tests/functional/ca/eval-store\.sh$''
|
||||
''^tests/functional/ca/gc\.sh$''
|
||||
''^tests/functional/ca/import-derivation\.sh$''
|
||||
''^tests/functional/ca/import-from-derivation\.sh$''
|
||||
''^tests/functional/ca/new-build-cmd\.sh$''
|
||||
''^tests/functional/ca/nix-shell\.sh$''
|
||||
''^tests/functional/ca/post-hook\.sh$''
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
{ lib, formats, nix, packages, stdenv, ... }:
|
||||
|
||||
let
|
||||
randomPick = packages."x86_64-linux";
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
version = randomPick.version;
|
||||
pname = "nix-all-output-paths";
|
||||
passAsFile = [ "content" ];
|
||||
nativeBuildInputs = [ nix ];
|
||||
json = (formats.json {}).generate "all-output-paths.json" (lib.mapAttrs (name: pkg: "${lib.getBin pkg}") packages);
|
||||
nix = ''
|
||||
{
|
||||
${
|
||||
lib.concatStringsSep "\n " (
|
||||
lib.mapAttrsToList
|
||||
(name: pkg: "${lib.strings.escapeNixIdentifier name} = ${lib.strings.escapeNixString "${lib.getBin pkg}"};")
|
||||
packages
|
||||
)
|
||||
}
|
||||
}
|
||||
'';
|
||||
buildCommand = ''
|
||||
mkdir -p $out
|
||||
cp $json $out/all-output-paths.json
|
||||
echo "$nix" > $out/all-output-paths.nix
|
||||
|
||||
mkdir -p $out/nix-support
|
||||
{
|
||||
echo "file all-output-paths $out/all-output-paths.json"
|
||||
echo "file all-output-paths-nix-deprecated $out/all-output-paths.nix"
|
||||
} >> $out/nix-support/hydra-build-products
|
||||
|
||||
r=$(nix-instantiate --store dummy:// --expr --eval --json \
|
||||
'builtins.fromJSON (builtins.readFile '$out'/all-output-paths.json) == import '$out'/all-output-paths.nix')
|
||||
if ! [[ $r == "true" ]]; then
|
||||
echo "The generated Nix file does not match the JSON file"
|
||||
echo "Nix file: $out/all-output-paths.nix"
|
||||
cat -n $out/all-output-paths.nix
|
||||
echo "JSON file: $out/all-output-paths.json"
|
||||
cat -n $out/all-output-paths.json
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
meta = {
|
||||
description = "A lookup file that gives a store path containing the Nix package manager for all supported system types";
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
# This file is tested by tests/installer/default.nix.
|
||||
if [ -n "$HOME" ] && [ -n "$USER" ]; then
|
||||
if [ -n "${HOME-}" ] && [ -n "${USER-}" ]; then
|
||||
|
||||
# Set up the per-user profile.
|
||||
|
||||
if [ -n "$NIX_STATE_HOME" ]; then
|
||||
if [ -n "${NIX_STATE_HOME-}" ]; then
|
||||
NIX_LINK="$NIX_STATE_HOME/profile"
|
||||
else
|
||||
NIX_LINK="$HOME/.nix-profile"
|
||||
|
||||
@@ -3136,7 +3136,11 @@ static void prim_zipAttrsWith(EvalState & state, const PosIdx pos, Value * * arg
|
||||
std::optional<ListBuilder> list;
|
||||
};
|
||||
|
||||
#if HAVE_BOEHMGC
|
||||
std::map<Symbol, Item, std::less<Symbol>, traceable_allocator<std::pair<const Symbol, Item>>> attrsSeen;
|
||||
#else
|
||||
std::map<Symbol, Item> attrsSeen;
|
||||
#endif
|
||||
|
||||
state.forceFunction(*args[0], pos, "while evaluating the first argument passed to builtins.zipAttrsWith");
|
||||
state.forceList(*args[1], pos, "while evaluating the second argument passed to builtins.zipAttrsWith");
|
||||
|
||||
@@ -28,6 +28,7 @@ subdir('build-utils-meson/subprojects')
|
||||
# HAVE_LUTIMES 1`. The `#define` is unconditional, 0 for not found and 1
|
||||
# for found. One therefore uses it with `#if` not `#ifdef`.
|
||||
check_funcs = [
|
||||
'close_range',
|
||||
# Optionally used for changing the mtime of symlinks.
|
||||
'lutimes',
|
||||
# Optionally used for creating pipes on Unix
|
||||
@@ -50,6 +51,14 @@ endforeach
|
||||
|
||||
subdir('build-utils-meson/threads')
|
||||
|
||||
# Check if -latomic is needed
|
||||
# This is needed for std::atomic on some platforms
|
||||
# We did not manage to test this reliably on all platforms, so we hardcode
|
||||
# it for now.
|
||||
if host_machine.cpu_family() == 'arm'
|
||||
deps_other += cxx.find_library('atomic')
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
socket = cxx.find_library('ws2_32')
|
||||
deps_other += socket
|
||||
|
||||
@@ -121,10 +121,13 @@ void Pipe::create()
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if __linux__ || __FreeBSD__
|
||||
// In future we can use a syscall wrapper, but at the moment musl and older glibc version don't support it.
|
||||
static int unix_close_range(unsigned int first, unsigned int last, int flags)
|
||||
{
|
||||
#if !HAVE_CLOSE_RANGE
|
||||
return syscall(SYS_close_range, first, last, (unsigned int)flags);
|
||||
#else
|
||||
return close_range(first, last, flags);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -22,8 +22,20 @@ R""(
|
||||
# nix flake archive --json --dry-run nixops
|
||||
```
|
||||
|
||||
* Upload all flake inputs to a different machine for remote evaluation
|
||||
|
||||
```
|
||||
# nix flake archive --to ssh://some-machine
|
||||
```
|
||||
|
||||
On the remote machine the flake can then be accessed via its store path. That's computed like this:
|
||||
|
||||
```
|
||||
# nix flake metadata --json | jq -r '.path'
|
||||
```
|
||||
|
||||
# Description
|
||||
|
||||
FIXME
|
||||
Copy a flake and all its inputs to a store. This is useful i.e. to evaluate flakes on a different host.
|
||||
|
||||
)""
|
||||
+1
-1
@@ -2,5 +2,5 @@ source common.sh
|
||||
|
||||
export NIX_TESTS_CA_BY_DEFAULT=1
|
||||
|
||||
cd .. && source import-derivation.sh
|
||||
cd .. && source import-from-derivation.sh
|
||||
|
||||
@@ -7,7 +7,7 @@ ca-tests := \
|
||||
$(d)/duplicate-realisation-in-closure.sh \
|
||||
$(d)/eval-store.sh \
|
||||
$(d)/gc.sh \
|
||||
$(d)/import-derivation.sh \
|
||||
$(d)/import-from-derivation.sh \
|
||||
$(d)/new-build-cmd.sh \
|
||||
$(d)/nix-copy.sh \
|
||||
$(d)/nix-run.sh \
|
||||
|
||||
@@ -16,7 +16,7 @@ suites += {
|
||||
'duplicate-realisation-in-closure.sh',
|
||||
'eval-store.sh',
|
||||
'gc.sh',
|
||||
'import-derivation.sh',
|
||||
'import-from-derivation.sh',
|
||||
'new-build-cmd.sh',
|
||||
'nix-copy.sh',
|
||||
'nix-run.sh',
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
with import ./config.nix;
|
||||
|
||||
let
|
||||
|
||||
bar = mkDerivation {
|
||||
name = "bar";
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
echo 'builtins.add 123 456' > $out
|
||||
'';
|
||||
};
|
||||
|
||||
value =
|
||||
# Test that pathExists can check the existence of /nix/store paths
|
||||
assert builtins.pathExists bar;
|
||||
import bar;
|
||||
|
||||
in
|
||||
|
||||
mkDerivation {
|
||||
name = "foo";
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
echo -n FOO${toString value} > $out
|
||||
'';
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStoreIfPossible
|
||||
|
||||
if nix-instantiate --readonly-mode ./import-derivation.nix; then
|
||||
echo "read-only evaluation of an imported derivation unexpectedly failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outPath=$(nix-build ./import-derivation.nix --no-out-link)
|
||||
|
||||
[ "$(cat "$outPath")" = FOO579 ]
|
||||
@@ -0,0 +1,33 @@
|
||||
with import ./config.nix;
|
||||
|
||||
rec {
|
||||
bar = mkDerivation {
|
||||
name = "bar";
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
echo 'builtins.add 123 456' > $out
|
||||
'';
|
||||
};
|
||||
|
||||
value =
|
||||
# Test that pathExists can check the existence of /nix/store paths
|
||||
assert builtins.pathExists bar;
|
||||
import bar;
|
||||
|
||||
result = mkDerivation {
|
||||
name = "foo";
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
echo -n FOO${toString value} > $out
|
||||
'';
|
||||
};
|
||||
|
||||
addPath = mkDerivation {
|
||||
name = "add-path";
|
||||
src = builtins.filterSource (path: type: true) result;
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
echo -n BLA$(cat $src) > $out
|
||||
'';
|
||||
};
|
||||
}
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
TODO_NixOS
|
||||
|
||||
clearStoreIfPossible
|
||||
|
||||
if nix-instantiate --readonly-mode ./import-from-derivation.nix -A result; then
|
||||
echo "read-only evaluation of an imported derivation unexpectedly failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outPath=$(nix-build ./import-from-derivation.nix -A result --no-out-link)
|
||||
|
||||
[ "$(cat "$outPath")" = FOO579 ]
|
||||
|
||||
# FIXME: the next tests are broken on CA.
|
||||
if [[ -n "${NIX_TESTS_CA_BY_DEFAULT:-}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Test filterSource on the result of a derivation.
|
||||
outPath2=$(nix-build ./import-from-derivation.nix -A addPath --no-out-link)
|
||||
[[ "$(cat "$outPath2")" = BLAFOO579 ]]
|
||||
|
||||
# Test that IFD works with a chroot store.
|
||||
if canUseSandbox; then
|
||||
|
||||
store2="$TEST_ROOT/store2"
|
||||
store2_url="$store2?store=$NIX_STORE_DIR"
|
||||
|
||||
# Copy the derivation outputs to the chroot store to avoid having
|
||||
# to actually build anything, as that would fail due to the lack
|
||||
# of a shell in the sandbox. We only care about testing the IFD
|
||||
# semantics.
|
||||
for i in bar result addPath; do
|
||||
nix copy --to "$store2_url" --no-check-sigs "$(nix-build ./import-from-derivation.nix -A "$i" --no-out-link)"
|
||||
done
|
||||
|
||||
clearStore
|
||||
|
||||
outPath_check=$(nix-build ./import-from-derivation.nix -A result --no-out-link --store "$store2_url")
|
||||
[[ "$outPath" = "$outPath_check" ]]
|
||||
[[ ! -e "$outPath" ]]
|
||||
[[ -e "$store2/nix/store/$(basename "$outPath")" ]]
|
||||
|
||||
outPath2_check=$(nix-build ./import-from-derivation.nix -A addPath --no-out-link --store "$store2_url")
|
||||
[[ "$outPath2" = "$outPath2_check" ]]
|
||||
fi
|
||||
@@ -88,7 +88,7 @@ nix_tests = \
|
||||
why-depends.sh \
|
||||
derivation-json.sh \
|
||||
derivation-advanced-attributes.sh \
|
||||
import-derivation.sh \
|
||||
import-from-derivation.sh \
|
||||
nix_path.sh \
|
||||
nars.sh \
|
||||
placeholders.sh \
|
||||
|
||||
@@ -157,7 +157,7 @@ suites = [
|
||||
'why-depends.sh',
|
||||
'derivation-json.sh',
|
||||
'derivation-advanced-attributes.sh',
|
||||
'import-derivation.sh',
|
||||
'import-from-derivation.sh',
|
||||
'nix_path.sh',
|
||||
'nars.sh',
|
||||
'placeholders.sh',
|
||||
|
||||
@@ -31,11 +31,13 @@ env > $TEST_ROOT/expected-env
|
||||
nix shell -f shell-hello.nix hello -c env > $TEST_ROOT/actual-env
|
||||
# Remove/reset variables we expect to be different.
|
||||
# - PATH is modified by nix shell
|
||||
# - we unset TMPDIR on macOS if it contains /var/folders
|
||||
# - _ is set by bash and is expectedf to differ because it contains the original command
|
||||
# - __CF_USER_TEXT_ENCODING is set by macOS and is beyond our control
|
||||
sed -i \
|
||||
-e 's/PATH=.*/PATH=.../' \
|
||||
-e 's/_=.*/_=.../' \
|
||||
-e '/^TMPDIR=\/var\/folders\/.*/d' \
|
||||
-e '/^__CF_USER_TEXT_ENCODING=.*$/d' \
|
||||
$TEST_ROOT/expected-env $TEST_ROOT/actual-env
|
||||
sort $TEST_ROOT/expected-env > $TEST_ROOT/expected-env.sorted
|
||||
|
||||
@@ -217,16 +217,10 @@ let
|
||||
$ssh <<EOF
|
||||
set -ex
|
||||
|
||||
# enable nounset while loading the profile
|
||||
# this may or may not work on all distros, depending on the quality of their scripts
|
||||
set -u
|
||||
|
||||
# FIXME: get rid of this; ideally ssh should just work.
|
||||
source ~/.bash_profile || true
|
||||
source ~/.bash_login || true
|
||||
source ~/.profile || true
|
||||
set +u
|
||||
|
||||
source /etc/bashrc || true
|
||||
|
||||
nix-env --version
|
||||
|
||||
Reference in new issue
Block a user