1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 12:41:00 +01:00

Merged the Nix sources from the trunk from R9751 to R10133 for my State Nix project.

This commit is contained in:
Wouter den Breejen 2008-01-13 16:36:27 +00:00
parent 55b07d65b1
commit a34a198006
46 changed files with 1323 additions and 265 deletions

View file

@ -1 +0,0 @@
Hello World

View file

@ -1,7 +1,7 @@
source common.sh
try () {
echo -n "$2" > $TEST_ROOT/vector
printf "%s" "$2" > $TEST_ROOT/vector
hash=$($nixhash $EXTRA --flat --type "$1" $TEST_ROOT/vector)
if test "$hash" != "$3"; then
echo "hash $1, expected $3, got $hash"

View file

@ -79,6 +79,20 @@ sed "s|^$|PATH='$PATH'|" < $NIX_DATA_DIR/nix/corepkgs/nar/nar.sh > tmp
chmod +x tmp
mv tmp $NIX_DATA_DIR/nix/corepkgs/nar/nar.sh
# An uberhack for Mac OS X 10.5: download-using-manifests uses Perl,
# and Perl links against Darwin's libutil.dylib (in /usr/lib), but
# when running "make check", the libtool wrapper script around the Nix
# binaries sets DYLD_LIBRARY_PATH so that Perl finds Nix's (completely
# different) libutil --- so it barfs. So generate a shell wrapper
# around download-using-manifests that clears DYLD_LIBRARY_PATH.
mv $NIX_BIN_DIR/nix/download-using-manifests.pl $NIX_BIN_DIR/nix/download-using-manifests.pl.real
cat > $NIX_BIN_DIR/nix/download-using-manifests.pl <<EOF
#! $SHELL -e
export DYLD_LIBRARY_PATH=
exec $NIX_BIN_DIR/nix/download-using-manifests.pl.real "\$@"
EOF
chmod +x $NIX_BIN_DIR/nix/download-using-manifests.pl
# Initialise the database.
$nixstore --init

View file

@ -0,0 +1 @@
Str("foo eval-okay-context.nix bar",[])

View file

@ -0,0 +1,6 @@
let s = "foo ${builtins.substring 33 100 (baseNameOf ./eval-okay-context.nix)} bar";
in
if s == "foo eval-okay-context.nix bar"
then abort "context not discarded"
else builtins.unsafeDiscardStringContext s

View file

@ -0,0 +1 @@
Str("This is an indented multi-line string\nliteral. An amount of whitespace at\nthe start of each line matching the minimum\nindentation of all lines in the string\nliteral together will be removed. Thus,\nin this case four spaces will be\nstripped from each line, even though\n THIS LINE is indented six spaces.\n\nAlso, empty lines don't count in the\ndetermination of the indentation level (the\nprevious empty line has indentation 0, but\nit doesn't matter).\nIf the string starts with whitespace\n followed by a newline, it's stripped, but\n that's not the case here. Two spaces are\n stripped because of the \" \" at the start. \nThis line is indented\na bit further.\nAnti-quotations, like so, are\nalso allowed.\n The \\ is not special here.\n' can be followed by any character except another ', e.g. 'x'.\nLikewise for $, e.g. $$ or $varName.\nBut ' followed by ' is special, as is $ followed by {.\nIf you want them, use anti-quotations: '', ${.\n Tabs are not interpreted as whitespace (since we can't guess\n what tab settings are intended), so don't use them.\n\tThis line starts with a space and a tab, so only one\n space will be stripped from each line.\nAlso note that if the last line (just before the closing ' ')\nconsists only of whitespace, it's ignored. But here there is\nsome non-whitespace stuff, so the line isn't removed. \nThis shows a hacky way to preserve an empty line after the start.\nBut there's no reason to do so: you could just repeat the empty\nline.\n Similarly you can force an indentation level,\n in this case to 2 spaces. This works because the anti-quote\n is significant (not whitespace).\nstart on network-interfaces\n\nstart script\n\n rm -f /var/run/opengl-driver\n ln -sf 123 /var/run/opengl-driver\n\n rm -f /var/log/slim.log\n \nend script\n\nenv SLIM_CFGFILE=abc\nenv SLIM_THEMESDIR=def\nenv FONTCONFIG_FILE=/etc/fonts/fonts.conf \t\t\t\t# !!! cleanup\nenv XKB_BINDIR=foo/bin \t\t\t\t# Needed for the Xkb extension.\nenv LD_LIBRARY_PATH=libX11/lib:libXext/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)\n\nenv XORG_DRI_DRIVER_PATH=nvidiaDrivers/X11R6/lib/modules/drivers/ \n\nexec slim/bin/slim\nEscaping of ' followed by ': ''\nEscaping of $ followed by {: ${\nAnd finally to interpret \\n etc. as in a string: \n, \r, \t.\n",[])

View file

@ -0,0 +1,113 @@
let
s1 = ''
This is an indented multi-line string
literal. An amount of whitespace at
the start of each line matching the minimum
indentation of all lines in the string
literal together will be removed. Thus,
in this case four spaces will be
stripped from each line, even though
THIS LINE is indented six spaces.
Also, empty lines don't count in the
determination of the indentation level (the
previous empty line has indentation 0, but
it doesn't matter).
'';
s2 = '' If the string starts with whitespace
followed by a newline, it's stripped, but
that's not the case here. Two spaces are
stripped because of the " " at the start.
'';
s3 = ''
This line is indented
a bit further.
''; # indentation of last line doesn't count if it's empty
s4 = ''
Anti-quotations, like ${if true then "so" else "not so"}, are
also allowed.
'';
s5 = ''
The \ is not special here.
' can be followed by any character except another ', e.g. 'x'.
Likewise for $, e.g. $$ or $varName.
But ' followed by ' is special, as is $ followed by {.
If you want them, use anti-quotations: ${"''"}, ${"\${"}.
'';
s6 = ''
Tabs are not interpreted as whitespace (since we can't guess
what tab settings are intended), so don't use them.
This line starts with a space and a tab, so only one
space will be stripped from each line.
'';
s7 = ''
Also note that if the last line (just before the closing ' ')
consists only of whitespace, it's ignored. But here there is
some non-whitespace stuff, so the line isn't removed. '';
s8 = '' ${""}
This shows a hacky way to preserve an empty line after the start.
But there's no reason to do so: you could just repeat the empty
line.
'';
s9 = ''
${""} Similarly you can force an indentation level,
in this case to 2 spaces. This works because the anti-quote
is significant (not whitespace).
'';
s10 = ''
'';
s11 = '''';
s12 = '' '';
s13 = ''
start on network-interfaces
start script
rm -f /var/run/opengl-driver
${if true
then "ln -sf 123 /var/run/opengl-driver"
else if true
then "ln -sf 456 /var/run/opengl-driver"
else ""
}
rm -f /var/log/slim.log
end script
env SLIM_CFGFILE=${"abc"}
env SLIM_THEMESDIR=${"def"}
env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup
env XKB_BINDIR=${"foo"}/bin # Needed for the Xkb extension.
env LD_LIBRARY_PATH=${"libX11"}/lib:${"libXext"}/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)
${if true
then "env XORG_DRI_DRIVER_PATH=${"nvidiaDrivers"}/X11R6/lib/modules/drivers/"
else if true
then "env XORG_DRI_DRIVER_PATH=${"mesa"}/lib/modules/dri"
else ""
}
exec ${"slim"}/bin/slim
'';
s14 = ''
Escaping of ' followed by ': '''
Escaping of $ followed by {: ''${
And finally to interpret \n etc. as in a string: ''\n, ''\r, ''\t.
'';
in s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12 + s13 + s14

View file

@ -0,0 +1 @@
Str("builtins.readFile ./eval-okay-readfile.nix\n",[])

View file

@ -0,0 +1 @@
builtins.readFile ./eval-okay-readfile.nix

View file

@ -18,6 +18,9 @@ if test "$text" != "Hello World!"; then exit 1; fi
$nixstore --delete $outPath
if test -e $outPath/hello; then false; fi
if test "$(NIX_STORE_DIR=/foo $nixinstantiate --readonly-mode hash-check.nix)" != "/foo/bbfambd3ksry4ylik1772pn2qyw1k296-dependencies.drv"; then
echo "hashDerivationModulo appears broken"
echo 'Hello World' > ./dummy
outPath="$(NIX_STORE_DIR=/foo $nixinstantiate --readonly-mode hash-check.nix)"
if test "$outPath" != "/foo/lfy1s6ca46rm5r6w4gg9hc0axiakjcnm-dependencies.drv"; then
echo "hashDerivationModulo appears broken, got $outPath"
exit 1
fi

View file

@ -2,6 +2,8 @@ source common.sh
clearProfiles
set -x
# Query installed: should be empty.
test "$($nixenv -p $profiles/test -q '*' | wc -l)" -eq 0
@ -71,6 +73,15 @@ echo $outPath10
$nixenv -p $profiles/test -i "$outPath10"
$nixenv -p $profiles/test -q '*' | grep -q foo-1.0
# Uninstall foo-1.0, using a symlink to its store path.
ln -sfn $outPath10/bin/foo $TEST_ROOT/symlink
$nixenv -p $profiles/test -e $TEST_ROOT/symlink
if $nixenv -p $profiles/test -q '*' | grep -q foo; then false; fi
# Install foo-1.0, now using a symlink to its store path.
$nixenv -p $profiles/test -i $TEST_ROOT/symlink
$nixenv -p $profiles/test -q '*' | grep -q foo
# Delete all old generations.
$nixenv -p $profiles/test --delete-generations old