mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 15:26:17 +02:00
Merge remote-tracking branch 'upstream/master' into support-hardlinks-in-tarballs
This commit is contained in:
commit
86420753ec
583 changed files with 11313 additions and 16547 deletions
|
@ -4,20 +4,20 @@
|
||||||
# Top-most EditorConfig file
|
# Top-most EditorConfig file
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
# Unix-style newlines with a newline ending every file, utf-8 charset
|
# Unix-style newlines with a newline ending every file, UTF-8 charset
|
||||||
[*]
|
[*]
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
|
|
||||||
# Match nix files, set indent to spaces with width of two
|
# Match Nix files, set indent to spaces with width of two
|
||||||
[*.nix]
|
[*.nix]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
# Match c++/shell/perl, set indent to spaces with width of four
|
# Match C++/C/shell/Perl, set indent to spaces with width of four
|
||||||
[*.{hpp,cc,hh,sh,pl,xs}]
|
[*.{hpp,cc,hh,c,h,sh,pl,xs}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
|
|
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -23,4 +23,4 @@ maintainers/*.md @fricklerhandwerk
|
||||||
src/**/*.md @fricklerhandwerk
|
src/**/*.md @fricklerhandwerk
|
||||||
|
|
||||||
# Libstore layer
|
# Libstore layer
|
||||||
/src/libstore @thufschmitt @ericson2314
|
/src/libstore @ericson2314
|
||||||
|
|
34
.github/workflows/ci.yml
vendored
34
.github/workflows/ci.yml
vendored
|
@ -31,6 +31,23 @@ jobs:
|
||||||
name: '${{ env.CACHIX_NAME }}'
|
name: '${{ env.CACHIX_NAME }}'
|
||||||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
- if: matrix.os == 'ubuntu-latest'
|
||||||
|
run: |
|
||||||
|
free -h
|
||||||
|
swapon --show
|
||||||
|
swap=$(swapon --show --noheadings | head -n 1 | awk '{print $1}')
|
||||||
|
echo "Found swap: $swap"
|
||||||
|
sudo swapoff $swap
|
||||||
|
# resize it (fallocate)
|
||||||
|
sudo fallocate -l 10G $swap
|
||||||
|
sudo mkswap $swap
|
||||||
|
sudo swapon $swap
|
||||||
|
free -h
|
||||||
|
(
|
||||||
|
while sleep 60; do
|
||||||
|
free -h
|
||||||
|
done
|
||||||
|
) &
|
||||||
- run: nix --experimental-features 'nix-command flakes' flake check -L
|
- run: nix --experimental-features 'nix-command flakes' flake check -L
|
||||||
|
|
||||||
# Steps to test CI automation in your own fork.
|
# Steps to test CI automation in your own fork.
|
||||||
|
@ -79,6 +96,7 @@ jobs:
|
||||||
name: '${{ env.CACHIX_NAME }}'
|
name: '${{ env.CACHIX_NAME }}'
|
||||||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
cachixArgs: '-v'
|
||||||
- id: prepare-installer
|
- id: prepare-installer
|
||||||
run: scripts/prepare-installer-for-github-actions
|
run: scripts/prepare-installer-for-github-actions
|
||||||
|
|
||||||
|
@ -175,4 +193,18 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: DeterminateSystems/nix-installer-action@main
|
- uses: DeterminateSystems/nix-installer-action@main
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
- run: nix build -L .#hydraJobs.tests.githubFlakes .#hydraJobs.tests.tarballFlakes
|
- run: nix build -L .#hydraJobs.tests.githubFlakes .#hydraJobs.tests.tarballFlakes .#hydraJobs.tests.functional_user
|
||||||
|
|
||||||
|
meson_build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
# Only meson packages that don't have a tests.run derivation.
|
||||||
|
# Those that have it are already built and tested as part of nix flake check.
|
||||||
|
- run: nix build -L .#hydraJobs.build.{nix-cmd,nix-main}.$(nix-instantiate --eval --expr builtins.currentSystem | sed -e 's/"//g')
|
||||||
|
|
20
.github/workflows/hydra_status.yml
vendored
20
.github/workflows/hydra_status.yml
vendored
|
@ -1,20 +0,0 @@
|
||||||
name: Hydra status
|
|
||||||
|
|
||||||
permissions: read-all
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "12,42 * * * *"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check_hydra_status:
|
|
||||||
name: Check Hydra status
|
|
||||||
if: github.repository_owner == 'NixOS'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- run: bash scripts/check-hydra-status.sh
|
|
||||||
|
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -11,6 +11,8 @@ perl/Makefile.config
|
||||||
/svn-revision
|
/svn-revision
|
||||||
/libtool
|
/libtool
|
||||||
/config/config.*
|
/config/config.*
|
||||||
|
# Default meson build dir
|
||||||
|
/build
|
||||||
|
|
||||||
# /doc/manual/
|
# /doc/manual/
|
||||||
/doc/manual/*.1
|
/doc/manual/*.1
|
||||||
|
@ -52,6 +54,9 @@ perl/Makefile.config
|
||||||
# /src/libfetchers
|
# /src/libfetchers
|
||||||
/tests/unit/libfetchers/libnixfetchers-tests
|
/tests/unit/libfetchers/libnixfetchers-tests
|
||||||
|
|
||||||
|
# /src/libflake
|
||||||
|
/tests/unit/libflake/libnixflake-tests
|
||||||
|
|
||||||
# /src/libstore/
|
# /src/libstore/
|
||||||
*.gen.*
|
*.gen.*
|
||||||
/src/libstore/tests
|
/src/libstore/tests
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
external-sources=true
|
external-sources=true
|
||||||
source-path=SCRIPTDIR
|
source-path=SCRIPTDIR
|
||||||
|
# Hack for scripts in e.g. tests/functional/ca
|
||||||
|
source-path=SCRIPTDIR/..
|
||||||
|
|
2
.version
2
.version
|
@ -1 +1 @@
|
||||||
2.23.0
|
2.24.0
|
||||||
|
|
28
Makefile
28
Makefile
|
@ -18,6 +18,7 @@ makefiles = \
|
||||||
src/libfetchers/local.mk \
|
src/libfetchers/local.mk \
|
||||||
src/libmain/local.mk \
|
src/libmain/local.mk \
|
||||||
src/libexpr/local.mk \
|
src/libexpr/local.mk \
|
||||||
|
src/libflake/local.mk \
|
||||||
src/libcmd/local.mk \
|
src/libcmd/local.mk \
|
||||||
src/nix/local.mk \
|
src/nix/local.mk \
|
||||||
src/libutil-c/local.mk \
|
src/libutil-c/local.mk \
|
||||||
|
@ -45,7 +46,8 @@ makefiles += \
|
||||||
tests/unit/libstore-support/local.mk \
|
tests/unit/libstore-support/local.mk \
|
||||||
tests/unit/libfetchers/local.mk \
|
tests/unit/libfetchers/local.mk \
|
||||||
tests/unit/libexpr/local.mk \
|
tests/unit/libexpr/local.mk \
|
||||||
tests/unit/libexpr-support/local.mk
|
tests/unit/libexpr-support/local.mk \
|
||||||
|
tests/unit/libflake/local.mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ENABLE_FUNCTIONAL_TESTS), yes)
|
ifeq ($(ENABLE_FUNCTIONAL_TESTS), yes)
|
||||||
|
@ -68,14 +70,6 @@ ifeq ($(ENABLE_DOC_GEN), yes)
|
||||||
makefiles-late += doc/manual/local.mk
|
makefiles-late += doc/manual/local.mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ENABLE_INTERNAL_API_DOCS), yes)
|
|
||||||
makefiles-late += doc/internal-api/local.mk
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(ENABLE_EXTERNAL_API_DOCS), yes)
|
|
||||||
makefiles-late += doc/external-api/local.mk
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Miscellaneous global Flags
|
# Miscellaneous global Flags
|
||||||
|
|
||||||
OPTIMIZE = 1
|
OPTIMIZE = 1
|
||||||
|
@ -98,7 +92,7 @@ ifdef HOST_WINDOWS
|
||||||
GLOBAL_LDFLAGS += -Wl,--export-all-symbols
|
GLOBAL_LDFLAGS += -Wl,--export-all-symbols
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GLOBAL_CXXFLAGS += -g -Wall -Wdeprecated-copy -Wignored-qualifiers -Wimplicit-fallthrough -include $(buildprefix)config.h -std=c++2a -I src
|
GLOBAL_CXXFLAGS += -g -Wall -Wdeprecated-copy -Wignored-qualifiers -Wimplicit-fallthrough -Werror=unused-result -include $(buildprefix)config.h -std=c++2a -I src
|
||||||
|
|
||||||
# Include the main lib, causing rules to be defined
|
# Include the main lib, causing rules to be defined
|
||||||
|
|
||||||
|
@ -131,17 +125,3 @@ manual-html manpages:
|
||||||
@echo "Generated docs are disabled. Configure without '--disable-doc-gen', or avoid calling 'make manpages' and 'make manual-html'."
|
@echo "Generated docs are disabled. Configure without '--disable-doc-gen', or avoid calling 'make manpages' and 'make manual-html'."
|
||||||
@exit 1
|
@exit 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(ENABLE_INTERNAL_API_DOCS), yes)
|
|
||||||
.PHONY: internal-api-html
|
|
||||||
internal-api-html:
|
|
||||||
@echo "Internal API docs are disabled. Configure with '--enable-internal-api-docs', or avoid calling 'make internal-api-html'."
|
|
||||||
@exit 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(ENABLE_EXTERNAL_API_DOCS), yes)
|
|
||||||
.PHONY: external-api-html
|
|
||||||
external-api-html:
|
|
||||||
@echo "External API docs are disabled. Configure with '--enable-external-api-docs', or avoid calling 'make external-api-html'."
|
|
||||||
@exit 1
|
|
||||||
endif
|
|
||||||
|
|
|
@ -11,8 +11,6 @@ EDITLINE_LIBS = @EDITLINE_LIBS@
|
||||||
ENABLE_BUILD = @ENABLE_BUILD@
|
ENABLE_BUILD = @ENABLE_BUILD@
|
||||||
ENABLE_DOC_GEN = @ENABLE_DOC_GEN@
|
ENABLE_DOC_GEN = @ENABLE_DOC_GEN@
|
||||||
ENABLE_FUNCTIONAL_TESTS = @ENABLE_FUNCTIONAL_TESTS@
|
ENABLE_FUNCTIONAL_TESTS = @ENABLE_FUNCTIONAL_TESTS@
|
||||||
ENABLE_INTERNAL_API_DOCS = @ENABLE_INTERNAL_API_DOCS@
|
|
||||||
ENABLE_EXTERNAL_API_DOCS = @ENABLE_EXTERNAL_API_DOCS@
|
|
||||||
ENABLE_S3 = @ENABLE_S3@
|
ENABLE_S3 = @ENABLE_S3@
|
||||||
ENABLE_UNIT_TESTS = @ENABLE_UNIT_TESTS@
|
ENABLE_UNIT_TESTS = @ENABLE_UNIT_TESTS@
|
||||||
GTEST_LIBS = @GTEST_LIBS@
|
GTEST_LIBS = @GTEST_LIBS@
|
||||||
|
|
17
README.md
17
README.md
|
@ -13,7 +13,7 @@ Visit [nix.dev](https://nix.dev) for [installation instructions](https://nix.dev
|
||||||
|
|
||||||
Full reference documentation can be found in the [Nix manual](https://nixos.org/nix/manual).
|
Full reference documentation can be found in the [Nix manual](https://nixos.org/nix/manual).
|
||||||
|
|
||||||
## Building And Developing
|
## Building and developing
|
||||||
|
|
||||||
See our [Hacking guide](https://nixos.org/manual/nix/unstable/contributing/hacking.html) in our manual for instruction on how to
|
See our [Hacking guide](https://nixos.org/manual/nix/unstable/contributing/hacking.html) in our manual for instruction on how to
|
||||||
set up a development environment and build Nix from source.
|
set up a development environment and build Nix from source.
|
||||||
|
@ -22,12 +22,17 @@ See our [Hacking guide](https://nixos.org/manual/nix/unstable/contributing/hacki
|
||||||
|
|
||||||
Check the [contributing guide](./CONTRIBUTING.md) if you want to get involved with developing Nix.
|
Check the [contributing guide](./CONTRIBUTING.md) if you want to get involved with developing Nix.
|
||||||
|
|
||||||
## Additional Resources
|
## Additional resources
|
||||||
|
|
||||||
- [Nix manual](https://nixos.org/nix/manual)
|
Nix was created by Eelco Dolstra and developed as the subject of his PhD thesis [The Purely Functional Software Deployment Model](https://edolstra.github.io/pubs/phd-thesis.pdf), published 2006.
|
||||||
- [Nix jobsets on hydra.nixos.org](https://hydra.nixos.org/project/nix)
|
Today, a world-wide developer community contributes to Nix and the ecosystem that has grown around it.
|
||||||
- [NixOS Discourse](https://discourse.nixos.org/)
|
|
||||||
- [Matrix - #nix:nixos.org](https://matrix.to/#/#nix:nixos.org)
|
- [The Nix, Nixpkgs, NixOS Community on nixos.org](https://nixos.org/)
|
||||||
|
- [Official documentation on nix.dev](https://nix.dev)
|
||||||
|
- [Nixpkgs](https://github.com/NixOS/nixpkgs) is [the largest, most up-to-date free software repository in the world](https://repology.org/repositories/graphs)
|
||||||
|
- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos) is a Linux distribution that can be configured fully declaratively
|
||||||
|
- [Discourse](https://discourse.nixos.org/)
|
||||||
|
- [Matrix](https://matrix.to/#/#nix:nixos.org)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
36
build-utils-meson/deps-lists/meson.build
Normal file
36
build-utils-meson/deps-lists/meson.build
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# These are private dependencies with pkg-config files. What private
|
||||||
|
# means is that the dependencies are used by the library but they are
|
||||||
|
# *not* used (e.g. `#include`-ed) in any installed header file, and only
|
||||||
|
# in regular source code (`*.cc`) or private, uninstalled headers. They
|
||||||
|
# are thus part of the *implementation* of the library, but not its
|
||||||
|
# *interface*.
|
||||||
|
#
|
||||||
|
# See `man pkg-config` for some details.
|
||||||
|
deps_private = [ ]
|
||||||
|
|
||||||
|
# These are public dependencies with pkg-config files. Public is the
|
||||||
|
# opposite of private: these dependencies are used in installed header
|
||||||
|
# files. They are part of the interface (and implementation) of the
|
||||||
|
# library.
|
||||||
|
#
|
||||||
|
# N.B. This concept is mostly unrelated to our own concept of a public
|
||||||
|
# (stable) API, for consumption outside of the Nix repository.
|
||||||
|
# `libnixutil` is an unstable C++ library, whose public interface is
|
||||||
|
# likewise unstable. `libutilc` conversely is a hopefully-soon stable
|
||||||
|
# C library, whose public interface --- including public but not private
|
||||||
|
# dependencies --- will also likewise soon be stable.
|
||||||
|
#
|
||||||
|
# N.B. For distributions that care about "ABI" stability and not just
|
||||||
|
# "API" stability, the private dependencies also matter as they can
|
||||||
|
# potentially affect the public ABI.
|
||||||
|
deps_public = [ ]
|
||||||
|
|
||||||
|
# These are subproject deps (type == "internal"). They are other
|
||||||
|
# packages in `/src` in this repo. The private vs public distinction is
|
||||||
|
# the same as above.
|
||||||
|
deps_private_subproject = [ ]
|
||||||
|
deps_public_subproject = [ ]
|
||||||
|
|
||||||
|
# These are dependencencies without pkg-config files. Ideally they are
|
||||||
|
# just private, but they may also be public (e.g. boost).
|
||||||
|
deps_other = [ ]
|
13
build-utils-meson/diagnostics/meson.build
Normal file
13
build-utils-meson/diagnostics/meson.build
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
add_project_arguments(
|
||||||
|
'-Wno-deprecated-declarations',
|
||||||
|
'-Wimplicit-fallthrough',
|
||||||
|
'-Werror=switch',
|
||||||
|
'-Werror=switch-enum',
|
||||||
|
'-Werror=unused-result',
|
||||||
|
'-Wdeprecated-copy',
|
||||||
|
'-Wignored-qualifiers',
|
||||||
|
# Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked
|
||||||
|
# at ~1% overhead in `nix search`.
|
||||||
|
#
|
||||||
|
language : 'cpp',
|
||||||
|
)
|
11
build-utils-meson/export-all-symbols/meson.build
Normal file
11
build-utils-meson/export-all-symbols/meson.build
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
|
||||||
|
# Windows DLLs are stricter about symbol visibility than Unix shared
|
||||||
|
# objects --- see https://gcc.gnu.org/wiki/Visibility for details.
|
||||||
|
# This is a temporary sledgehammer to export everything like on Unix,
|
||||||
|
# and not detail with this yet.
|
||||||
|
#
|
||||||
|
# TODO do not do this, and instead do fine-grained export annotations.
|
||||||
|
linker_export_flags = ['-Wl,--export-all-symbols']
|
||||||
|
else
|
||||||
|
linker_export_flags = []
|
||||||
|
endif
|
30
build-utils-meson/export/meson.build
Normal file
30
build-utils-meson/export/meson.build
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
requires_private = []
|
||||||
|
foreach dep : deps_private_subproject
|
||||||
|
requires_private += dep.name()
|
||||||
|
endforeach
|
||||||
|
requires_private += deps_private
|
||||||
|
|
||||||
|
requires_public = []
|
||||||
|
foreach dep : deps_public_subproject
|
||||||
|
requires_public += dep.name()
|
||||||
|
endforeach
|
||||||
|
requires_public += deps_public
|
||||||
|
|
||||||
|
import('pkgconfig').generate(
|
||||||
|
this_library,
|
||||||
|
filebase : meson.project_name(),
|
||||||
|
name : 'Nix',
|
||||||
|
description : 'Nix Package Manager',
|
||||||
|
subdirs : ['nix'],
|
||||||
|
extra_cflags : ['-std=c++2a'],
|
||||||
|
requires : requires_public,
|
||||||
|
requires_private : requires_private,
|
||||||
|
libraries_private : libraries_private,
|
||||||
|
)
|
||||||
|
|
||||||
|
meson.override_dependency(meson.project_name(), declare_dependency(
|
||||||
|
include_directories : include_dirs,
|
||||||
|
link_with : this_library,
|
||||||
|
compile_args : ['-std=c++2a'],
|
||||||
|
dependencies : deps_public_subproject + deps_public,
|
||||||
|
))
|
7
build-utils-meson/generate-header/meson.build
Normal file
7
build-utils-meson/generate-header/meson.build
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
bash = find_program('bash', native: true)
|
||||||
|
|
||||||
|
gen_header = generator(
|
||||||
|
bash,
|
||||||
|
arguments : [ '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ],
|
||||||
|
output : '@PLAINNAME@.gen.hh',
|
||||||
|
)
|
19
build-utils-meson/subprojects/meson.build
Normal file
19
build-utils-meson/subprojects/meson.build
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
foreach maybe_subproject_dep : deps_private_maybe_subproject
|
||||||
|
if maybe_subproject_dep.type_name() == 'internal'
|
||||||
|
deps_private_subproject += maybe_subproject_dep
|
||||||
|
# subproject sadly no good for pkg-config module
|
||||||
|
deps_other += maybe_subproject_dep
|
||||||
|
else
|
||||||
|
deps_private += maybe_subproject_dep
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
foreach maybe_subproject_dep : deps_public_maybe_subproject
|
||||||
|
if maybe_subproject_dep.type_name() == 'internal'
|
||||||
|
deps_public_subproject += maybe_subproject_dep
|
||||||
|
# subproject sadly no good for pkg-config module
|
||||||
|
deps_other += maybe_subproject_dep
|
||||||
|
else
|
||||||
|
deps_public += maybe_subproject_dep
|
||||||
|
endif
|
||||||
|
endforeach
|
6
build-utils-meson/threads/meson.build
Normal file
6
build-utils-meson/threads/meson.build
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# This is only conditional to work around
|
||||||
|
# https://github.com/mesonbuild/meson/issues/13293. It should be
|
||||||
|
# unconditional.
|
||||||
|
if not (host_machine.system() == 'windows' and cxx.get_id() == 'gcc')
|
||||||
|
deps_private += dependency('threads')
|
||||||
|
endif
|
27
configure.ac
27
configure.ac
|
@ -149,11 +149,6 @@ AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--disable-unit-tests],[Do not build th
|
||||||
ENABLE_UNIT_TESTS=$enableval, ENABLE_UNIT_TESTS=$ENABLE_BUILD)
|
ENABLE_UNIT_TESTS=$enableval, ENABLE_UNIT_TESTS=$ENABLE_BUILD)
|
||||||
AC_SUBST(ENABLE_UNIT_TESTS)
|
AC_SUBST(ENABLE_UNIT_TESTS)
|
||||||
|
|
||||||
# Build external API docs by default
|
|
||||||
AC_ARG_ENABLE(external_api_docs, AS_HELP_STRING([--enable-external-api-docs],[Build API docs for Nix's C interface]),
|
|
||||||
external_api_docs=$enableval, external_api_docs=yes)
|
|
||||||
AC_SUBST(external_api_docs)
|
|
||||||
|
|
||||||
AS_IF(
|
AS_IF(
|
||||||
[test "$ENABLE_BUILD" == "no" && test "$ENABLE_UNIT_TESTS" == "yes"],
|
[test "$ENABLE_BUILD" == "no" && test "$ENABLE_UNIT_TESTS" == "yes"],
|
||||||
[AC_MSG_ERROR([Cannot enable unit tests when building overall is disabled. Please do not pass '--enable-unit-tests' or do not pass '--disable-build'.])])
|
[AC_MSG_ERROR([Cannot enable unit tests when building overall is disabled. Please do not pass '--enable-unit-tests' or do not pass '--disable-build'.])])
|
||||||
|
@ -171,15 +166,6 @@ AS_IF(
|
||||||
[test "$ENABLE_BUILD" == "no" && test "$ENABLE_DOC_GEN" == "yes"],
|
[test "$ENABLE_BUILD" == "no" && test "$ENABLE_DOC_GEN" == "yes"],
|
||||||
[AC_MSG_ERROR([Cannot enable generated docs when building overall is disabled. Please do not pass '--enable-doc-gen' or do not pass '--disable-build'.])])
|
[AC_MSG_ERROR([Cannot enable generated docs when building overall is disabled. Please do not pass '--enable-doc-gen' or do not pass '--disable-build'.])])
|
||||||
|
|
||||||
# Building without API docs is the default as Nix' C++ interfaces are internal and unstable.
|
|
||||||
AC_ARG_ENABLE(internal-api-docs, AS_HELP_STRING([--enable-internal-api-docs],[Build API docs for Nix's internal unstable C++ interfaces]),
|
|
||||||
ENABLE_INTERNAL_API_DOCS=$enableval, ENABLE_INTERNAL_API_DOCS=no)
|
|
||||||
AC_SUBST(ENABLE_INTERNAL_API_DOCS)
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(external-api-docs, AS_HELP_STRING([--enable-external-api-docs],[Build API docs for Nix's external unstable C interfaces]),
|
|
||||||
ENABLE_EXTERNAL_API_DOCS=$enableval, ENABLE_EXTERNAL_API_DOCS=no)
|
|
||||||
AC_SUBST(ENABLE_EXTERNAL_API_DOCS)
|
|
||||||
|
|
||||||
AS_IF(
|
AS_IF(
|
||||||
[test "$ENABLE_FUNCTIONAL_TESTS" == "yes" || test "$ENABLE_DOC_GEN" == "yes"],
|
[test "$ENABLE_FUNCTIONAL_TESTS" == "yes" || test "$ENABLE_DOC_GEN" == "yes"],
|
||||||
[NEED_PROG(jq, jq)])
|
[NEED_PROG(jq, jq)])
|
||||||
|
@ -369,6 +355,14 @@ if test "$gc" = yes; then
|
||||||
PKG_CHECK_MODULES([BDW_GC], [bdw-gc])
|
PKG_CHECK_MODULES([BDW_GC], [bdw-gc])
|
||||||
CXXFLAGS="$BDW_GC_CFLAGS $CXXFLAGS"
|
CXXFLAGS="$BDW_GC_CFLAGS $CXXFLAGS"
|
||||||
AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
|
AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
|
||||||
|
|
||||||
|
# See `fixupBoehmStackPointer`, for the integration between Boehm GC
|
||||||
|
# and Boost coroutines.
|
||||||
|
old_CFLAGS="$CFLAGS"
|
||||||
|
# Temporary set `-pthread` just for the next check
|
||||||
|
CFLAGS="$CFLAGS -pthread"
|
||||||
|
AC_CHECK_FUNCS([pthread_attr_get_np pthread_getattr_np])
|
||||||
|
CFLAGS="$old_CFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AS_IF([test "$ENABLE_UNIT_TESTS" == "yes"],[
|
AS_IF([test "$ENABLE_UNIT_TESTS" == "yes"],[
|
||||||
|
@ -406,6 +400,11 @@ AS_CASE(["$enable_markdown"],
|
||||||
PKG_CHECK_MODULES([LIBGIT2], [libgit2])
|
PKG_CHECK_MODULES([LIBGIT2], [libgit2])
|
||||||
|
|
||||||
|
|
||||||
|
# Look for toml11, a required dependency.
|
||||||
|
AC_LANG_PUSH(C++)
|
||||||
|
AC_CHECK_HEADER([toml.hpp], [], [AC_MSG_ERROR([toml11 is not found.])])
|
||||||
|
AC_LANG_POP(C++)
|
||||||
|
|
||||||
# Setuid installations.
|
# Setuid installations.
|
||||||
AC_CHECK_FUNCS([setresuid setreuid lchown])
|
AC_CHECK_FUNCS([setresuid setreuid lchown])
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
diff --git a/include/gc_allocator.h b/include/gc_allocator.h
|
|
||||||
index 597c7f13..587286be 100644
|
|
||||||
--- a/include/gc_allocator.h
|
|
||||||
+++ b/include/gc_allocator.h
|
|
||||||
@@ -312,6 +312,7 @@ public:
|
|
||||||
|
|
||||||
template<>
|
|
||||||
class traceable_allocator<void> {
|
|
||||||
+public:
|
|
||||||
typedef size_t size_type;
|
|
||||||
typedef ptrdiff_t difference_type;
|
|
||||||
typedef void* pointer;
|
|
|
@ -1,7 +0,0 @@
|
||||||
$(docdir)/external-api/html/index.html $(docdir)/external-api/latex: $(d)/doxygen.cfg src/lib*-c/*.h
|
|
||||||
mkdir -p $(docdir)/external-api
|
|
||||||
{ cat $< ; echo "OUTPUT_DIRECTORY=$(docdir)/external-api" ; } | doxygen -
|
|
||||||
|
|
||||||
# Generate the HTML API docs for Nix's unstable C bindings
|
|
||||||
.PHONY: external-api-html
|
|
||||||
external-api-html: $(docdir)/external-api/html/index.html
|
|
|
@ -1,7 +0,0 @@
|
||||||
$(docdir)/internal-api/html/index.html $(docdir)/internal-api/latex: $(d)/doxygen.cfg src/**/*.hh
|
|
||||||
mkdir -p $(docdir)/internal-api
|
|
||||||
{ cat $< ; echo "OUTPUT_DIRECTORY=$(docdir)/internal-api" ; } | doxygen -
|
|
||||||
|
|
||||||
# Generate the HTML API docs for Nix's unstable internal interfaces.
|
|
||||||
.PHONY: internal-api-html
|
|
||||||
internal-api-html: $(docdir)/internal-api/html/index.html
|
|
|
@ -1,31 +0,0 @@
|
||||||
let
|
|
||||||
inherit (builtins) concatStringsSep attrValues mapAttrs;
|
|
||||||
inherit (import <nix/utils.nix>) optionalString squash;
|
|
||||||
in
|
|
||||||
|
|
||||||
builtinsInfo:
|
|
||||||
let
|
|
||||||
showBuiltin = name: { doc, type, impure-only }:
|
|
||||||
let
|
|
||||||
type' = optionalString (type != null) " (${type})";
|
|
||||||
|
|
||||||
impureNotice = optionalString impure-only ''
|
|
||||||
> **Note**
|
|
||||||
>
|
|
||||||
> Not available in [pure evaluation mode](@docroot@/command-ref/conf-file.md#conf-pure-eval).
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
squash ''
|
|
||||||
<dt id="builtins-${name}">
|
|
||||||
<a href="#builtins-${name}"><code>${name}</code></a>${type'}
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
|
|
||||||
${doc}
|
|
||||||
|
|
||||||
${impureNotice}
|
|
||||||
|
|
||||||
</dd>
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
concatStringsSep "\n" (attrValues (mapAttrs showBuiltin builtinsInfo))
|
|
|
@ -5,8 +5,10 @@ in
|
||||||
|
|
||||||
builtinsInfo:
|
builtinsInfo:
|
||||||
let
|
let
|
||||||
showBuiltin = name: { doc, args, arity, experimental-feature }:
|
showBuiltin = name: { doc, type ? null, args ? [ ], experimental-feature ? null, impure-only ? false }:
|
||||||
let
|
let
|
||||||
|
type' = optionalString (type != null) " (${type})";
|
||||||
|
|
||||||
experimentalNotice = optionalString (experimental-feature != null) ''
|
experimentalNotice = optionalString (experimental-feature != null) ''
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
|
@ -18,16 +20,24 @@ let
|
||||||
> extra-experimental-features = ${experimental-feature}
|
> extra-experimental-features = ${experimental-feature}
|
||||||
> ```
|
> ```
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
impureNotice = optionalString impure-only ''
|
||||||
|
> **Note**
|
||||||
|
>
|
||||||
|
> Not available in [pure evaluation mode](@docroot@/command-ref/conf-file.md#conf-pure-eval).
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
squash ''
|
squash ''
|
||||||
<dt id="builtins-${name}">
|
<dt id="builtins-${name}">
|
||||||
<a href="#builtins-${name}"><code>${name} ${listArgs args}</code></a>
|
<a href="#builtins-${name}"><code>${name}${listArgs args}</code></a>${type'}
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
|
|
||||||
${experimentalNotice}
|
${experimentalNotice}
|
||||||
|
|
||||||
${doc}
|
${doc}
|
||||||
|
|
||||||
|
${impureNotice}
|
||||||
</dd>
|
</dd>
|
||||||
'';
|
'';
|
||||||
listArgs = args: concatStringsSep "" (map (s: " <var>${s}</var>") args);
|
listArgs = args: concatStringsSep "" (map (s: " <var>${s}</var>") args);
|
||||||
|
|
|
@ -140,16 +140,10 @@ $(d)/xp-features.json: $(doc_nix)
|
||||||
|
|
||||||
$(d)/src/language/builtins.md: $(d)/language.json $(d)/generate-builtins.nix $(d)/src/language/builtins-prefix.md $(doc_nix)
|
$(d)/src/language/builtins.md: $(d)/language.json $(d)/generate-builtins.nix $(d)/src/language/builtins-prefix.md $(doc_nix)
|
||||||
@cat doc/manual/src/language/builtins-prefix.md > $@.tmp
|
@cat doc/manual/src/language/builtins-prefix.md > $@.tmp
|
||||||
$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtins.nix (builtins.fromJSON (builtins.readFile $<)).builtins' >> $@.tmp;
|
$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtins.nix (builtins.fromJSON (builtins.readFile $<))' >> $@.tmp;
|
||||||
@cat doc/manual/src/language/builtins-suffix.md >> $@.tmp
|
@cat doc/manual/src/language/builtins-suffix.md >> $@.tmp
|
||||||
@mv $@.tmp $@
|
@mv $@.tmp $@
|
||||||
|
|
||||||
$(d)/src/language/builtin-constants.md: $(d)/language.json $(d)/generate-builtin-constants.nix $(d)/src/language/builtin-constants-prefix.md $(doc_nix)
|
|
||||||
@cat doc/manual/src/language/builtin-constants-prefix.md > $@.tmp
|
|
||||||
$(trace-gen) $(nix-eval) --expr 'import doc/manual/generate-builtin-constants.nix (builtins.fromJSON (builtins.readFile $<)).constants' >> $@.tmp;
|
|
||||||
@cat doc/manual/src/language/builtin-constants-suffix.md >> $@.tmp
|
|
||||||
@mv $@.tmp $@
|
|
||||||
|
|
||||||
$(d)/language.json: $(doc_nix)
|
$(d)/language.json: $(doc_nix)
|
||||||
$(trace-gen) $(dummy-env) $(doc_nix) __dump-language > $@.tmp
|
$(trace-gen) $(dummy-env) $(doc_nix) __dump-language > $@.tmp
|
||||||
@mv $@.tmp $@
|
@mv $@.tmp $@
|
||||||
|
@ -217,7 +211,7 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
|
||||||
# `@docroot@` is to be preserved for documenting the mechanism
|
# `@docroot@` is to be preserved for documenting the mechanism
|
||||||
# FIXME: maybe contributing guides should live right next to the code
|
# FIXME: maybe contributing guides should live right next to the code
|
||||||
# instead of in the manual
|
# instead of in the manual
|
||||||
$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/anchors.jq $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/store/types $(d)/src/command-ref/new-cli $(d)/src/contributing/experimental-feature-descriptions.md $(d)/src/command-ref/conf-file.md $(d)/src/language/builtins.md $(d)/src/language/builtin-constants.md $(d)/src/release-notes/rl-next.md $(d)/src/figures $(d)/src/favicon.png $(d)/src/favicon.svg
|
$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/anchors.jq $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/store/types $(d)/src/command-ref/new-cli $(d)/src/contributing/experimental-feature-descriptions.md $(d)/src/command-ref/conf-file.md $(d)/src/language/builtins.md $(d)/src/release-notes/rl-next.md $(d)/src/figures $(d)/src/favicon.png $(d)/src/favicon.svg
|
||||||
$(trace-gen) \
|
$(trace-gen) \
|
||||||
tmp="$$(mktemp -d)"; \
|
tmp="$$(mktemp -d)"; \
|
||||||
cp -r doc/manual "$$tmp"; \
|
cp -r doc/manual "$$tmp"; \
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// redirect rules for URL fragments (client-side) to prevent link rot.
|
// redirect rules for URL fragments (client-side) to prevent link rot.
|
||||||
// this must be done on the client side, as web servers do not see the fragment part of the URL.
|
// this must be done on the client side, as web servers do not see the fragment part of the URL.
|
||||||
// it will only work with JavaScript enabled in the browser, but this is the best we can do here.
|
// it will only work with JavaScript enabled in the browser, but this is the best we can do here.
|
||||||
// see ./_redirects for path redirects (client-side)
|
// see src/_redirects for path redirects (server-side)
|
||||||
|
|
||||||
// redirects are declared as follows:
|
// redirects are declared as follows:
|
||||||
// each entry has as its key a path matching the requested URL path, relative to the mdBook document root.
|
// each entry has as its key a path matching the requested URL path, relative to the mdBook document root.
|
||||||
|
@ -238,12 +238,12 @@ const redirects = {
|
||||||
"attr-system": "language/derivations.html#attr-system",
|
"attr-system": "language/derivations.html#attr-system",
|
||||||
"ssec-derivation": "language/derivations.html",
|
"ssec-derivation": "language/derivations.html",
|
||||||
"ch-expression-language": "language/index.html",
|
"ch-expression-language": "language/index.html",
|
||||||
"sec-constructs": "language/constructs.html",
|
"sec-constructs": "language/syntax.html",
|
||||||
"sect-let-language": "language/constructs.html#let-language",
|
"sect-let-language": "language/syntax.html#let-expressions",
|
||||||
"ss-functions": "language/constructs.html#functions",
|
"ss-functions": "language/syntax.html#functions",
|
||||||
"sec-language-operators": "language/operators.html",
|
"sec-language-operators": "language/operators.html",
|
||||||
"table-operators": "language/operators.html",
|
"table-operators": "language/operators.html",
|
||||||
"ssec-values": "language/values.html",
|
"ssec-values": "language/types.html",
|
||||||
"gloss-closure": "glossary.html#gloss-closure",
|
"gloss-closure": "glossary.html#gloss-closure",
|
||||||
"gloss-derivation": "glossary.html#gloss-derivation",
|
"gloss-derivation": "glossary.html#gloss-derivation",
|
||||||
"gloss-deriver": "glossary.html#gloss-deriver",
|
"gloss-deriver": "glossary.html#gloss-deriver",
|
||||||
|
@ -335,11 +335,15 @@ const redirects = {
|
||||||
"ssec-relnotes-2.2": "release-notes/rl-2.2.html",
|
"ssec-relnotes-2.2": "release-notes/rl-2.2.html",
|
||||||
"ssec-relnotes-2.3": "release-notes/rl-2.3.html",
|
"ssec-relnotes-2.3": "release-notes/rl-2.3.html",
|
||||||
},
|
},
|
||||||
"language/values.html": {
|
"language/types.html": {
|
||||||
"simple-values": "#primitives",
|
"simple-values": "#primitives",
|
||||||
"lists": "#list",
|
"lists": "#list",
|
||||||
"strings": "#string",
|
"strings": "#string",
|
||||||
"attribute-sets": "#attribute-set",
|
"attribute-sets": "#attribute-set",
|
||||||
|
"type-number": "#type-int",
|
||||||
|
},
|
||||||
|
"language/syntax.html": {
|
||||||
|
"scoping-rules": "scoping.html",
|
||||||
},
|
},
|
||||||
"installation/installing-binary.html": {
|
"installation/installing-binary.html": {
|
||||||
"linux": "uninstall.html#linux",
|
"linux": "uninstall.html#linux",
|
||||||
|
|
6
doc/manual/rl-next/drop-vendored-toml11.md
Normal file
6
doc/manual/rl-next/drop-vendored-toml11.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
synopsis: Stop vendoring toml11
|
||||||
|
---
|
||||||
|
|
||||||
|
We don't apply any patches to it, and vendoring it locks users into
|
||||||
|
bugs (it hasn't been updated since its introduction in late 2021).
|
7
doc/manual/rl-next/harden-user-sandboxing.md
Normal file
7
doc/manual/rl-next/harden-user-sandboxing.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
synopsis: Harden the user sandboxing
|
||||||
|
significance: significant
|
||||||
|
issues:
|
||||||
|
---
|
||||||
|
|
||||||
|
The build directory has been hardened against interference with the outside world by nesting it inside another directory owned by (and only readable by) the daemon user.
|
28
doc/manual/rl-next/nix-shell-looks-for-shell-nix.md
Normal file
28
doc/manual/rl-next/nix-shell-looks-for-shell-nix.md
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
synopsis: "`nix-shell <directory>` looks for `shell.nix`"
|
||||||
|
significance: significant
|
||||||
|
issues:
|
||||||
|
- 496
|
||||||
|
- 2279
|
||||||
|
- 4529
|
||||||
|
- 5431
|
||||||
|
- 11053
|
||||||
|
prs:
|
||||||
|
- 11057
|
||||||
|
---
|
||||||
|
|
||||||
|
`nix-shell $x` now looks for `$x/shell.nix` when `$x` resolves to a directory.
|
||||||
|
|
||||||
|
Although this might be seen as a breaking change, its primarily interactive usage makes it a minor issue.
|
||||||
|
This adjustment addresses a commonly reported problem.
|
||||||
|
|
||||||
|
This also applies to `nix-shell` shebang scripts. Consider the following example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash
|
||||||
|
```
|
||||||
|
|
||||||
|
This will now load `shell.nix` from the script's directory, if it exists; `default.nix` otherwise.
|
||||||
|
|
||||||
|
The old behavior can be opted into by setting the option [`nix-shell-always-looks-for-shell-nix`](@docroot@/command-ref/conf-file.md#conf-nix-shell-always-looks-for-shell-nix) to `false`.
|
|
@ -25,17 +25,17 @@
|
||||||
- [Store Types](store/types/index.md)
|
- [Store Types](store/types/index.md)
|
||||||
{{#include ./store/types/SUMMARY.md}}
|
{{#include ./store/types/SUMMARY.md}}
|
||||||
- [Nix Language](language/index.md)
|
- [Nix Language](language/index.md)
|
||||||
- [Data Types](language/values.md)
|
- [Data Types](language/types.md)
|
||||||
- [Language Constructs](language/constructs.md)
|
- [String context](language/string-context.md)
|
||||||
|
- [Syntax and semantics](language/syntax.md)
|
||||||
|
- [Scoping rules](language/scope.md)
|
||||||
- [String interpolation](language/string-interpolation.md)
|
- [String interpolation](language/string-interpolation.md)
|
||||||
- [Lookup path](language/constructs/lookup-path.md)
|
- [Lookup path](language/constructs/lookup-path.md)
|
||||||
- [String context](language/string-context.md)
|
|
||||||
- [Operators](language/operators.md)
|
- [Operators](language/operators.md)
|
||||||
|
- [Built-ins](language/builtins.md)
|
||||||
- [Derivations](language/derivations.md)
|
- [Derivations](language/derivations.md)
|
||||||
- [Advanced Attributes](language/advanced-attributes.md)
|
- [Advanced Attributes](language/advanced-attributes.md)
|
||||||
- [Import From Derivation](language/import-from-derivation.md)
|
- [Import From Derivation](language/import-from-derivation.md)
|
||||||
- [Built-in Constants](language/builtin-constants.md)
|
|
||||||
- [Built-in Functions](language/builtins.md)
|
|
||||||
- [Package Management](package-management/index.md)
|
- [Package Management](package-management/index.md)
|
||||||
- [Profiles](package-management/profiles.md)
|
- [Profiles](package-management/profiles.md)
|
||||||
- [Garbage Collection](package-management/garbage-collection.md)
|
- [Garbage Collection](package-management/garbage-collection.md)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# redirect rules for paths (server-side) to prevent link rot.
|
# redirect rules for paths (server-side) to prevent link rot.
|
||||||
# see ./redirects.js for redirects based on URL fragments (client-side)
|
# see ../redirects.js for redirects based on URL fragments (client-side)
|
||||||
#
|
#
|
||||||
# concrete user story this supports:
|
# concrete user story this supports:
|
||||||
# - user finds URL to the manual for Nix x.y
|
# - user finds URL to the manual for Nix x.y
|
||||||
|
@ -27,6 +27,9 @@
|
||||||
/expressions/language-operators /language/operators 301!
|
/expressions/language-operators /language/operators 301!
|
||||||
/expressions/language-values /language/values 301!
|
/expressions/language-values /language/values 301!
|
||||||
/expressions/* /language/:splat 301!
|
/expressions/* /language/:splat 301!
|
||||||
|
/language/values /language/types 301!
|
||||||
|
/language/constructs /language/syntax 301!
|
||||||
|
/language/builtin-constants /language/builtins 301!
|
||||||
|
|
||||||
/installation/installation /installation 301!
|
/installation/installation /installation 301!
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ Most Nix commands interpret the following environment variables:
|
||||||
- <span id="env-NIX_PATH">[`NIX_PATH`](#env-NIX_PATH)</span>
|
- <span id="env-NIX_PATH">[`NIX_PATH`](#env-NIX_PATH)</span>
|
||||||
|
|
||||||
A colon-separated list of directories used to look up the location of Nix
|
A colon-separated list of directories used to look up the location of Nix
|
||||||
expressions using [paths](@docroot@/language/values.md#type-path)
|
expressions using [paths](@docroot@/language/types.md#type-path)
|
||||||
enclosed in angle brackets (i.e., `<path>`),
|
enclosed in angle brackets (i.e., `<path>`),
|
||||||
e.g. `/home/eelco/Dev:/etc/nixos`. It can be extended using the
|
e.g. `/home/eelco/Dev:/etc/nixos`. It can be extended using the
|
||||||
[`-I` option](@docroot@/command-ref/opt-common.md#opt-I).
|
[`-I` option](@docroot@/command-ref/opt-common.md#opt-I).
|
||||||
|
|
|
@ -27,7 +27,8 @@ The moving parts of channels are:
|
||||||
|
|
||||||
This command has the following operations:
|
This command has the following operations:
|
||||||
|
|
||||||
- `--add` *url* \[*name*\]\
|
- `--add` *url* \[*name*\]
|
||||||
|
|
||||||
Add a channel *name* located at *url* to the list of subscribed channels.
|
Add a channel *name* located at *url* to the list of subscribed channels.
|
||||||
If *name* is omitted, default to the last component of *url*, with the suffixes `-stable` or `-unstable` removed.
|
If *name* is omitted, default to the last component of *url*, with the suffixes `-stable` or `-unstable` removed.
|
||||||
|
|
||||||
|
@ -39,17 +40,21 @@ This command has the following operations:
|
||||||
A channel URL must point to a directory containing a file `nixexprs.tar.gz`.
|
A channel URL must point to a directory containing a file `nixexprs.tar.gz`.
|
||||||
At the top level, that tarball must contain a single directory with a `default.nix` file that serves as the channel’s entry point.
|
At the top level, that tarball must contain a single directory with a `default.nix` file that serves as the channel’s entry point.
|
||||||
|
|
||||||
- `--remove` *name*\
|
- `--remove` *name*
|
||||||
|
|
||||||
Remove the channel *name* from the list of subscribed channels.
|
Remove the channel *name* from the list of subscribed channels.
|
||||||
|
|
||||||
- `--list`\
|
- `--list`
|
||||||
|
|
||||||
Print the names and URLs of all subscribed channels on standard output.
|
Print the names and URLs of all subscribed channels on standard output.
|
||||||
|
|
||||||
- `--update` \[*names*…\]\
|
- `--update` \[*names*…\]
|
||||||
|
|
||||||
Download the Nix expressions of subscribed channels and create a new generation.
|
Download the Nix expressions of subscribed channels and create a new generation.
|
||||||
Update all channels if none is specified, and only those included in *names* otherwise.
|
Update all channels if none is specified, and only those included in *names* otherwise.
|
||||||
|
|
||||||
- `--list-generations`\
|
- `--list-generations`
|
||||||
|
|
||||||
Prints a list of all the current existing generations for the
|
Prints a list of all the current existing generations for the
|
||||||
channel profile.
|
channel profile.
|
||||||
|
|
||||||
|
@ -58,7 +63,8 @@ This command has the following operations:
|
||||||
nix-env --profile /nix/var/nix/profiles/per-user/$USER/channels --list-generations
|
nix-env --profile /nix/var/nix/profiles/per-user/$USER/channels --list-generations
|
||||||
```
|
```
|
||||||
|
|
||||||
- `--rollback` \[*generation*\]\
|
- `--rollback` \[*generation*\]
|
||||||
|
|
||||||
Revert channels to the state before the last call to `nix-channel --update`.
|
Revert channels to the state before the last call to `nix-channel --update`.
|
||||||
Optionally, you can specify a specific channel *generation* number to restore.
|
Optionally, you can specify a specific channel *generation* number to restore.
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,14 @@ Instead, it looks in a few locations, and acts on all profiles it finds there:
|
||||||
|
|
||||||
These options are for deleting old [profiles] prior to deleting unreachable [store objects].
|
These options are for deleting old [profiles] prior to deleting unreachable [store objects].
|
||||||
|
|
||||||
- <span id="opt-delete-old">[`--delete-old`](#opt-delete-old)</span> / `-d`\
|
- <span id="opt-delete-old">[`--delete-old`](#opt-delete-old)</span> / `-d`
|
||||||
|
|
||||||
Delete all old generations of profiles.
|
Delete all old generations of profiles.
|
||||||
|
|
||||||
This is the equivalent of invoking [`nix-env --delete-generations old`](@docroot@/command-ref/nix-env/delete-generations.md#generations-old) on each found profile.
|
This is the equivalent of invoking [`nix-env --delete-generations old`](@docroot@/command-ref/nix-env/delete-generations.md#generations-old) on each found profile.
|
||||||
|
|
||||||
- <span id="opt-delete-older-than">[`--delete-older-than`](#opt-delete-older-than)</span> *period*\
|
- <span id="opt-delete-older-than">[`--delete-older-than`](#opt-delete-older-than)</span> *period*
|
||||||
|
|
||||||
Delete all generations of profiles older than the specified amount (except for the generations that were active at that point in time).
|
Delete all generations of profiles older than the specified amount (except for the generations that were active at that point in time).
|
||||||
*period* is a value such as `30d`, which would mean 30 days.
|
*period* is a value such as `30d`, which would mean 30 days.
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ This operation deletes the specified generations of the current profile.
|
||||||
|
|
||||||
*generations* can be a one of the following:
|
*generations* can be a one of the following:
|
||||||
|
|
||||||
- <span id="generations-list">[`<number>...`](#generations-list)</span>:\
|
- <span id="generations-list">[`<number>...`](#generations-list)</span>
|
||||||
|
|
||||||
A list of generation numbers, each one a separate command-line argument.
|
A list of generation numbers, each one a separate command-line argument.
|
||||||
|
|
||||||
Delete exactly the profile generations given by their generation number.
|
Delete exactly the profile generations given by their generation number.
|
||||||
|
@ -30,7 +31,8 @@ This operation deletes the specified generations of the current profile.
|
||||||
> Because one can roll back to a previous generation, it is possible to have generations newer than the current one.
|
> Because one can roll back to a previous generation, it is possible to have generations newer than the current one.
|
||||||
> They will also be deleted.
|
> They will also be deleted.
|
||||||
|
|
||||||
- <span id="generations-time">[`<number>d`](#generations-time)</span>:\
|
- <span id="generations-time">[`<number>d`](#generations-time)</span>
|
||||||
|
|
||||||
The last *number* days
|
The last *number* days
|
||||||
|
|
||||||
*Example*: `30d`
|
*Example*: `30d`
|
||||||
|
@ -38,7 +40,8 @@ This operation deletes the specified generations of the current profile.
|
||||||
Delete all generations created more than *number* days ago, except the most recent one of them.
|
Delete all generations created more than *number* days ago, except the most recent one of them.
|
||||||
This allows rolling back to generations that were available within the specified period.
|
This allows rolling back to generations that were available within the specified period.
|
||||||
|
|
||||||
- <span id="generations-count">[`+<number>`](#generations-count)</span>:\
|
- <span id="generations-count">[`+<number>`](#generations-count)</span>
|
||||||
|
|
||||||
The last *number* generations up to the present
|
The last *number* generations up to the present
|
||||||
|
|
||||||
*Example*: `+5`
|
*Example*: `+5`
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Environment variables
|
# Environment variables
|
||||||
|
|
||||||
- `NIX_PROFILE`\
|
- `NIX_PROFILE`
|
||||||
|
|
||||||
Location of the Nix profile. Defaults to the target of the symlink
|
Location of the Nix profile. Defaults to the target of the symlink
|
||||||
`~/.nix-profile`, if it exists, or `/nix/var/nix/profiles/default`
|
`~/.nix-profile`, if it exists, or `/nix/var/nix/profiles/default`
|
||||||
otherwise.
|
otherwise.
|
||||||
|
|
|
@ -57,7 +57,7 @@ The arguments *args* map to store paths in a number of possible ways:
|
||||||
easy way to copy user environment elements from one profile to
|
easy way to copy user environment elements from one profile to
|
||||||
another.
|
another.
|
||||||
|
|
||||||
- If `--from-expression` is given, *args* are [Nix language functions](@docroot@/language/constructs.md#functions) that are called with the [default Nix expression] as their single argument.
|
- If `--from-expression` is given, *args* are [Nix language functions](@docroot@/language/syntax.md#functions) that are called with the [default Nix expression] as their single argument.
|
||||||
The derivations returned by those function calls are installed.
|
The derivations returned by those function calls are installed.
|
||||||
This allows derivations to be specified in an unambiguous way, which is necessary if there are multiple derivations with the same name.
|
This allows derivations to be specified in an unambiguous way, which is necessary if there are multiple derivations with the same name.
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
The following options are allowed for all `nix-env` operations, but may not always have an effect.
|
The following options are allowed for all `nix-env` operations, but may not always have an effect.
|
||||||
|
|
||||||
- `--file` / `-f` *path*\
|
- `--file` / `-f` *path*
|
||||||
|
|
||||||
Specifies the Nix expression (designated below as the *active Nix
|
Specifies the Nix expression (designated below as the *active Nix
|
||||||
expression*) used by the `--install`, `--upgrade`, and `--query
|
expression*) used by the `--install`, `--upgrade`, and `--query
|
||||||
--available` operations to obtain derivations. The default is
|
--available` operations to obtain derivations. The default is
|
||||||
|
@ -13,13 +14,15 @@ The following options are allowed for all `nix-env` operations, but may not alwa
|
||||||
unpacked to a temporary location. The tarball must include a single
|
unpacked to a temporary location. The tarball must include a single
|
||||||
top-level directory containing at least a file named `default.nix`.
|
top-level directory containing at least a file named `default.nix`.
|
||||||
|
|
||||||
- `--profile` / `-p` *path*\
|
- `--profile` / `-p` *path*
|
||||||
|
|
||||||
Specifies the profile to be used by those operations that operate on
|
Specifies the profile to be used by those operations that operate on
|
||||||
a profile (designated below as the *active profile*). A profile is a
|
a profile (designated below as the *active profile*). A profile is a
|
||||||
sequence of user environments called *generations*, one of which is
|
sequence of user environments called *generations*, one of which is
|
||||||
the *current generation*.
|
the *current generation*.
|
||||||
|
|
||||||
- `--dry-run`\
|
- `--dry-run`
|
||||||
|
|
||||||
For the `--install`, `--upgrade`, `--uninstall`,
|
For the `--install`, `--upgrade`, `--uninstall`,
|
||||||
`--switch-generation`, `--delete-generations` and `--rollback`
|
`--switch-generation`, `--delete-generations` and `--rollback`
|
||||||
operations, this flag will cause `nix-env` to print what *would* be
|
operations, this flag will cause `nix-env` to print what *would* be
|
||||||
|
@ -29,7 +32,7 @@ The following options are allowed for all `nix-env` operations, but may not alwa
|
||||||
[substituted](@docroot@/glossary.md) (i.e., downloaded) and which paths
|
[substituted](@docroot@/glossary.md) (i.e., downloaded) and which paths
|
||||||
will be built from source (because no substitute is available).
|
will be built from source (because no substitute is available).
|
||||||
|
|
||||||
- `--system-filter` *system*\
|
- `--system-filter` *system*
|
||||||
By default, operations such as `--query
|
|
||||||
--available` show derivations matching any platform. This option
|
By default, operations such as `--query --available` show derivations matching any platform. This option
|
||||||
allows you to use derivations for the specified platform *system*.
|
allows you to use derivations for the specified platform *system*.
|
||||||
|
|
|
@ -35,11 +35,13 @@ The derivations are sorted by their `name` attributes.
|
||||||
The following flags specify the set of things on which the query
|
The following flags specify the set of things on which the query
|
||||||
operates.
|
operates.
|
||||||
|
|
||||||
- `--installed`\
|
- `--installed`
|
||||||
|
|
||||||
The query operates on the store paths that are installed in the
|
The query operates on the store paths that are installed in the
|
||||||
current generation of the active profile. This is the default.
|
current generation of the active profile. This is the default.
|
||||||
|
|
||||||
- `--available`; `-a`\
|
- `--available` / `-a`
|
||||||
|
|
||||||
The query operates on the derivations that are available in the
|
The query operates on the derivations that are available in the
|
||||||
active Nix expression.
|
active Nix expression.
|
||||||
|
|
||||||
|
@ -50,24 +52,28 @@ selected derivations. Multiple flags may be specified, in which case the
|
||||||
information is shown in the order given here. Note that the name of the
|
information is shown in the order given here. Note that the name of the
|
||||||
derivation is shown unless `--no-name` is specified.
|
derivation is shown unless `--no-name` is specified.
|
||||||
|
|
||||||
- `--xml`\
|
- `--xml`
|
||||||
|
|
||||||
Print the result in an XML representation suitable for automatic
|
Print the result in an XML representation suitable for automatic
|
||||||
processing by other tools. The root element is called `items`, which
|
processing by other tools. The root element is called `items`, which
|
||||||
contains a `item` element for each available or installed
|
contains a `item` element for each available or installed
|
||||||
derivation. The fields discussed below are all stored in attributes
|
derivation. The fields discussed below are all stored in attributes
|
||||||
of the `item` elements.
|
of the `item` elements.
|
||||||
|
|
||||||
- `--json`\
|
- `--json`
|
||||||
|
|
||||||
Print the result in a JSON representation suitable for automatic
|
Print the result in a JSON representation suitable for automatic
|
||||||
processing by other tools.
|
processing by other tools.
|
||||||
|
|
||||||
- `--prebuilt-only` / `-b`\
|
- `--prebuilt-only` / `-b`
|
||||||
|
|
||||||
Show only derivations for which a substitute is registered, i.e.,
|
Show only derivations for which a substitute is registered, i.e.,
|
||||||
there is a pre-built binary available that can be downloaded in lieu
|
there is a pre-built binary available that can be downloaded in lieu
|
||||||
of building the derivation. Thus, this shows all packages that
|
of building the derivation. Thus, this shows all packages that
|
||||||
probably can be installed quickly.
|
probably can be installed quickly.
|
||||||
|
|
||||||
- `--status`; `-s`\
|
- `--status` / `-s`
|
||||||
|
|
||||||
Print the *status* of the derivation. The status consists of three
|
Print the *status* of the derivation. The status consists of three
|
||||||
characters. The first is `I` or `-`, indicating whether the
|
characters. The first is `I` or `-`, indicating whether the
|
||||||
derivation is currently installed in the current generation of the
|
derivation is currently installed in the current generation of the
|
||||||
|
@ -78,49 +84,61 @@ derivation is shown unless `--no-name` is specified.
|
||||||
derivation to be built. The third is `S` or `-`, indicating whether
|
derivation to be built. The third is `S` or `-`, indicating whether
|
||||||
a substitute is available for the derivation.
|
a substitute is available for the derivation.
|
||||||
|
|
||||||
- `--attr-path`; `-P`\
|
- `--attr-path` / `-P`
|
||||||
|
|
||||||
Print the *attribute path* of the derivation, which can be used to
|
Print the *attribute path* of the derivation, which can be used to
|
||||||
unambiguously select it using the `--attr` option available in
|
unambiguously select it using the `--attr` option available in
|
||||||
commands that install derivations like `nix-env --install`. This
|
commands that install derivations like `nix-env --install`. This
|
||||||
option only works together with `--available`
|
option only works together with `--available`
|
||||||
|
|
||||||
- `--no-name`\
|
- `--no-name`
|
||||||
|
|
||||||
Suppress printing of the `name` attribute of each derivation.
|
Suppress printing of the `name` attribute of each derivation.
|
||||||
|
|
||||||
- `--compare-versions` / `-c`\
|
- `--compare-versions` / `-c`
|
||||||
|
|
||||||
Compare installed versions to available versions, or vice versa (if
|
Compare installed versions to available versions, or vice versa (if
|
||||||
`--available` is given). This is useful for quickly seeing whether
|
`--available` is given). This is useful for quickly seeing whether
|
||||||
upgrades for installed packages are available in a Nix expression. A
|
upgrades for installed packages are available in a Nix expression. A
|
||||||
column is added with the following meaning:
|
column is added with the following meaning:
|
||||||
|
|
||||||
- `<` *version*\
|
- `<` *version*
|
||||||
|
|
||||||
A newer version of the package is available or installed.
|
A newer version of the package is available or installed.
|
||||||
|
|
||||||
- `=` *version*\
|
- `=` *version*
|
||||||
|
|
||||||
At most the same version of the package is available or
|
At most the same version of the package is available or
|
||||||
installed.
|
installed.
|
||||||
|
|
||||||
- `>` *version*\
|
- `>` *version*
|
||||||
|
|
||||||
Only older versions of the package are available or installed.
|
Only older versions of the package are available or installed.
|
||||||
|
|
||||||
- `- ?`\
|
- `- ?`
|
||||||
|
|
||||||
No version of the package is available or installed.
|
No version of the package is available or installed.
|
||||||
|
|
||||||
- `--system`\
|
- `--system`
|
||||||
|
|
||||||
Print the `system` attribute of the derivation.
|
Print the `system` attribute of the derivation.
|
||||||
|
|
||||||
- `--drv-path`\
|
- `--drv-path`
|
||||||
|
|
||||||
Print the path of the [store derivation](@docroot@/glossary.md#gloss-store-derivation).
|
Print the path of the [store derivation](@docroot@/glossary.md#gloss-store-derivation).
|
||||||
|
|
||||||
- `--out-path`\
|
- `--out-path`
|
||||||
|
|
||||||
Print the output path of the derivation.
|
Print the output path of the derivation.
|
||||||
|
|
||||||
- `--description`\
|
- `--description`
|
||||||
|
|
||||||
Print a short (one-line) description of the derivation, if
|
Print a short (one-line) description of the derivation, if
|
||||||
available. The description is taken from the `meta.description`
|
available. The description is taken from the `meta.description`
|
||||||
attribute of the derivation.
|
attribute of the derivation.
|
||||||
|
|
||||||
- `--meta`\
|
- `--meta`
|
||||||
|
|
||||||
Print all of the meta-attributes of the derivation. This option is
|
Print all of the meta-attributes of the derivation. This option is
|
||||||
only available with `--xml` or `--json`.
|
only available with `--xml` or `--json`.
|
||||||
|
|
||||||
|
|
|
@ -28,36 +28,42 @@ version is installed.
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
|
|
||||||
- `--lt`\
|
- `--lt`
|
||||||
|
|
||||||
Only upgrade a derivation to newer versions. This is the default.
|
Only upgrade a derivation to newer versions. This is the default.
|
||||||
|
|
||||||
- `--leq`\
|
- `--leq`
|
||||||
|
|
||||||
In addition to upgrading to newer versions, also “upgrade” to
|
In addition to upgrading to newer versions, also “upgrade” to
|
||||||
derivations that have the same version. Version are not a unique
|
derivations that have the same version. Version are not a unique
|
||||||
identification of a derivation, so there may be many derivations
|
identification of a derivation, so there may be many derivations
|
||||||
that have the same version. This flag may be useful to force
|
that have the same version. This flag may be useful to force
|
||||||
“synchronisation” between the installed and available derivations.
|
“synchronisation” between the installed and available derivations.
|
||||||
|
|
||||||
- `--eq`\
|
- `--eq`
|
||||||
|
|
||||||
*Only* “upgrade” to derivations that have the same version. This may
|
*Only* “upgrade” to derivations that have the same version. This may
|
||||||
not seem very useful, but it actually is, e.g., when there is a new
|
not seem very useful, but it actually is, e.g., when there is a new
|
||||||
release of Nixpkgs and you want to replace installed applications
|
release of Nixpkgs and you want to replace installed applications
|
||||||
with the same versions built against newer dependencies (to reduce
|
with the same versions built against newer dependencies (to reduce
|
||||||
the number of dependencies floating around on your system).
|
the number of dependencies floating around on your system).
|
||||||
|
|
||||||
- `--always`\
|
- `--always`
|
||||||
|
|
||||||
In addition to upgrading to newer versions, also “upgrade” to
|
In addition to upgrading to newer versions, also “upgrade” to
|
||||||
derivations that have the same or a lower version. I.e., derivations
|
derivations that have the same or a lower version. I.e., derivations
|
||||||
may actually be downgraded depending on what is available in the
|
may actually be downgraded depending on what is available in the
|
||||||
active Nix expression.
|
active Nix expression.
|
||||||
|
|
||||||
- `--prebuilt-only` / `-b`\
|
- `--prebuilt-only` / `-b`
|
||||||
|
|
||||||
Use only derivations for which a substitute is registered, i.e.,
|
Use only derivations for which a substitute is registered, i.e.,
|
||||||
there is a pre-built binary available that can be downloaded in lieu
|
there is a pre-built binary available that can be downloaded in lieu
|
||||||
of building the derivation. Thus, no packages will be built from
|
of building the derivation. Thus, no packages will be built from
|
||||||
source.
|
source.
|
||||||
|
|
||||||
- `--preserve-installed` / `-P`\
|
- `--preserve-installed` / `-P`
|
||||||
|
|
||||||
Do not remove derivations with a name matching one of the
|
Do not remove derivations with a name matching one of the
|
||||||
derivations being installed. Usually, trying to have two versions of
|
derivations being installed. Usually, trying to have two versions of
|
||||||
the same package installed in the same generation of a profile will
|
the same package installed in the same generation of a profile will
|
||||||
|
|
|
@ -29,7 +29,8 @@ md5sum`.
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
|
|
||||||
- `--flat`\
|
- `--flat`
|
||||||
|
|
||||||
Print the cryptographic hash of the contents of each regular file *path*.
|
Print the cryptographic hash of the contents of each regular file *path*.
|
||||||
That is, instead of computing
|
That is, instead of computing
|
||||||
the hash of the [Nix Archive (NAR)](@docroot@/store/file-system-object/content-address.md#serial-nix-archive) of *path*,
|
the hash of the [Nix Archive (NAR)](@docroot@/store/file-system-object/content-address.md#serial-nix-archive) of *path*,
|
||||||
|
@ -38,43 +39,53 @@ md5sum`.
|
||||||
The result is identical to that produced by the GNU commands
|
The result is identical to that produced by the GNU commands
|
||||||
`md5sum` and `sha1sum`.
|
`md5sum` and `sha1sum`.
|
||||||
|
|
||||||
- `--base16`\
|
- `--base16`
|
||||||
|
|
||||||
Print the hash in a hexadecimal representation (default).
|
Print the hash in a hexadecimal representation (default).
|
||||||
|
|
||||||
- `--base32`\
|
- `--base32`
|
||||||
|
|
||||||
Print the hash in a base-32 representation rather than hexadecimal.
|
Print the hash in a base-32 representation rather than hexadecimal.
|
||||||
This base-32 representation is more compact and can be used in Nix
|
This base-32 representation is more compact and can be used in Nix
|
||||||
expressions (such as in calls to `fetchurl`).
|
expressions (such as in calls to `fetchurl`).
|
||||||
|
|
||||||
- `--base64`\
|
- `--base64`
|
||||||
|
|
||||||
Similar to --base32, but print the hash in a base-64 representation,
|
Similar to --base32, but print the hash in a base-64 representation,
|
||||||
which is more compact than the base-32 one.
|
which is more compact than the base-32 one.
|
||||||
|
|
||||||
- `--sri`\
|
- `--sri`
|
||||||
|
|
||||||
Print the hash in SRI format with base-64 encoding.
|
Print the hash in SRI format with base-64 encoding.
|
||||||
The type of hash algorithm will be prepended to the hash string,
|
The type of hash algorithm will be prepended to the hash string,
|
||||||
followed by a hyphen (-) and the base-64 hash body.
|
followed by a hyphen (-) and the base-64 hash body.
|
||||||
|
|
||||||
- `--truncate`\
|
- `--truncate`
|
||||||
|
|
||||||
Truncate hashes longer than 160 bits (such as SHA-256) to 160 bits.
|
Truncate hashes longer than 160 bits (such as SHA-256) to 160 bits.
|
||||||
|
|
||||||
- `--type` *hashAlgo*\
|
- `--type` *hashAlgo*
|
||||||
|
|
||||||
Use the specified cryptographic hash algorithm, which can be one of
|
Use the specified cryptographic hash algorithm, which can be one of
|
||||||
`md5`, `sha1`, `sha256`, and `sha512`.
|
`md5`, `sha1`, `sha256`, and `sha512`.
|
||||||
|
|
||||||
- `--to-base16`\
|
- `--to-base16`
|
||||||
|
|
||||||
Don’t hash anything, but convert the base-32 hash representation
|
Don’t hash anything, but convert the base-32 hash representation
|
||||||
*hash* to hexadecimal.
|
*hash* to hexadecimal.
|
||||||
|
|
||||||
- `--to-base32`\
|
- `--to-base32`
|
||||||
|
|
||||||
Don’t hash anything, but convert the hexadecimal hash representation
|
Don’t hash anything, but convert the hexadecimal hash representation
|
||||||
*hash* to base-32.
|
*hash* to base-32.
|
||||||
|
|
||||||
- `--to-base64`\
|
- `--to-base64`
|
||||||
|
|
||||||
Don’t hash anything, but convert the hexadecimal hash representation
|
Don’t hash anything, but convert the hexadecimal hash representation
|
||||||
*hash* to base-64.
|
*hash* to base-64.
|
||||||
|
|
||||||
- `--to-sri`\
|
- `--to-sri`
|
||||||
|
|
||||||
Don’t hash anything, but convert the hexadecimal hash representation
|
Don’t hash anything, but convert the hexadecimal hash representation
|
||||||
*hash* to SRI.
|
*hash* to SRI.
|
||||||
|
|
||||||
|
|
|
@ -30,14 +30,17 @@ standard input.
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
|
|
||||||
- `--add-root` *path*\
|
- `--add-root` *path*
|
||||||
|
|
||||||
See the [corresponding option](nix-store.md) in `nix-store`.
|
See the [corresponding option](nix-store.md) in `nix-store`.
|
||||||
|
|
||||||
- `--parse`\
|
- `--parse`
|
||||||
|
|
||||||
Just parse the input files, and print their abstract syntax trees on
|
Just parse the input files, and print their abstract syntax trees on
|
||||||
standard output as a Nix expression.
|
standard output as a Nix expression.
|
||||||
|
|
||||||
- `--eval`\
|
- `--eval`
|
||||||
|
|
||||||
Just parse and evaluate the input files, and print the resulting
|
Just parse and evaluate the input files, and print the resulting
|
||||||
values on standard output. No instantiation of store derivations
|
values on standard output. No instantiation of store derivations
|
||||||
takes place.
|
takes place.
|
||||||
|
@ -80,14 +83,16 @@ standard input.
|
||||||
> </expr>
|
> </expr>
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
- `--find-file`\
|
- `--find-file`
|
||||||
|
|
||||||
Look up the given files in Nix’s search path (as specified by the
|
Look up the given files in Nix’s search path (as specified by the
|
||||||
`NIX_PATH` environment variable). If found, print the corresponding
|
`NIX_PATH` environment variable). If found, print the corresponding
|
||||||
absolute paths on standard output. For instance, if `NIX_PATH` is
|
absolute paths on standard output. For instance, if `NIX_PATH` is
|
||||||
`nixpkgs=/home/alice/nixpkgs`, then `nix-instantiate --find-file
|
`nixpkgs=/home/alice/nixpkgs`, then `nix-instantiate --find-file
|
||||||
nixpkgs/default.nix` will print `/home/alice/nixpkgs/default.nix`.
|
nixpkgs/default.nix` will print `/home/alice/nixpkgs/default.nix`.
|
||||||
|
|
||||||
- `--strict`\
|
- `--strict`
|
||||||
|
|
||||||
When used with `--eval`, recursively evaluate list elements and
|
When used with `--eval`, recursively evaluate list elements and
|
||||||
attributes. Normally, such sub-expressions are left unevaluated
|
attributes. Normally, such sub-expressions are left unevaluated
|
||||||
(since the Nix language is lazy).
|
(since the Nix language is lazy).
|
||||||
|
@ -97,17 +102,20 @@ standard input.
|
||||||
> This option can cause non-termination, because lazy data
|
> This option can cause non-termination, because lazy data
|
||||||
> structures can be infinitely large.
|
> structures can be infinitely large.
|
||||||
|
|
||||||
- `--json`\
|
- `--json`
|
||||||
|
|
||||||
When used with `--eval`, print the resulting value as an JSON
|
When used with `--eval`, print the resulting value as an JSON
|
||||||
representation of the abstract syntax tree rather than as a Nix expression.
|
representation of the abstract syntax tree rather than as a Nix expression.
|
||||||
|
|
||||||
- `--xml`\
|
- `--xml`
|
||||||
|
|
||||||
When used with `--eval`, print the resulting value as an XML
|
When used with `--eval`, print the resulting value as an XML
|
||||||
representation of the abstract syntax tree rather than as a Nix expression.
|
representation of the abstract syntax tree rather than as a Nix expression.
|
||||||
The schema is the same as that used by the [`toXML`
|
The schema is the same as that used by the [`toXML`
|
||||||
built-in](../language/builtins.md).
|
built-in](../language/builtins.md).
|
||||||
|
|
||||||
- `--read-write-mode`\
|
- `--read-write-mode`
|
||||||
|
|
||||||
When used with `--eval`, perform evaluation in read/write mode so
|
When used with `--eval`, perform evaluation in read/write mode so
|
||||||
nix language features that require it will still work (at the cost
|
nix language features that require it will still work (at the cost
|
||||||
of needing to do instantiation of every evaluated derivation). If
|
of needing to do instantiation of every evaluated derivation). If
|
||||||
|
|
|
@ -39,23 +39,28 @@ the path of the downloaded file in the Nix store is also printed.
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
|
|
||||||
- `--type` *hashAlgo*\
|
- `--type` *hashAlgo*
|
||||||
|
|
||||||
Use the specified cryptographic hash algorithm,
|
Use the specified cryptographic hash algorithm,
|
||||||
which can be one of `md5`, `sha1`, `sha256`, and `sha512`.
|
which can be one of `md5`, `sha1`, `sha256`, and `sha512`.
|
||||||
The default is `sha256`.
|
The default is `sha256`.
|
||||||
|
|
||||||
- `--print-path`\
|
- `--print-path`
|
||||||
|
|
||||||
Print the store path of the downloaded file on standard output.
|
Print the store path of the downloaded file on standard output.
|
||||||
|
|
||||||
- `--unpack`\
|
- `--unpack`
|
||||||
|
|
||||||
Unpack the archive (which must be a tarball or zip file) and add the
|
Unpack the archive (which must be a tarball or zip file) and add the
|
||||||
result to the Nix store. The resulting hash can be used with
|
result to the Nix store. The resulting hash can be used with
|
||||||
functions such as Nixpkgs’s `fetchzip` or `fetchFromGitHub`.
|
functions such as Nixpkgs’s `fetchzip` or `fetchFromGitHub`.
|
||||||
|
|
||||||
- `--executable`\
|
- `--executable`
|
||||||
|
|
||||||
Set the executable bit on the downloaded file.
|
Set the executable bit on the downloaded file.
|
||||||
|
|
||||||
- `--name` *name*\
|
- `--name` *name*
|
||||||
|
|
||||||
Override the name of the file in the Nix store. By default, this is
|
Override the name of the file in the Nix store. By default, this is
|
||||||
`hash-basename`, where *basename* is the last component of *url*.
|
`hash-basename`, where *basename* is the last component of *url*.
|
||||||
Overriding the name is necessary when *basename* contains characters
|
Overriding the name is necessary when *basename* contains characters
|
||||||
|
|
|
@ -60,7 +60,8 @@ All options not listed here are passed to `nix-store
|
||||||
--realise`, except for `--arg` and `--attr` / `-A` which are passed to
|
--realise`, except for `--arg` and `--attr` / `-A` which are passed to
|
||||||
`nix-instantiate`.
|
`nix-instantiate`.
|
||||||
|
|
||||||
- `--command` *cmd*\
|
- `--command` *cmd*
|
||||||
|
|
||||||
In the environment of the derivation, run the shell command *cmd*.
|
In the environment of the derivation, run the shell command *cmd*.
|
||||||
This command is executed in an interactive shell. (Use `--run` to
|
This command is executed in an interactive shell. (Use `--run` to
|
||||||
use a non-interactive shell instead.) However, a call to `exit` is
|
use a non-interactive shell instead.) However, a call to `exit` is
|
||||||
|
@ -70,34 +71,40 @@ All options not listed here are passed to `nix-store
|
||||||
drop you into the interactive shell. This can be useful for doing
|
drop you into the interactive shell. This can be useful for doing
|
||||||
any additional initialisation.
|
any additional initialisation.
|
||||||
|
|
||||||
- `--run` *cmd*\
|
- `--run` *cmd*
|
||||||
|
|
||||||
Like `--command`, but executes the command in a non-interactive
|
Like `--command`, but executes the command in a non-interactive
|
||||||
shell. This means (among other things) that if you hit Ctrl-C while
|
shell. This means (among other things) that if you hit Ctrl-C while
|
||||||
the command is running, the shell exits.
|
the command is running, the shell exits.
|
||||||
|
|
||||||
- `--exclude` *regexp*\
|
- `--exclude` *regexp*
|
||||||
|
|
||||||
Do not build any dependencies whose store path matches the regular
|
Do not build any dependencies whose store path matches the regular
|
||||||
expression *regexp*. This option may be specified multiple times.
|
expression *regexp*. This option may be specified multiple times.
|
||||||
|
|
||||||
- `--pure`\
|
- `--pure`
|
||||||
|
|
||||||
If this flag is specified, the environment is almost entirely
|
If this flag is specified, the environment is almost entirely
|
||||||
cleared before the interactive shell is started, so you get an
|
cleared before the interactive shell is started, so you get an
|
||||||
environment that more closely corresponds to the “real” Nix build. A
|
environment that more closely corresponds to the “real” Nix build. A
|
||||||
few variables, in particular `HOME`, `USER` and `DISPLAY`, are
|
few variables, in particular `HOME`, `USER` and `DISPLAY`, are
|
||||||
retained.
|
retained.
|
||||||
|
|
||||||
- `--packages` / `-p` *packages*…\
|
- `--packages` / `-p` *packages*…
|
||||||
|
|
||||||
Set up an environment in which the specified packages are present.
|
Set up an environment in which the specified packages are present.
|
||||||
The command line arguments are interpreted as attribute names inside
|
The command line arguments are interpreted as attribute names inside
|
||||||
the Nix Packages collection. Thus, `nix-shell --packages libjpeg openjdk`
|
the Nix Packages collection. Thus, `nix-shell --packages libjpeg openjdk`
|
||||||
will start a shell in which the packages denoted by the attribute
|
will start a shell in which the packages denoted by the attribute
|
||||||
names `libjpeg` and `openjdk` are present.
|
names `libjpeg` and `openjdk` are present.
|
||||||
|
|
||||||
- `-i` *interpreter*\
|
- `-i` *interpreter*
|
||||||
|
|
||||||
The chained script interpreter to be invoked by `nix-shell`. Only
|
The chained script interpreter to be invoked by `nix-shell`. Only
|
||||||
applicable in `#!`-scripts (described below).
|
applicable in `#!`-scripts (described below).
|
||||||
|
|
||||||
- `--keep` *name*\
|
- `--keep` *name*
|
||||||
|
|
||||||
When a `--pure` shell is started, keep the listed environment
|
When a `--pure` shell is started, keep the listed environment
|
||||||
variables.
|
variables.
|
||||||
|
|
||||||
|
@ -105,7 +112,8 @@ All options not listed here are passed to `nix-store
|
||||||
|
|
||||||
# Environment variables
|
# Environment variables
|
||||||
|
|
||||||
- `NIX_BUILD_SHELL`\
|
- `NIX_BUILD_SHELL`
|
||||||
|
|
||||||
Shell used to start the interactive environment. Defaults to the
|
Shell used to start the interactive environment. Defaults to the
|
||||||
`bash` found in `<nixpkgs>`, falling back to the `bash` found in
|
`bash` found in `<nixpkgs>`, falling back to the `bash` found in
|
||||||
`PATH` if not found.
|
`PATH` if not found.
|
||||||
|
|
|
@ -16,7 +16,8 @@ public url or broke since the download expression was written.
|
||||||
|
|
||||||
This operation has the following options:
|
This operation has the following options:
|
||||||
|
|
||||||
- `--recursive`\
|
- `--recursive`
|
||||||
|
|
||||||
Use recursive instead of flat hashing mode, used when adding
|
Use recursive instead of flat hashing mode, used when adding
|
||||||
directories to the store.
|
directories to the store.
|
||||||
|
|
||||||
|
|
|
@ -14,18 +14,21 @@ reachable via file system references from a set of “roots”, are deleted.
|
||||||
|
|
||||||
The following suboperations may be specified:
|
The following suboperations may be specified:
|
||||||
|
|
||||||
- `--print-roots`\
|
- `--print-roots`
|
||||||
|
|
||||||
This operation prints on standard output the set of roots used by
|
This operation prints on standard output the set of roots used by
|
||||||
the garbage collector.
|
the garbage collector.
|
||||||
|
|
||||||
- `--print-live`\
|
- `--print-live`
|
||||||
|
|
||||||
This operation prints on standard output the set of “live” store
|
This operation prints on standard output the set of “live” store
|
||||||
paths, which are all the store paths reachable from the roots. Live
|
paths, which are all the store paths reachable from the roots. Live
|
||||||
paths should never be deleted, since that would break consistency —
|
paths should never be deleted, since that would break consistency —
|
||||||
it would become possible that applications are installed that
|
it would become possible that applications are installed that
|
||||||
reference things that are no longer present in the store.
|
reference things that are no longer present in the store.
|
||||||
|
|
||||||
- `--print-dead`\
|
- `--print-dead`
|
||||||
|
|
||||||
This operation prints out on standard output the set of “dead” store
|
This operation prints out on standard output the set of “dead” store
|
||||||
paths, which is just the opposite of the set of live paths: any path
|
paths, which is just the opposite of the set of live paths: any path
|
||||||
in the store that is not live (with respect to the roots) is dead.
|
in the store that is not live (with respect to the roots) is dead.
|
||||||
|
@ -33,7 +36,8 @@ The following suboperations may be specified:
|
||||||
By default, all unreachable paths are deleted. The following options
|
By default, all unreachable paths are deleted. The following options
|
||||||
control what gets deleted and in what order:
|
control what gets deleted and in what order:
|
||||||
|
|
||||||
- `--max-freed` *bytes*\
|
- `--max-freed` *bytes*
|
||||||
|
|
||||||
Keep deleting paths until at least *bytes* bytes have been deleted,
|
Keep deleting paths until at least *bytes* bytes have been deleted,
|
||||||
then stop. The argument *bytes* can be followed by the
|
then stop. The argument *bytes* can be followed by the
|
||||||
multiplicative suffix `K`, `M`, `G` or `T`, denoting KiB, MiB, GiB
|
multiplicative suffix `K`, `M`, `G` or `T`, denoting KiB, MiB, GiB
|
||||||
|
|
|
@ -24,25 +24,29 @@ symlink.
|
||||||
|
|
||||||
# Common query options
|
# Common query options
|
||||||
|
|
||||||
- `--use-output`; `-u`\
|
- `--use-output` / `-u`
|
||||||
|
|
||||||
For each argument to the query that is a [store derivation], apply the
|
For each argument to the query that is a [store derivation], apply the
|
||||||
query to the output path of the derivation instead.
|
query to the output path of the derivation instead.
|
||||||
|
|
||||||
- `--force-realise`; `-f`\
|
- `--force-realise` / `-f`
|
||||||
|
|
||||||
Realise each argument to the query first (see [`nix-store --realise`](./realise.md)).
|
Realise each argument to the query first (see [`nix-store --realise`](./realise.md)).
|
||||||
|
|
||||||
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
|
[store derivation]: @docroot@/glossary.md#gloss-store-derivation
|
||||||
|
|
||||||
# Queries
|
# Queries
|
||||||
|
|
||||||
- `--outputs`\
|
- `--outputs`
|
||||||
|
|
||||||
Prints out the [output paths] of the store
|
Prints out the [output paths] of the store
|
||||||
derivations *paths*. These are the paths that will be produced when
|
derivations *paths*. These are the paths that will be produced when
|
||||||
the derivation is built.
|
the derivation is built.
|
||||||
|
|
||||||
[output paths]: @docroot@/glossary.md#gloss-output-path
|
[output paths]: @docroot@/glossary.md#gloss-output-path
|
||||||
|
|
||||||
- `--requisites`; `-R`\
|
- `--requisites` / `-R`
|
||||||
|
|
||||||
Prints out the [closure] of the store path *paths*.
|
Prints out the [closure] of the store path *paths*.
|
||||||
|
|
||||||
[closure]: @docroot@/glossary.md#gloss-closure
|
[closure]: @docroot@/glossary.md#gloss-closure
|
||||||
|
@ -61,27 +65,31 @@ symlink.
|
||||||
dependencies) is obtained by distributing the closure of a store
|
dependencies) is obtained by distributing the closure of a store
|
||||||
derivation and specifying the option `--include-outputs`.
|
derivation and specifying the option `--include-outputs`.
|
||||||
|
|
||||||
- `--references`\
|
- `--references`
|
||||||
|
|
||||||
Prints the set of [references] of the store paths
|
Prints the set of [references] of the store paths
|
||||||
*paths*, that is, their immediate dependencies. (For *all*
|
*paths*, that is, their immediate dependencies. (For *all*
|
||||||
dependencies, use `--requisites`.)
|
dependencies, use `--requisites`.)
|
||||||
|
|
||||||
[references]: @docroot@/glossary.md#gloss-reference
|
[references]: @docroot@/glossary.md#gloss-reference
|
||||||
|
|
||||||
- `--referrers`\
|
- `--referrers`
|
||||||
|
|
||||||
Prints the set of *referrers* of the store paths *paths*, that is,
|
Prints the set of *referrers* of the store paths *paths*, that is,
|
||||||
the store paths currently existing in the Nix store that refer to
|
the store paths currently existing in the Nix store that refer to
|
||||||
one of *paths*. Note that contrary to the references, the set of
|
one of *paths*. Note that contrary to the references, the set of
|
||||||
referrers is not constant; it can change as store paths are added or
|
referrers is not constant; it can change as store paths are added or
|
||||||
removed.
|
removed.
|
||||||
|
|
||||||
- `--referrers-closure`\
|
- `--referrers-closure`
|
||||||
|
|
||||||
Prints the closure of the set of store paths *paths* under the
|
Prints the closure of the set of store paths *paths* under the
|
||||||
referrers relation; that is, all store paths that directly or
|
referrers relation; that is, all store paths that directly or
|
||||||
indirectly refer to one of *paths*. These are all the path currently
|
indirectly refer to one of *paths*. These are all the path currently
|
||||||
in the Nix store that are dependent on *paths*.
|
in the Nix store that are dependent on *paths*.
|
||||||
|
|
||||||
- `--deriver`; `-d`\
|
- `--deriver` / `-d`
|
||||||
|
|
||||||
Prints the [deriver] that was used to build the store paths *paths*. If
|
Prints the [deriver] that was used to build the store paths *paths*. If
|
||||||
the path has no deriver (e.g., if it is a source file), or if the
|
the path has no deriver (e.g., if it is a source file), or if the
|
||||||
deriver is not known (e.g., in the case of a binary-only
|
deriver is not known (e.g., in the case of a binary-only
|
||||||
|
@ -92,12 +100,14 @@ symlink.
|
||||||
|
|
||||||
[deriver]: @docroot@/glossary.md#gloss-deriver
|
[deriver]: @docroot@/glossary.md#gloss-deriver
|
||||||
|
|
||||||
- `--valid-derivers`\
|
- `--valid-derivers`
|
||||||
|
|
||||||
Prints a set of derivation files (`.drv`) which are supposed produce
|
Prints a set of derivation files (`.drv`) which are supposed produce
|
||||||
said paths when realized. Might print nothing, for example for source paths
|
said paths when realized. Might print nothing, for example for source paths
|
||||||
or paths subsituted from a binary cache.
|
or paths subsituted from a binary cache.
|
||||||
|
|
||||||
- `--graph`\
|
- `--graph`
|
||||||
|
|
||||||
Prints the references graph of the store paths *paths* in the format
|
Prints the references graph of the store paths *paths* in the format
|
||||||
of the `dot` tool of AT\&T's [Graphviz
|
of the `dot` tool of AT\&T's [Graphviz
|
||||||
package](http://www.graphviz.org/). This can be used to visualise
|
package](http://www.graphviz.org/). This can be used to visualise
|
||||||
|
@ -105,39 +115,45 @@ symlink.
|
||||||
this to a store derivation. To obtain a runtime dependency graph,
|
this to a store derivation. To obtain a runtime dependency graph,
|
||||||
apply it to an output path.
|
apply it to an output path.
|
||||||
|
|
||||||
- `--tree`\
|
- `--tree`
|
||||||
|
|
||||||
Prints the references graph of the store paths *paths* as a nested
|
Prints the references graph of the store paths *paths* as a nested
|
||||||
ASCII tree. References are ordered by descending closure size; this
|
ASCII tree. References are ordered by descending closure size; this
|
||||||
tends to flatten the tree, making it more readable. The query only
|
tends to flatten the tree, making it more readable. The query only
|
||||||
recurses into a store path when it is first encountered; this
|
recurses into a store path when it is first encountered; this
|
||||||
prevents a blowup of the tree representation of the graph.
|
prevents a blowup of the tree representation of the graph.
|
||||||
|
|
||||||
- `--graphml`\
|
- `--graphml`
|
||||||
|
|
||||||
Prints the references graph of the store paths *paths* in the
|
Prints the references graph of the store paths *paths* in the
|
||||||
[GraphML](http://graphml.graphdrawing.org/) file format. This can be
|
[GraphML](http://graphml.graphdrawing.org/) file format. This can be
|
||||||
used to visualise dependency graphs. To obtain a build-time
|
used to visualise dependency graphs. To obtain a build-time
|
||||||
dependency graph, apply this to a [store derivation]. To obtain a
|
dependency graph, apply this to a [store derivation]. To obtain a
|
||||||
runtime dependency graph, apply it to an output path.
|
runtime dependency graph, apply it to an output path.
|
||||||
|
|
||||||
- `--binding` *name*; `-b` *name*\
|
- `--binding` *name* / `-b` *name*
|
||||||
|
|
||||||
Prints the value of the attribute *name* (i.e., environment
|
Prints the value of the attribute *name* (i.e., environment
|
||||||
variable) of the [store derivation]s *paths*. It is an error for a
|
variable) of the [store derivation]s *paths*. It is an error for a
|
||||||
derivation to not have the specified attribute.
|
derivation to not have the specified attribute.
|
||||||
|
|
||||||
- `--hash`\
|
- `--hash`
|
||||||
|
|
||||||
Prints the SHA-256 hash of the contents of the store paths *paths*
|
Prints the SHA-256 hash of the contents of the store paths *paths*
|
||||||
(that is, the hash of the output of `nix-store --dump` on the given
|
(that is, the hash of the output of `nix-store --dump` on the given
|
||||||
paths). Since the hash is stored in the Nix database, this is a fast
|
paths). Since the hash is stored in the Nix database, this is a fast
|
||||||
operation.
|
operation.
|
||||||
|
|
||||||
- `--size`\
|
- `--size`
|
||||||
|
|
||||||
Prints the size in bytes of the contents of the store paths *paths*
|
Prints the size in bytes of the contents of the store paths *paths*
|
||||||
— to be precise, the size of the output of `nix-store --dump` on
|
— to be precise, the size of the output of `nix-store --dump` on
|
||||||
the given paths. Note that the actual disk space required by the
|
the given paths. Note that the actual disk space required by the
|
||||||
store paths may be higher, especially on filesystems with large
|
store paths may be higher, especially on filesystems with large
|
||||||
cluster sizes.
|
cluster sizes.
|
||||||
|
|
||||||
- `--roots`\
|
- `--roots`
|
||||||
|
|
||||||
Prints the garbage collector roots that point, directly or
|
Prints the garbage collector roots that point, directly or
|
||||||
indirectly, at the store paths *paths*.
|
indirectly, at the store paths *paths*.
|
||||||
|
|
||||||
|
|
|
@ -42,15 +42,18 @@ For non-derivation arguments, the argument itself is printed.
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
|
|
||||||
- `--dry-run`\
|
- `--dry-run`
|
||||||
|
|
||||||
Print on standard error a description of what packages would be
|
Print on standard error a description of what packages would be
|
||||||
built or downloaded, without actually performing the operation.
|
built or downloaded, without actually performing the operation.
|
||||||
|
|
||||||
- `--ignore-unknown`\
|
- `--ignore-unknown`
|
||||||
|
|
||||||
If a non-derivation path does not have a substitute, then silently
|
If a non-derivation path does not have a substitute, then silently
|
||||||
ignore it.
|
ignore it.
|
||||||
|
|
||||||
- `--check`\
|
- `--check`
|
||||||
|
|
||||||
This option allows you to check whether a derivation is
|
This option allows you to check whether a derivation is
|
||||||
deterministic. It rebuilds the specified derivation and checks
|
deterministic. It rebuilds the specified derivation and checks
|
||||||
whether the result is bitwise-identical with the existing outputs,
|
whether the result is bitwise-identical with the existing outputs,
|
||||||
|
|
|
@ -14,7 +14,8 @@ access to a restricted ssh user.
|
||||||
|
|
||||||
The following flags are available:
|
The following flags are available:
|
||||||
|
|
||||||
- `--write`\
|
- `--write`
|
||||||
|
|
||||||
Allow the connected client to request the realization of
|
Allow the connected client to request the realization of
|
||||||
derivations. In effect, this can be used to make the host act as a
|
derivations. In effect, this can be used to make the host act as a
|
||||||
remote builder.
|
remote builder.
|
||||||
|
|
|
@ -16,14 +16,16 @@ being modified by non-Nix tools, or of bugs in Nix itself.
|
||||||
|
|
||||||
This operation has the following options:
|
This operation has the following options:
|
||||||
|
|
||||||
- `--check-contents`\
|
- `--check-contents`
|
||||||
|
|
||||||
Checks that the contents of every valid store path has not been
|
Checks that the contents of every valid store path has not been
|
||||||
altered by computing a SHA-256 hash of the contents and comparing it
|
altered by computing a SHA-256 hash of the contents and comparing it
|
||||||
with the hash stored in the Nix database at build time. Paths that
|
with the hash stored in the Nix database at build time. Paths that
|
||||||
have been modified are printed out. For large stores,
|
have been modified are printed out. For large stores,
|
||||||
`--check-contents` is obviously quite slow.
|
`--check-contents` is obviously quite slow.
|
||||||
|
|
||||||
- `--repair`\
|
- `--repair`
|
||||||
|
|
||||||
If any valid path is missing from the store, or (if
|
If any valid path is missing from the store, or (if
|
||||||
`--check-contents` is given) the contents of a valid path has been
|
`--check-contents` is given) the contents of a valid path has been
|
||||||
modified, then try to repair the path by redownloading it. See
|
modified, then try to repair the path by redownloading it. See
|
||||||
|
|
|
@ -143,7 +143,7 @@ Most Nix commands accept the following command-line options:
|
||||||
|
|
||||||
This option is accepted by `nix-env`, `nix-instantiate`, `nix-shell` and `nix-build`.
|
This option is accepted by `nix-env`, `nix-instantiate`, `nix-shell` and `nix-build`.
|
||||||
When evaluating Nix expressions, the expression evaluator will automatically try to call functions that it encounters.
|
When evaluating Nix expressions, the expression evaluator will automatically try to call functions that it encounters.
|
||||||
It can automatically call functions for which every argument has a [default value](@docroot@/language/constructs.md#functions) (e.g., `{ argName ? defaultValue }: ...`).
|
It can automatically call functions for which every argument has a [default value](@docroot@/language/syntax.md#functions) (e.g., `{ argName ? defaultValue }: ...`).
|
||||||
|
|
||||||
With `--arg`, you can also call functions that have arguments without a default value (or override a default value).
|
With `--arg`, you can also call functions that have arguments without a default value (or override a default value).
|
||||||
That is, if the evaluator encounters a function with an argument named *name*, it will call it with value *value*.
|
That is, if the evaluator encounters a function with an argument named *name*, it will call it with value *value*.
|
||||||
|
|
|
@ -196,15 +196,16 @@ You can also build and view it yourself:
|
||||||
[Doxygen API documentation]: https://hydra.nixos.org/job/nix/master/internal-api-docs/latest/download-by-type/doc/internal-api-docs
|
[Doxygen API documentation]: https://hydra.nixos.org/job/nix/master/internal-api-docs/latest/download-by-type/doc/internal-api-docs
|
||||||
|
|
||||||
```console
|
```console
|
||||||
# nix build .#hydraJobs.internal-api-docs
|
$ nix build .#hydraJobs.internal-api-docs
|
||||||
# xdg-open ./result/share/doc/nix/internal-api/html/index.html
|
$ xdg-open ./result/share/doc/nix/internal-api/html/index.html
|
||||||
```
|
```
|
||||||
|
|
||||||
or inside `nix-shell` or `nix develop`:
|
or inside `nix-shell` or `nix develop`:
|
||||||
|
|
||||||
```
|
```console
|
||||||
# make internal-api-html
|
$ mesonConfigurePhase
|
||||||
# xdg-open ./outputs/doc/share/doc/nix/internal-api/html/index.html
|
$ ninja src/internal-api-docs/html
|
||||||
|
$ xdg-open src/internal-api-docs/html/index.html
|
||||||
```
|
```
|
||||||
|
|
||||||
## C API documentation
|
## C API documentation
|
||||||
|
@ -216,13 +217,14 @@ You can also build and view it yourself:
|
||||||
[C API documentation]: https://hydra.nixos.org/job/nix/master/external-api-docs/latest/download-by-type/doc/external-api-docs
|
[C API documentation]: https://hydra.nixos.org/job/nix/master/external-api-docs/latest/download-by-type/doc/external-api-docs
|
||||||
|
|
||||||
```console
|
```console
|
||||||
# nix build .#hydraJobs.external-api-docs
|
$ nix build .#hydraJobs.external-api-docs
|
||||||
# xdg-open ./result/share/doc/nix/external-api/html/index.html
|
$ xdg-open ./result/share/doc/nix/external-api/html/index.html
|
||||||
```
|
```
|
||||||
|
|
||||||
or inside `nix-shell` or `nix develop`:
|
or inside `nix-shell` or `nix develop`:
|
||||||
|
|
||||||
```
|
```
|
||||||
# make external-api-html
|
$ mesonConfigurePhase
|
||||||
# xdg-open ./outputs/doc/share/doc/nix/external-api/html/index.html
|
$ ninja src/external-api-docs/html
|
||||||
|
$ xdg-open src/external-api-docs/html/index.html
|
||||||
```
|
```
|
||||||
|
|
|
@ -122,7 +122,6 @@ Run `make` with [`-e` / `--environment-overrides`](https://www.gnu.org/software/
|
||||||
|
|
||||||
The docs can take a while to build, so you may want to disable this for local development.
|
The docs can take a while to build, so you may want to disable this for local development.
|
||||||
- `ENABLE_FUNCTIONAL_TESTS=yes` to enable building the functional tests.
|
- `ENABLE_FUNCTIONAL_TESTS=yes` to enable building the functional tests.
|
||||||
- `ENABLE_UNIT_TESTS=yes` to enable building the unit tests.
|
|
||||||
- `OPTIMIZE=1` to enable optimizations.
|
- `OPTIMIZE=1` to enable optimizations.
|
||||||
- `libraries=libutil programs=` to only build a specific library.
|
- `libraries=libutil programs=` to only build a specific library.
|
||||||
|
|
||||||
|
|
|
@ -59,15 +59,15 @@ The unit tests are defined using the [googletest] and [rapidcheck] frameworks.
|
||||||
> …
|
> …
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `tests/unit/${library_name_without-nix}`.
|
The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `src/${library_name_without-nix}-test`.
|
||||||
Given an interface (header) and implementation pair in the original library, say, `src/libexpr/value/context.{hh,cc}`, we write tests for it in `tests/unit/libexpr/tests/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `tests/unit/libexpr-support/tests/value/context.{hh,cc}`.
|
Given an interface (header) and implementation pair in the original library, say, `src/libexpr/value/context.{hh,cc}`, we write tests for it in `src/nix-expr-tests/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `src/nix-expr-test-support/tests/value/context.{hh,cc}`.
|
||||||
|
|
||||||
Data for unit tests is stored in a `data` subdir of the directory for each unit test executable.
|
Data for unit tests is stored in a `data` subdir of the directory for each unit test executable.
|
||||||
For example, `libnixstore` code is in `src/libstore`, and its test data is in `tests/unit/libstore/data`.
|
For example, `libnixstore` code is in `src/libstore`, and its test data is in `src/nix-store-tests/data`.
|
||||||
The path to the `tests/unit/data` directory is passed to the unit test executable with the environment variable `_NIX_TEST_UNIT_DATA`.
|
The path to the `src/${library_name_without-nix}-test/data` directory is passed to the unit test executable with the environment variable `_NIX_TEST_UNIT_DATA`.
|
||||||
Note that each executable only gets the data for its tests.
|
Note that each executable only gets the data for its tests.
|
||||||
|
|
||||||
The unit test libraries are in `tests/unit/${library_name_without-nix}-lib`.
|
The unit test libraries are in `src/${library_name_without-nix}-test-support`.
|
||||||
All headers are in a `tests` subdirectory so they are included with `#include "tests/"`.
|
All headers are in a `tests` subdirectory so they are included with `#include "tests/"`.
|
||||||
|
|
||||||
The use of all these separate directories for the unit tests might seem inconvenient, as for example the tests are not "right next to" the part of the code they are testing.
|
The use of all these separate directories for the unit tests might seem inconvenient, as for example the tests are not "right next to" the part of the code they are testing.
|
||||||
|
@ -76,8 +76,25 @@ there is no risk of any build-system wildcards for the library accidentally pick
|
||||||
|
|
||||||
### Running tests
|
### Running tests
|
||||||
|
|
||||||
You can run the whole testsuite with `make check`, or the tests for a specific component with `make libfoo-tests_RUN`.
|
You can run the whole testsuite with `meson test` from the Meson build directory, or the tests for a specific component with `meson test nix-store-tests`.
|
||||||
Finer-grained filtering is also possible using the [--gtest_filter](https://google.github.io/googletest/advanced.html#running-a-subset-of-the-tests) command-line option, or the `GTEST_FILTER` environment variable, e.g. `GTEST_FILTER='ErrorTraceTest.*' make check`.
|
A environment variables that Google Test accepts are also worth knowing:
|
||||||
|
|
||||||
|
1. [`GTEST_FILTER`](https://google.github.io/googletest/advanced.html#running-a-subset-of-the-tests)
|
||||||
|
|
||||||
|
This is used for finer-grained filtering of which tests to run.
|
||||||
|
|
||||||
|
|
||||||
|
2. [`GTEST_BRIEF`](https://google.github.io/googletest/advanced.html#suppressing-test-passes)
|
||||||
|
|
||||||
|
This is used to avoid logging passing tests.
|
||||||
|
|
||||||
|
Putting the two together, one might run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
GTEST_BREIF=1 GTEST_FILTER='ErrorTraceTest.*' meson test nix-expr-tests -v
|
||||||
|
```
|
||||||
|
|
||||||
|
for short but comprensive output.
|
||||||
|
|
||||||
### Characterisation testing { #characaterisation-testing-unit }
|
### Characterisation testing { #characaterisation-testing-unit }
|
||||||
|
|
||||||
|
@ -86,7 +103,7 @@ See [functional characterisation testing](#characterisation-testing-functional)
|
||||||
Like with the functional characterisation, `_NIX_TEST_ACCEPT=1` is also used.
|
Like with the functional characterisation, `_NIX_TEST_ACCEPT=1` is also used.
|
||||||
For example:
|
For example:
|
||||||
```shell-session
|
```shell-session
|
||||||
$ _NIX_TEST_ACCEPT=1 make libstore-tests_RUN
|
$ _NIX_TEST_ACCEPT=1 meson test nix-store-tests -v
|
||||||
...
|
...
|
||||||
[ SKIPPED ] WorkerProtoTest.string_read
|
[ SKIPPED ] WorkerProtoTest.string_read
|
||||||
[ SKIPPED ] WorkerProtoTest.string_write
|
[ SKIPPED ] WorkerProtoTest.string_write
|
||||||
|
@ -114,6 +131,8 @@ On other platforms they wouldn't be run at all.
|
||||||
The functional tests reside under the `tests/functional` directory and are listed in `tests/functional/local.mk`.
|
The functional tests reside under the `tests/functional` directory and are listed in `tests/functional/local.mk`.
|
||||||
Each test is a bash script.
|
Each test is a bash script.
|
||||||
|
|
||||||
|
Functional tests are run during `installCheck` in the `nix` package build, as well as separately from the build, in VM tests.
|
||||||
|
|
||||||
### Running the whole test suite
|
### Running the whole test suite
|
||||||
|
|
||||||
The whole test suite can be run with:
|
The whole test suite can be run with:
|
||||||
|
@ -252,13 +271,30 @@ Regressions are caught, and improvements always show up in code review.
|
||||||
|
|
||||||
To ensure that characterisation testing doesn't make it harder to intentionally change these interfaces, there always must be an easy way to regenerate the expected output, as we do with `_NIX_TEST_ACCEPT=1`.
|
To ensure that characterisation testing doesn't make it harder to intentionally change these interfaces, there always must be an easy way to regenerate the expected output, as we do with `_NIX_TEST_ACCEPT=1`.
|
||||||
|
|
||||||
|
### Running functional tests on NixOS
|
||||||
|
|
||||||
|
We run the functional tests not just in the build, but also in VM tests.
|
||||||
|
This helps us ensure that Nix works correctly on NixOS, and environments that have similar characteristics that are hard to reproduce in a build environment.
|
||||||
|
|
||||||
|
The recommended way to run these tests during development is:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
nix build .#hydraJobs.tests.functional_user.quickBuild
|
||||||
|
```
|
||||||
|
|
||||||
|
The `quickBuild` attribute configures the test to use a `nix` package that's built without integration tests, so that you can iterate on the tests without performing recompilations due to the changed sources for `installCheck`.
|
||||||
|
|
||||||
|
Generally, this build is sufficient, but in nightly or CI we also test the attributes `functional_root` and `functional_trusted`, in which the test suite is run with different levels of authorization.
|
||||||
|
|
||||||
## Integration tests
|
## Integration tests
|
||||||
|
|
||||||
The integration tests are defined in the Nix flake under the `hydraJobs.tests` attribute.
|
The integration tests are defined in the Nix flake under the `hydraJobs.tests` attribute.
|
||||||
These tests include everything that needs to interact with external services or run Nix in a non-trivial distributed setup.
|
These tests include everything that needs to interact with external services or run Nix in a non-trivial distributed setup.
|
||||||
Because these tests are expensive and require more than what the standard github-actions setup provides, they only run on the master branch (on <https://hydra.nixos.org/jobset/nix/master>).
|
Because these tests are expensive and require more than what the standard github-actions setup provides, they only run on the master branch (on <https://hydra.nixos.org/jobset/nix/master>).
|
||||||
|
|
||||||
You can run them manually with `nix build .#hydraJobs.tests.{testName}` or `nix-build -A hydraJobs.tests.{testName}`
|
You can run them manually with `nix build .#hydraJobs.tests.{testName}` or `nix-build -A hydraJobs.tests.{testName}`.
|
||||||
|
|
||||||
|
If you are testing a build of `nix` that you haven't compiled yet, you may iterate faster by appending the `quickBuild` attribute: `nix build .#hydraJobs.tests.{testName}.quickBuild`.
|
||||||
|
|
||||||
## Installer tests
|
## Installer tests
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@
|
||||||
|
|
||||||
- [package attribute set]{#package-attribute-set}
|
- [package attribute set]{#package-attribute-set}
|
||||||
|
|
||||||
An [attribute set](@docroot@/language/values.md#attribute-set) containing the attribute `type = "derivation";` (derivation for historical reasons), as well as other attributes, such as
|
An [attribute set](@docroot@/language/types.md#attribute-set) containing the attribute `type = "derivation";` (derivation for historical reasons), as well as other attributes, such as
|
||||||
- attributes that refer to the files of a [package], typically in the form of [derivation outputs](#output),
|
- attributes that refer to the files of a [package], typically in the form of [derivation outputs](#output),
|
||||||
- attributes that declare something about how the package is supposed to be installed or used,
|
- attributes that declare something about how the package is supposed to be installed or used,
|
||||||
- other metadata or arbitrary attributes.
|
- other metadata or arbitrary attributes.
|
||||||
|
@ -325,9 +325,9 @@
|
||||||
|
|
||||||
See [String interpolation](./language/string-interpolation.md) for details.
|
See [String interpolation](./language/string-interpolation.md) for details.
|
||||||
|
|
||||||
[string]: ./language/values.md#type-string
|
[string]: ./language/types.md#type-string
|
||||||
[path]: ./language/values.md#type-path
|
[path]: ./language/types.md#type-path
|
||||||
[attribute name]: ./language/values.md#attribute-set
|
[attribute name]: ./language/types.md#attribute-set
|
||||||
|
|
||||||
- [base directory]{#gloss-base-directory}
|
- [base directory]{#gloss-base-directory}
|
||||||
|
|
||||||
|
|
|
@ -302,6 +302,12 @@ Derivations can declare some infrequently used optional attributes.
|
||||||
(associative) arrays. For example, the attribute `hardening.format = true`
|
(associative) arrays. For example, the attribute `hardening.format = true`
|
||||||
ends up as the Bash associative array element `${hardening[format]}`.
|
ends up as the Bash associative array element `${hardening[format]}`.
|
||||||
|
|
||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> If set to `true`, other advanced attributes such as [`allowedReferences`](#adv-attr-allowedReferences), [`allowedReferences`](#adv-attr-allowedReferences), [`allowedRequisites`](#adv-attr-allowedRequisites),
|
||||||
|
[`disallowedReferences`](#adv-attr-disallowedReferences) and [`disallowedRequisites`](#adv-attr-disallowedRequisites), maxSize, and maxClosureSize.
|
||||||
|
will have no effect.
|
||||||
|
|
||||||
- [`outputChecks`]{#adv-attr-outputChecks}\
|
- [`outputChecks`]{#adv-attr-outputChecks}\
|
||||||
When using [structured attributes](#adv-attr-structuredAttrs), the `outputChecks`
|
When using [structured attributes](#adv-attr-structuredAttrs), the `outputChecks`
|
||||||
attribute allows defining checks per-output.
|
attribute allows defining checks per-output.
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# Built-in Constants
|
|
||||||
|
|
||||||
These constants are built into the Nix language evaluator:
|
|
||||||
|
|
||||||
<dl>
|
|
|
@ -1 +0,0 @@
|
||||||
</dl>
|
|
|
@ -1,9 +1,11 @@
|
||||||
# Built-in Functions
|
# Built-ins
|
||||||
|
|
||||||
This section lists the functions built into the Nix language evaluator.
|
This section lists the values and functions built into the Nix language evaluator.
|
||||||
All built-in functions are available through the global [`builtins`](./builtin-constants.md#builtins-builtins) constant.
|
All built-ins are available through the global [`builtins`](#builtins-builtins) constant.
|
||||||
|
|
||||||
For convenience, some built-ins can be accessed directly:
|
Some built-ins are also exposed directly in the global scope:
|
||||||
|
|
||||||
|
<!-- TODO(@rhendric, #10970): this list is incomplete -->
|
||||||
|
|
||||||
- [`derivation`](#builtins-derivation)
|
- [`derivation`](#builtins-derivation)
|
||||||
- [`import`](#builtins-import)
|
- [`import`](#builtins-import)
|
||||||
|
|
|
@ -1,486 +0,0 @@
|
||||||
# Language Constructs
|
|
||||||
|
|
||||||
## Recursive sets
|
|
||||||
|
|
||||||
Recursive sets are like normal [attribute sets](./values.md#attribute-set), but the attributes can refer to each other.
|
|
||||||
|
|
||||||
> *rec-attrset* = `rec {` [ *name* `=` *expr* `;` `]`... `}`
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
rec {
|
|
||||||
x = y;
|
|
||||||
y = 123;
|
|
||||||
}.x
|
|
||||||
```
|
|
||||||
|
|
||||||
This evaluates to `123`.
|
|
||||||
|
|
||||||
Note that without `rec` the binding `x = y;` would
|
|
||||||
refer to the variable `y` in the surrounding scope, if one exists, and
|
|
||||||
would be invalid if no such variable exists. That is, in a normal
|
|
||||||
(non-recursive) set, attributes are not added to the lexical scope; in a
|
|
||||||
recursive set, they are.
|
|
||||||
|
|
||||||
Recursive sets of course introduce the danger of infinite recursion. For
|
|
||||||
example, the expression
|
|
||||||
|
|
||||||
```nix
|
|
||||||
rec {
|
|
||||||
x = y;
|
|
||||||
y = x;
|
|
||||||
}.x
|
|
||||||
```
|
|
||||||
|
|
||||||
will crash with an `infinite recursion encountered` error message.
|
|
||||||
|
|
||||||
## Let-expressions
|
|
||||||
|
|
||||||
A let-expression allows you to define local variables for an expression.
|
|
||||||
|
|
||||||
> *let-in* = `let` [ *identifier* = *expr* ]... `in` *expr*
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let
|
|
||||||
x = "foo";
|
|
||||||
y = "bar";
|
|
||||||
in x + y
|
|
||||||
```
|
|
||||||
|
|
||||||
This evaluates to `"foobar"`.
|
|
||||||
|
|
||||||
## Inheriting attributes
|
|
||||||
|
|
||||||
When defining an [attribute set](./values.md#attribute-set) or in a [let-expression](#let-expressions) it is often convenient to copy variables from the surrounding lexical scope (e.g., when you want to propagate attributes).
|
|
||||||
This can be shortened using the `inherit` keyword.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let x = 123; in
|
|
||||||
{
|
|
||||||
inherit x;
|
|
||||||
y = 456;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
is equivalent to
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let x = 123; in
|
|
||||||
{
|
|
||||||
x = x;
|
|
||||||
y = 456;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
and both evaluate to `{ x = 123; y = 456; }`.
|
|
||||||
|
|
||||||
> **Note**
|
|
||||||
>
|
|
||||||
> This works because `x` is added to the lexical scope by the `let` construct.
|
|
||||||
|
|
||||||
It is also possible to inherit attributes from another attribute set.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
In this fragment from `all-packages.nix`,
|
|
||||||
|
|
||||||
```nix
|
|
||||||
graphviz = (import ../tools/graphics/graphviz) {
|
|
||||||
inherit fetchurl stdenv libpng libjpeg expat x11 yacc;
|
|
||||||
inherit (xorg) libXaw;
|
|
||||||
};
|
|
||||||
|
|
||||||
xorg = {
|
|
||||||
libX11 = ...;
|
|
||||||
libXaw = ...;
|
|
||||||
...
|
|
||||||
}
|
|
||||||
|
|
||||||
libpng = ...;
|
|
||||||
libjpg = ...;
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
the set used in the function call to the function defined in
|
|
||||||
`../tools/graphics/graphviz` inherits a number of variables from the
|
|
||||||
surrounding scope (`fetchurl` ... `yacc`), but also inherits `libXaw`
|
|
||||||
(the X Athena Widgets) from the `xorg` set.
|
|
||||||
|
|
||||||
Summarizing the fragment
|
|
||||||
|
|
||||||
```nix
|
|
||||||
...
|
|
||||||
inherit x y z;
|
|
||||||
inherit (src-set) a b c;
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
is equivalent to
|
|
||||||
|
|
||||||
```nix
|
|
||||||
...
|
|
||||||
x = x; y = y; z = z;
|
|
||||||
a = src-set.a; b = src-set.b; c = src-set.c;
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
when used while defining local variables in a let-expression or while
|
|
||||||
defining a set.
|
|
||||||
|
|
||||||
In a `let` expression, `inherit` can be used to selectively bring specific attributes of a set into scope. For example
|
|
||||||
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let
|
|
||||||
x = { a = 1; b = 2; };
|
|
||||||
inherit (builtins) attrNames;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
names = attrNames x;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
is equivalent to
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let
|
|
||||||
x = { a = 1; b = 2; };
|
|
||||||
in
|
|
||||||
{
|
|
||||||
names = builtins.attrNames x;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
both evaluate to `{ names = [ "a" "b" ]; }`.
|
|
||||||
|
|
||||||
## Functions
|
|
||||||
|
|
||||||
Functions have the following form:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
pattern: body
|
|
||||||
```
|
|
||||||
|
|
||||||
The pattern specifies what the argument of the function must look like,
|
|
||||||
and binds variables in the body to (parts of) the argument. There are
|
|
||||||
three kinds of patterns:
|
|
||||||
|
|
||||||
- If a pattern is a single identifier, then the function matches any
|
|
||||||
argument. Example:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let negate = x: !x;
|
|
||||||
concat = x: y: x + y;
|
|
||||||
in if negate true then concat "foo" "bar" else ""
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that `concat` is a function that takes one argument and returns
|
|
||||||
a function that takes another argument. This allows partial
|
|
||||||
parameterisation (i.e., only filling some of the arguments of a
|
|
||||||
function); e.g.,
|
|
||||||
|
|
||||||
```nix
|
|
||||||
map (concat "foo") [ "bar" "bla" "abc" ]
|
|
||||||
```
|
|
||||||
|
|
||||||
evaluates to `[ "foobar" "foobla" "fooabc" ]`.
|
|
||||||
|
|
||||||
- A *set pattern* of the form `{ name1, name2, …, nameN }` matches a
|
|
||||||
set containing the listed attributes, and binds the values of those
|
|
||||||
attributes to variables in the function body. For example, the
|
|
||||||
function
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{ x, y, z }: z + y + x
|
|
||||||
```
|
|
||||||
|
|
||||||
can only be called with a set containing exactly the attributes `x`,
|
|
||||||
`y` and `z`. No other attributes are allowed. If you want to allow
|
|
||||||
additional arguments, you can use an ellipsis (`...`):
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{ x, y, z, ... }: z + y + x
|
|
||||||
```
|
|
||||||
|
|
||||||
This works on any set that contains at least the three named
|
|
||||||
attributes.
|
|
||||||
|
|
||||||
It is possible to provide *default values* for attributes, in
|
|
||||||
which case they are allowed to be missing. A default value is
|
|
||||||
specified by writing `name ? e`, where *e* is an arbitrary
|
|
||||||
expression. For example,
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{ x, y ? "foo", z ? "bar" }: z + y + x
|
|
||||||
```
|
|
||||||
|
|
||||||
specifies a function that only requires an attribute named `x`, but
|
|
||||||
optionally accepts `y` and `z`.
|
|
||||||
|
|
||||||
- An `@`-pattern provides a means of referring to the whole value
|
|
||||||
being matched:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
args@{ x, y, z, ... }: z + y + x + args.a
|
|
||||||
```
|
|
||||||
|
|
||||||
but can also be written as:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{ x, y, z, ... } @ args: z + y + x + args.a
|
|
||||||
```
|
|
||||||
|
|
||||||
Here `args` is bound to the argument *as passed*, which is further
|
|
||||||
matched against the pattern `{ x, y, z, ... }`.
|
|
||||||
The `@`-pattern makes mainly sense with an ellipsis(`...`) as
|
|
||||||
you can access attribute names as `a`, using `args.a`, which was
|
|
||||||
given as an additional attribute to the function.
|
|
||||||
|
|
||||||
> **Warning**
|
|
||||||
>
|
|
||||||
> `args@` binds the name `args` to the attribute set that is passed to the function.
|
|
||||||
> In particular, `args` does *not* include any default values specified with `?` in the function's set pattern.
|
|
||||||
>
|
|
||||||
> For instance
|
|
||||||
>
|
|
||||||
> ```nix
|
|
||||||
> let
|
|
||||||
> f = args@{ a ? 23, ... }: [ a args ];
|
|
||||||
> in
|
|
||||||
> f {}
|
|
||||||
> ```
|
|
||||||
>
|
|
||||||
> is equivalent to
|
|
||||||
>
|
|
||||||
> ```nix
|
|
||||||
> let
|
|
||||||
> f = args @ { ... }: [ (args.a or 23) args ];
|
|
||||||
> in
|
|
||||||
> f {}
|
|
||||||
> ```
|
|
||||||
>
|
|
||||||
> and both expressions will evaluate to:
|
|
||||||
>
|
|
||||||
> ```nix
|
|
||||||
> [ 23 {} ]
|
|
||||||
> ```
|
|
||||||
|
|
||||||
Note that functions do not have names. If you want to give them a name,
|
|
||||||
you can bind them to an attribute, e.g.,
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let concat = { x, y }: x + y;
|
|
||||||
in concat { x = "foo"; y = "bar"; }
|
|
||||||
```
|
|
||||||
|
|
||||||
## Conditionals
|
|
||||||
|
|
||||||
Conditionals look like this:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
if e1 then e2 else e3
|
|
||||||
```
|
|
||||||
|
|
||||||
where *e1* is an expression that should evaluate to a Boolean value
|
|
||||||
(`true` or `false`).
|
|
||||||
|
|
||||||
## Assertions
|
|
||||||
|
|
||||||
Assertions are generally used to check that certain requirements on or
|
|
||||||
between features and dependencies hold. They look like this:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
assert e1; e2
|
|
||||||
```
|
|
||||||
|
|
||||||
where *e1* is an expression that should evaluate to a Boolean value. If
|
|
||||||
it evaluates to `true`, *e2* is returned; otherwise expression
|
|
||||||
evaluation is aborted and a backtrace is printed.
|
|
||||||
|
|
||||||
Here is a Nix expression for the Subversion package that shows how
|
|
||||||
assertions can be used:.
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{ localServer ? false
|
|
||||||
, httpServer ? false
|
|
||||||
, sslSupport ? false
|
|
||||||
, pythonBindings ? false
|
|
||||||
, javaSwigBindings ? false
|
|
||||||
, javahlBindings ? false
|
|
||||||
, stdenv, fetchurl
|
|
||||||
, openssl ? null, httpd ? null, db4 ? null, expat, swig ? null, j2sdk ? null
|
|
||||||
}:
|
|
||||||
|
|
||||||
assert localServer -> db4 != null; ①
|
|
||||||
assert httpServer -> httpd != null && httpd.expat == expat; ②
|
|
||||||
assert sslSupport -> openssl != null && (httpServer -> httpd.openssl == openssl); ③
|
|
||||||
assert pythonBindings -> swig != null && swig.pythonSupport;
|
|
||||||
assert javaSwigBindings -> swig != null && swig.javaSupport;
|
|
||||||
assert javahlBindings -> j2sdk != null;
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "subversion-1.1.1";
|
|
||||||
...
|
|
||||||
openssl = if sslSupport then openssl else null; ④
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The points of interest are:
|
|
||||||
|
|
||||||
1. This assertion states that if Subversion is to have support for
|
|
||||||
local repositories, then Berkeley DB is needed. So if the Subversion
|
|
||||||
function is called with the `localServer` argument set to `true` but
|
|
||||||
the `db4` argument set to `null`, then the evaluation fails.
|
|
||||||
|
|
||||||
Note that `->` is the [logical
|
|
||||||
implication](https://en.wikipedia.org/wiki/Truth_table#Logical_implication)
|
|
||||||
Boolean operation.
|
|
||||||
|
|
||||||
2. This is a more subtle condition: if Subversion is built with Apache
|
|
||||||
(`httpServer`) support, then the Expat library (an XML library) used
|
|
||||||
by Subversion should be same as the one used by Apache. This is
|
|
||||||
because in this configuration Subversion code ends up being linked
|
|
||||||
with Apache code, and if the Expat libraries do not match, a build-
|
|
||||||
or runtime link error or incompatibility might occur.
|
|
||||||
|
|
||||||
3. This assertion says that in order for Subversion to have SSL support
|
|
||||||
(so that it can access `https` URLs), an OpenSSL library must be
|
|
||||||
passed. Additionally, it says that *if* Apache support is enabled,
|
|
||||||
then Apache's OpenSSL should match Subversion's. (Note that if
|
|
||||||
Apache support is not enabled, we don't care about Apache's
|
|
||||||
OpenSSL.)
|
|
||||||
|
|
||||||
4. The conditional here is not really related to assertions, but is
|
|
||||||
worth pointing out: it ensures that if SSL support is disabled, then
|
|
||||||
the Subversion derivation is not dependent on OpenSSL, even if a
|
|
||||||
non-`null` value was passed. This prevents an unnecessary rebuild of
|
|
||||||
Subversion if OpenSSL changes.
|
|
||||||
|
|
||||||
## With-expressions
|
|
||||||
|
|
||||||
A *with-expression*,
|
|
||||||
|
|
||||||
```nix
|
|
||||||
with e1; e2
|
|
||||||
```
|
|
||||||
|
|
||||||
introduces the set *e1* into the lexical scope of the expression *e2*.
|
|
||||||
For instance,
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let as = { x = "foo"; y = "bar"; };
|
|
||||||
in with as; x + y
|
|
||||||
```
|
|
||||||
|
|
||||||
evaluates to `"foobar"` since the `with` adds the `x` and `y` attributes
|
|
||||||
of `as` to the lexical scope in the expression `x + y`. The most common
|
|
||||||
use of `with` is in conjunction with the `import` function. E.g.,
|
|
||||||
|
|
||||||
```nix
|
|
||||||
with (import ./definitions.nix); ...
|
|
||||||
```
|
|
||||||
|
|
||||||
makes all attributes defined in the file `definitions.nix` available as
|
|
||||||
if they were defined locally in a `let`-expression.
|
|
||||||
|
|
||||||
The bindings introduced by `with` do not shadow bindings introduced by
|
|
||||||
other means, e.g.
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let a = 3; in with { a = 1; }; let a = 4; in with { a = 2; }; ...
|
|
||||||
```
|
|
||||||
|
|
||||||
establishes the same scope as
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let a = 1; in let a = 2; in let a = 3; in let a = 4; in ...
|
|
||||||
```
|
|
||||||
|
|
||||||
Variables coming from outer `with` expressions *are* shadowed:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
with { a = "outer"; };
|
|
||||||
with { a = "inner"; };
|
|
||||||
a
|
|
||||||
```
|
|
||||||
|
|
||||||
Does evaluate to `"inner"`.
|
|
||||||
|
|
||||||
## Comments
|
|
||||||
|
|
||||||
- Inline comments start with `#` and run until the end of the line.
|
|
||||||
|
|
||||||
> **Example**
|
|
||||||
>
|
|
||||||
> ```nix
|
|
||||||
> # A number
|
|
||||||
> 2 # Equals 1 + 1
|
|
||||||
> ```
|
|
||||||
>
|
|
||||||
> ```console
|
|
||||||
> 2
|
|
||||||
> ```
|
|
||||||
|
|
||||||
- Block comments start with `/*` and run until the next occurrence of `*/`.
|
|
||||||
|
|
||||||
> **Example**
|
|
||||||
>
|
|
||||||
> ```nix
|
|
||||||
> /*
|
|
||||||
> Block comments
|
|
||||||
> can span multiple lines.
|
|
||||||
> */ "hello"
|
|
||||||
> ```
|
|
||||||
>
|
|
||||||
> ```console
|
|
||||||
> "hello"
|
|
||||||
> ```
|
|
||||||
|
|
||||||
This means that block comments cannot be nested.
|
|
||||||
|
|
||||||
> **Example**
|
|
||||||
>
|
|
||||||
> ```nix
|
|
||||||
> /* /* nope */ */ 1
|
|
||||||
> ```
|
|
||||||
>
|
|
||||||
> ```console
|
|
||||||
> error: syntax error, unexpected '*'
|
|
||||||
>
|
|
||||||
> at «string»:1:15:
|
|
||||||
>
|
|
||||||
> 1| /* /* nope */ *
|
|
||||||
> | ^
|
|
||||||
> ```
|
|
||||||
|
|
||||||
Consider escaping nested comments and unescaping them in post-processing.
|
|
||||||
|
|
||||||
> **Example**
|
|
||||||
>
|
|
||||||
> ```nix
|
|
||||||
> /* /* nested *\/ */ 1
|
|
||||||
> ```
|
|
||||||
>
|
|
||||||
> ```console
|
|
||||||
> 1
|
|
||||||
> ```
|
|
||||||
|
|
||||||
## Scoping rules
|
|
||||||
|
|
||||||
Nix is [statically scoped](https://en.wikipedia.org/wiki/Scope_(computer_science)#Lexical_scope), but with multiple scopes and shadowing rules.
|
|
||||||
|
|
||||||
* primary scope --- explicitly-bound variables
|
|
||||||
* [`let`](#let-expressions)
|
|
||||||
* [`inherit`](#inheriting-attributes)
|
|
||||||
* function arguments
|
|
||||||
|
|
||||||
* secondary scope --- implicitly-bound variables
|
|
||||||
* [`with`](#with-expressions)
|
|
||||||
Primary scope takes precedence over secondary scope.
|
|
||||||
See [`with`](#with-expressions) for a detailed example.
|
|
|
@ -4,9 +4,9 @@
|
||||||
>
|
>
|
||||||
> *lookup-path* = `<` *identifier* [ `/` *identifier* ]... `>`
|
> *lookup-path* = `<` *identifier* [ `/` *identifier* ]... `>`
|
||||||
|
|
||||||
A lookup path is an identifier with an optional path suffix that resolves to a [path value](@docroot@/language/values.md#type-path) if the identifier matches a search path entry.
|
A lookup path is an identifier with an optional path suffix that resolves to a [path value](@docroot@/language/types.md#type-path) if the identifier matches a search path entry.
|
||||||
|
|
||||||
The value of a lookup path is determined by [`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath).
|
The value of a lookup path is determined by [`builtins.nixPath`](@docroot@/language/builtins.md#builtins-nixPath).
|
||||||
|
|
||||||
See [`builtins.findFile`](@docroot@/language/builtins.md#builtins-findFile) for details on lookup path resolution.
|
See [`builtins.findFile`](@docroot@/language/builtins.md#builtins-findFile) for details on lookup path resolution.
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ It outputs an attribute set, and produces a [store derivation] as a side effect
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
||||||
- [`name`]{#attr-name} ([String](@docroot@/language/values.md#type-string))
|
- [`name`]{#attr-name} ([String](@docroot@/language/types.md#type-string))
|
||||||
|
|
||||||
A symbolic name for the derivation.
|
A symbolic name for the derivation.
|
||||||
It is added to the [store path] of the corresponding [store derivation] as well as to its [output paths](@docroot@/glossary.md#gloss-output-path).
|
It is added to the [store path] of the corresponding [store derivation] as well as to its [output paths](@docroot@/glossary.md#gloss-output-path).
|
||||||
|
@ -31,7 +31,7 @@ It outputs an attribute set, and produces a [store derivation] as a side effect
|
||||||
> The store derivation's path will be `/nix/store/<hash>-hello.drv`.
|
> The store derivation's path will be `/nix/store/<hash>-hello.drv`.
|
||||||
> The [output](#attr-outputs) paths will be of the form `/nix/store/<hash>-hello[-<output>]`
|
> The [output](#attr-outputs) paths will be of the form `/nix/store/<hash>-hello[-<output>]`
|
||||||
|
|
||||||
- [`system`]{#attr-system} ([String](@docroot@/language/values.md#type-string))
|
- [`system`]{#attr-system} ([String](@docroot@/language/types.md#type-string))
|
||||||
|
|
||||||
The system type on which the [`builder`](#attr-builder) executable is meant to be run.
|
The system type on which the [`builder`](#attr-builder) executable is meant to be run.
|
||||||
|
|
||||||
|
@ -64,9 +64,9 @@ It outputs an attribute set, and produces a [store derivation] as a side effect
|
||||||
> }
|
> }
|
||||||
> ```
|
> ```
|
||||||
>
|
>
|
||||||
> [`builtins.currentSystem`](@docroot@/language/builtin-constants.md#builtins-currentSystem) has the value of the [`system` configuration option], and defaults to the system type of the current Nix installation.
|
> [`builtins.currentSystem`](@docroot@/language/builtins.md#builtins-currentSystem) has the value of the [`system` configuration option], and defaults to the system type of the current Nix installation.
|
||||||
|
|
||||||
- [`builder`]{#attr-builder} ([Path](@docroot@/language/values.md#type-path) | [String](@docroot@/language/values.md#type-string))
|
- [`builder`]{#attr-builder} ([Path](@docroot@/language/types.md#type-path) | [String](@docroot@/language/types.md#type-string))
|
||||||
|
|
||||||
Path to an executable that will perform the build.
|
Path to an executable that will perform the build.
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ It outputs an attribute set, and produces a [store derivation] as a side effect
|
||||||
|
|
||||||
### Optional
|
### Optional
|
||||||
|
|
||||||
- [`args`]{#attr-args} ([List](@docroot@/language/values.md#list) of [String](@docroot@/language/values.md#type-string))
|
- [`args`]{#attr-args} ([List](@docroot@/language/types.md#list) of [String](@docroot@/language/types.md#type-string))
|
||||||
|
|
||||||
Default: `[ ]`
|
Default: `[ ]`
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ It outputs an attribute set, and produces a [store derivation] as a side effect
|
||||||
> };
|
> };
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
- [`outputs`]{#attr-outputs} ([List](@docroot@/language/values.md#list) of [String](@docroot@/language/values.md#type-string))
|
- [`outputs`]{#attr-outputs} ([List](@docroot@/language/types.md#list) of [String](@docroot@/language/types.md#type-string))
|
||||||
|
|
||||||
Default: `[ "out" ]`
|
Default: `[ "out" ]`
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ This is an incomplete overview of language features, by example.
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
|
|
||||||
*Basic values ([primitives](@docroot@/language/values.md#primitives))*
|
*Basic values ([primitives](@docroot@/language/types.md#primitives))*
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
@ -71,7 +71,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [string](@docroot@/language/values.md#type-string)
|
A [string](@docroot@/language/types.md#type-string)
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -102,7 +102,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [comment](@docroot@/language/constructs.md#comments).
|
A [comment](@docroot@/language/syntax.md#comments).
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -130,7 +130,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
[Booleans](@docroot@/language/values.md#type-boolean)
|
[Booleans](@docroot@/language/types.md#type-boolean)
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -142,7 +142,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
[Null](@docroot@/language/values.md#type-null) value
|
[Null](@docroot@/language/types.md#type-null) value
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -154,7 +154,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
An [integer](@docroot@/language/values.md#type-number)
|
An [integer](@docroot@/language/types.md#type-int)
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -166,7 +166,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [floating point number](@docroot@/language/values.md#type-number)
|
A [floating point number](@docroot@/language/types.md#type-float)
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -178,7 +178,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
An absolute [path](@docroot@/language/values.md#type-path)
|
An absolute [path](@docroot@/language/types.md#type-path)
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -190,7 +190,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [path](@docroot@/language/values.md#type-path) relative to the file containing this Nix expression
|
A [path](@docroot@/language/types.md#type-path) relative to the file containing this Nix expression
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -202,7 +202,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A home [path](@docroot@/language/values.md#type-path). Evaluates to the `"<user's home directory>/.config"`.
|
A home [path](@docroot@/language/types.md#type-path). Evaluates to the `"<user's home directory>/.config"`.
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -238,7 +238,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
An [attribute set](@docroot@/language/values.md#attribute-set) with attributes named `x` and `y`
|
An [attribute set](@docroot@/language/types.md#attribute-set) with attributes named `x` and `y`
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -262,7 +262,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [recursive set](@docroot@/language/constructs.md#recursive-sets), equivalent to `{ x = "foo"; y = "foobar"; }`.
|
A [recursive set](@docroot@/language/syntax.md#recursive-sets), equivalent to `{ x = "foo"; y = "foobar"; }`.
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -278,7 +278,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
[Lists](@docroot@/language/values.md#list) with three elements.
|
[Lists](@docroot@/language/types.md#list) with three elements.
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -362,7 +362,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
[Attribute selection](@docroot@/language/values.md#attribute-set) (evaluates to `1`)
|
[Attribute selection](@docroot@/language/types.md#attribute-set) (evaluates to `1`)
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -374,7 +374,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
[Attribute selection](@docroot@/language/values.md#attribute-set) with default (evaluates to `3`)
|
[Attribute selection](@docroot@/language/types.md#attribute-set) with default (evaluates to `3`)
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -410,7 +410,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
[Conditional expression](@docroot@/language/constructs.md#conditionals).
|
[Conditional expression](@docroot@/language/syntax.md#conditionals).
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -422,7 +422,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
[Assertion](@docroot@/language/constructs.md#assertions) check (evaluates to `"yes!"`).
|
[Assertion](@docroot@/language/syntax.md#assertions) check (evaluates to `"yes!"`).
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -434,7 +434,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
Variable definition. See [`let`-expressions](@docroot@/language/constructs.md#let-expressions).
|
Variable definition. See [`let`-expressions](@docroot@/language/syntax.md#let-expressions).
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -448,7 +448,7 @@ This is an incomplete overview of language features, by example.
|
||||||
|
|
||||||
Add all attributes from the given set to the scope (evaluates to `1`).
|
Add all attributes from the given set to the scope (evaluates to `1`).
|
||||||
|
|
||||||
See [`with`-expressions](@docroot@/language/constructs.md#with-expressions) for details and shadowing caveats.
|
See [`with`-expressions](@docroot@/language/syntax.md#with-expressions) for details and shadowing caveats.
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -462,7 +462,7 @@ This is an incomplete overview of language features, by example.
|
||||||
|
|
||||||
Adds the variables to the current scope (attribute set or `let` binding).
|
Adds the variables to the current scope (attribute set or `let` binding).
|
||||||
Desugars to `pkgs = pkgs; src = src;`.
|
Desugars to `pkgs = pkgs; src = src;`.
|
||||||
See [Inheriting attributes](@docroot@/language/constructs.md#inheriting-attributes).
|
See [Inheriting attributes](@docroot@/language/syntax.md#inheriting-attributes).
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -476,14 +476,14 @@ This is an incomplete overview of language features, by example.
|
||||||
|
|
||||||
Adds the attributes, from the attribute set in parentheses, to the current scope (attribute set or `let` binding).
|
Adds the attributes, from the attribute set in parentheses, to the current scope (attribute set or `let` binding).
|
||||||
Desugars to `lib = pkgs.lib; stdenv = pkgs.stdenv;`.
|
Desugars to `lib = pkgs.lib; stdenv = pkgs.stdenv;`.
|
||||||
See [Inheriting attributes](@docroot@/language/constructs.md#inheriting-attributes).
|
See [Inheriting attributes](@docroot@/language/syntax.md#inheriting-attributes).
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
*[Functions](@docroot@/language/constructs.md#functions) (lambdas)*
|
*[Functions](@docroot@/language/syntax.md#functions) (lambdas)*
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -500,7 +500,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [function](@docroot@/language/constructs.md#functions) that expects an integer and returns it increased by 1.
|
A [function](@docroot@/language/syntax.md#functions) that expects an integer and returns it increased by 1.
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -512,7 +512,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
Curried [function](@docroot@/language/constructs.md#functions), equivalent to `x: (y: x + y)`. Can be used like a function that takes two arguments and returns their sum.
|
Curried [function](@docroot@/language/syntax.md#functions), equivalent to `x: (y: x + y)`. Can be used like a function that takes two arguments and returns their sum.
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -524,7 +524,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [function](@docroot@/language/constructs.md#functions) call (evaluates to 101)
|
A [function](@docroot@/language/syntax.md#functions) call (evaluates to 101)
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -536,7 +536,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [function](@docroot@/language/constructs.md#functions) bound to a variable and subsequently called by name (evaluates to 103)
|
A [function](@docroot@/language/syntax.md#functions) bound to a variable and subsequently called by name (evaluates to 103)
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -548,7 +548,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [function](@docroot@/language/constructs.md#functions) that expects a set with required attributes `x` and `y` and concatenates them
|
A [function](@docroot@/language/syntax.md#functions) that expects a set with required attributes `x` and `y` and concatenates them
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -560,7 +560,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [function](@docroot@/language/constructs.md#functions) that expects a set with required attribute `x` and optional `y`, using `"bar"` as default value for `y`
|
A [function](@docroot@/language/syntax.md#functions) that expects a set with required attribute `x` and optional `y`, using `"bar"` as default value for `y`
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -572,7 +572,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [function](@docroot@/language/constructs.md#functions) that expects a set with required attributes `x` and `y` and ignores any other attributes
|
A [function](@docroot@/language/syntax.md#functions) that expects a set with required attributes `x` and `y` and ignores any other attributes
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -586,7 +586,7 @@ This is an incomplete overview of language features, by example.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
A [function](@docroot@/language/constructs.md#functions) that expects a set with required attributes `x` and `y`, and binds the whole set to `args`
|
A [function](@docroot@/language/syntax.md#functions) that expects a set with required attributes `x` and `y`, and binds the whole set to `args`
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -27,11 +27,11 @@
|
||||||
| Logical disjunction (`OR`) | *bool* <code>\|\|</code> *bool* | left | 13 |
|
| Logical disjunction (`OR`) | *bool* <code>\|\|</code> *bool* | left | 13 |
|
||||||
| [Logical implication] | *bool* `->` *bool* | right | 14 |
|
| [Logical implication] | *bool* `->` *bool* | right | 14 |
|
||||||
|
|
||||||
[string]: ./values.md#type-string
|
[string]: ./types.md#type-string
|
||||||
[path]: ./values.md#type-path
|
[path]: ./types.md#type-path
|
||||||
[number]: ./values.md#type-number
|
[number]: ./types.md#type-float <!-- TODO(@rhendric, #10970): rationalize this -->
|
||||||
[list]: ./values.md#list
|
[list]: ./types.md#list
|
||||||
[attribute set]: ./values.md#attribute-set
|
[attribute set]: ./types.md#attribute-set
|
||||||
|
|
||||||
## Attribute selection
|
## Attribute selection
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
Select the attribute denoted by attribute path *attrpath* from [attribute set] *attrset*.
|
Select the attribute denoted by attribute path *attrpath* from [attribute set] *attrset*.
|
||||||
If the attribute doesn’t exist, return the *expr* after `or` if provided, otherwise abort evaluation.
|
If the attribute doesn’t exist, return the *expr* after `or` if provided, otherwise abort evaluation.
|
||||||
|
|
||||||
An attribute path is a dot-separated list of [attribute names](./values.md#attribute-set).
|
An attribute path is a dot-separated list of [attribute names](./types.md#attribute-set).
|
||||||
|
|
||||||
> **Syntax**
|
> **Syntax**
|
||||||
>
|
>
|
||||||
|
@ -61,7 +61,7 @@ The result is a [Boolean] value.
|
||||||
|
|
||||||
See also: [`builtins.hasAttr`](@docroot@/language/builtins.md#builtins-hasAttr)
|
See also: [`builtins.hasAttr`](@docroot@/language/builtins.md#builtins-hasAttr)
|
||||||
|
|
||||||
[Boolean]: ./values.md#type-boolean
|
[Boolean]: ./types.md#type-boolean
|
||||||
|
|
||||||
[Has attribute]: #has-attribute
|
[Has attribute]: #has-attribute
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ All comparison operators are implemented in terms of `<`, and the following equi
|
||||||
- Numbers are type-compatible, see [arithmetic] operators.
|
- Numbers are type-compatible, see [arithmetic] operators.
|
||||||
- Floating point numbers only differ up to a limited precision.
|
- Floating point numbers only differ up to a limited precision.
|
||||||
|
|
||||||
[function]: ./constructs.md#functions
|
[function]: ./syntax.md#functions
|
||||||
|
|
||||||
[Equality]: #equality
|
[Equality]: #equality
|
||||||
|
|
||||||
|
|
14
doc/manual/src/language/scope.md
Normal file
14
doc/manual/src/language/scope.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Scoping rules
|
||||||
|
|
||||||
|
Nix is [statically scoped](https://en.wikipedia.org/wiki/Scope_(computer_science)#Lexical_scope), but with multiple scopes and shadowing rules.
|
||||||
|
|
||||||
|
* primary scope: explicitly-bound variables
|
||||||
|
* [`let`](./syntax.md#let-expressions)
|
||||||
|
* [`inherit`](./syntax.md#inheriting-attributes)
|
||||||
|
* [function](./syntax.md#functions) arguments
|
||||||
|
|
||||||
|
* secondary scope: implicitly-bound variables
|
||||||
|
* [`with`](./syntax.md#with-expressions)
|
||||||
|
|
||||||
|
Primary scope takes precedence over secondary scope.
|
||||||
|
See [`with`](./syntax.md#with-expressions) for a detailed example.
|
|
@ -111,7 +111,7 @@ It creates an [attribute set] representing the string context, which can be insp
|
||||||
|
|
||||||
[`builtins.hasContext`]: ./builtins.md#builtins-hasContext
|
[`builtins.hasContext`]: ./builtins.md#builtins-hasContext
|
||||||
[`builtins.getContext`]: ./builtins.md#builtins-getContext
|
[`builtins.getContext`]: ./builtins.md#builtins-getContext
|
||||||
[attribute set]: ./values.md#attribute-set
|
[attribute set]: ./types.md#attribute-set
|
||||||
|
|
||||||
## Clearing string contexts
|
## Clearing string contexts
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ String interpolation is a language feature where a [string], [path], or [attribu
|
||||||
|
|
||||||
Such a construct is called *interpolated string*, and the expression inside is an [interpolated expression](#interpolated-expression).
|
Such a construct is called *interpolated string*, and the expression inside is an [interpolated expression](#interpolated-expression).
|
||||||
|
|
||||||
[string]: ./values.md#type-string
|
[string]: ./types.md#type-string
|
||||||
[path]: ./values.md#type-path
|
[path]: ./types.md#type-path
|
||||||
[attribute set]: ./values.md#attribute-set
|
[attribute set]: ./types.md#attribute-set
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
@ -43,6 +43,47 @@ configureFlags = "
|
||||||
Note that Nix expressions and strings can be arbitrarily nested;
|
Note that Nix expressions and strings can be arbitrarily nested;
|
||||||
in this case the outer string contains various interpolated expressions that themselves contain strings (e.g., `"-thread"`), some of which in turn contain interpolated expressions (e.g., `${mesa}`).
|
in this case the outer string contains various interpolated expressions that themselves contain strings (e.g., `"-thread"`), some of which in turn contain interpolated expressions (e.g., `${mesa}`).
|
||||||
|
|
||||||
|
To write a literal `${` in an regular string, escape it with a backslash (`\`).
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> "echo \${PATH}"
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "echo ${PATH}"
|
||||||
|
|
||||||
|
To write a literal `${` in an indented string, escape it with two single quotes (`''`).
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> ''
|
||||||
|
> echo ''${PATH}
|
||||||
|
> ''
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "echo ${PATH}\n"
|
||||||
|
|
||||||
|
`$${` can be written literally in any string.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> In Make, `$` in file names or recipes is represented as `$$`, see [GNU `make`: Basics of Variable Reference](https://www.gnu.org/software/make/manual/html_node/Reference.html#Basics-of-Variable-References).
|
||||||
|
> This can be expressed directly in the Nix language strings:
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> ''
|
||||||
|
> MAKEVAR = Hello
|
||||||
|
> all:
|
||||||
|
> @export BASHVAR=world; echo $(MAKEVAR) $${BASHVAR}
|
||||||
|
> ''
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "MAKEVAR = Hello\nall:\n\t@export BASHVAR=world; echo $(MAKEVAR) $\${BASHVAR}\n"
|
||||||
|
|
||||||
|
See the [documentation on strings][string] for details.
|
||||||
|
|
||||||
### Path
|
### Path
|
||||||
|
|
||||||
Rather than writing
|
Rather than writing
|
||||||
|
|
841
doc/manual/src/language/syntax.md
Normal file
841
doc/manual/src/language/syntax.md
Normal file
|
@ -0,0 +1,841 @@
|
||||||
|
# Language Constructs
|
||||||
|
|
||||||
|
This section covers syntax and semantics of the Nix language.
|
||||||
|
|
||||||
|
## Basic Literals
|
||||||
|
|
||||||
|
### String {#string-literal}
|
||||||
|
|
||||||
|
*Strings* can be written in three ways.
|
||||||
|
|
||||||
|
The most common way is to enclose the string between double quotes, e.g., `"foo bar"`.
|
||||||
|
Strings can span multiple lines.
|
||||||
|
The results of other expressions can be included into a string by enclosing them in `${ }`, a feature known as [string interpolation].
|
||||||
|
|
||||||
|
[string interpolation]: ./string-interpolation.md
|
||||||
|
|
||||||
|
The following must be escaped to represent them within a string, by prefixing with a backslash (`\`):
|
||||||
|
|
||||||
|
- Double quote (`"`)
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> "\""
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "\""
|
||||||
|
|
||||||
|
- Backslash (`\`)
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> "\\"
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "\\"
|
||||||
|
|
||||||
|
- Dollar sign followed by an opening curly bracket (`${`) – "dollar-curly"
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> "\${"
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "\${"
|
||||||
|
|
||||||
|
The newline, carriage return, and tab characters can be written as `\n`, `\r` and `\t`, respectively.
|
||||||
|
|
||||||
|
A "double-dollar-curly" (`$${`) can be written literally.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> "$${"
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "$\${"
|
||||||
|
|
||||||
|
String values are output on the terminal with Nix-specific escaping.
|
||||||
|
Strings written to files will contain the characters encoded by the escaping.
|
||||||
|
|
||||||
|
The second way to write string literals is as an *indented string*, which is enclosed between pairs of *double single-quotes* (`''`), like so:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
''
|
||||||
|
This is the first line.
|
||||||
|
This is the second line.
|
||||||
|
This is the third line.
|
||||||
|
''
|
||||||
|
```
|
||||||
|
|
||||||
|
This kind of string literal intelligently strips indentation from
|
||||||
|
the start of each line. To be precise, it strips from each line a
|
||||||
|
number of spaces equal to the minimal indentation of the string as a
|
||||||
|
whole (disregarding the indentation of empty lines). For instance,
|
||||||
|
the first and second line are indented two spaces, while the third
|
||||||
|
line is indented four spaces. Thus, two spaces are stripped from
|
||||||
|
each line, so the resulting string is
|
||||||
|
|
||||||
|
```nix
|
||||||
|
"This is the first line.\nThis is the second line.\n This is the third line.\n"
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
>
|
||||||
|
> Whitespace and newline following the opening `''` is ignored if there is no non-whitespace text on the initial line.
|
||||||
|
|
||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> Prefixed tab characters are not stripped.
|
||||||
|
>
|
||||||
|
> > **Example**
|
||||||
|
> >
|
||||||
|
> > The following indented string is prefixed with tabs:
|
||||||
|
> >
|
||||||
|
> > ''
|
||||||
|
> > all:
|
||||||
|
> > @echo hello
|
||||||
|
> > ''
|
||||||
|
> >
|
||||||
|
> > "\tall:\n\t\t@echo hello\n"
|
||||||
|
|
||||||
|
Indented strings support [string interpolation].
|
||||||
|
|
||||||
|
The following must be escaped to represent them in an indented string:
|
||||||
|
|
||||||
|
- `$` is escaped by prefixing it with two single quotes (`''`)
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> ''
|
||||||
|
> ''$
|
||||||
|
> ''
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "$\n"
|
||||||
|
|
||||||
|
- `''` is escaped by prefixing it with one single quote (`'`)
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> ''
|
||||||
|
> '''
|
||||||
|
> ''
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "''\n"
|
||||||
|
|
||||||
|
These special characters are escaped as follows:
|
||||||
|
- Linefeed (`\n`): `''\n`
|
||||||
|
- Carriage return (`\r`): `''\r`
|
||||||
|
- Tab (`\t`): `''\t`
|
||||||
|
|
||||||
|
`''\` escapes any other character.
|
||||||
|
|
||||||
|
A "double-dollar-curly" (`$${`) can be written literally.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> ''
|
||||||
|
> $${
|
||||||
|
> ''
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> "$\${\n"
|
||||||
|
|
||||||
|
Indented strings are primarily useful in that they allow multi-line
|
||||||
|
string literals to follow the indentation of the enclosing Nix
|
||||||
|
expression, and that less escaping is typically necessary for
|
||||||
|
strings representing languages such as shell scripts and
|
||||||
|
configuration files because `''` is much less common than `"`.
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
...
|
||||||
|
postInstall =
|
||||||
|
''
|
||||||
|
mkdir $out/bin $out/etc
|
||||||
|
cp foo $out/bin
|
||||||
|
echo "Hello World" > $out/etc/foo.conf
|
||||||
|
${if enableBar then "cp bar $out/bin" else ""}
|
||||||
|
'';
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, as a convenience, *URIs* as defined in appendix B of
|
||||||
|
[RFC 2396](http://www.ietf.org/rfc/rfc2396.txt) can be written *as
|
||||||
|
is*, without quotes. For instance, the string
|
||||||
|
`"http://example.org/foo.tar.bz2"` can also be written as
|
||||||
|
`http://example.org/foo.tar.bz2`.
|
||||||
|
|
||||||
|
### Number {#number-literal}
|
||||||
|
|
||||||
|
<!-- TODO(@rhendric, #10970): split this into int and float -->
|
||||||
|
|
||||||
|
Numbers, which can be *integers* (like `123`) or *floating point*
|
||||||
|
(like `123.43` or `.27e13`).
|
||||||
|
|
||||||
|
See [arithmetic] and [comparison] operators for semantics.
|
||||||
|
|
||||||
|
[arithmetic]: ./operators.md#arithmetic
|
||||||
|
[comparison]: ./operators.md#comparison
|
||||||
|
|
||||||
|
### Path {#path-literal}
|
||||||
|
|
||||||
|
*Paths* are distinct from strings and can be expressed by path literals such as `./builder.sh`.
|
||||||
|
|
||||||
|
Paths are suitable for referring to local files, and are often preferable over strings.
|
||||||
|
- Path values do not contain trailing slashes, `.` and `..`, as they are resolved when evaluating a path literal.
|
||||||
|
- Path literals are automatically resolved relative to their [base directory](@docroot@/glossary.md#gloss-base-directory).
|
||||||
|
- The files referred to by path values are automatically copied into the Nix store when used in a string interpolation or concatenation.
|
||||||
|
- Tooling can recognize path literals and provide additional features, such as autocompletion, refactoring automation and jump-to-file.
|
||||||
|
|
||||||
|
A path literal must contain at least one slash to be recognised as such.
|
||||||
|
For instance, `builder.sh` is not a path:
|
||||||
|
it's parsed as an expression that selects the attribute `sh` from the variable `builder`.
|
||||||
|
|
||||||
|
Path literals may also refer to absolute paths by starting with a slash.
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
>
|
||||||
|
> Absolute paths make expressions less portable.
|
||||||
|
> In the case where a function translates a path literal into an absolute path string for a configuration file, it is recommended to write a string literal instead.
|
||||||
|
> This avoids some confusion about whether files at that location will be used during evaluation.
|
||||||
|
> It also avoids unintentional situations where some function might try to copy everything at the location into the store.
|
||||||
|
|
||||||
|
If the first component of a path is a `~`, it is interpreted such that the rest of the path were relative to the user's home directory.
|
||||||
|
For example, `~/foo` would be equivalent to `/home/edolstra/foo` for a user whose home directory is `/home/edolstra`.
|
||||||
|
Path literals that start with `~` are not allowed in [pure](@docroot@/command-ref/conf-file.md#conf-pure-eval) evaluation.
|
||||||
|
|
||||||
|
Paths can be used in [string interpolation] and string concatenation.
|
||||||
|
For instance, evaluating `"${./foo.txt}"` will cause `foo.txt` from the same directory to be copied into the Nix store and result in the string `"/nix/store/<hash>-foo.txt"`.
|
||||||
|
|
||||||
|
Note that the Nix language assumes that all input files will remain _unchanged_ while evaluating a Nix expression.
|
||||||
|
For example, assume you used a file path in an interpolated string during a `nix repl` session.
|
||||||
|
Later in the same session, after having changed the file contents, evaluating the interpolated string with the file path again might not return a new [store path], since Nix might not re-read the file contents. Use `:r` to reset the repl as needed.
|
||||||
|
|
||||||
|
[store path]: @docroot@/store/store-path.md
|
||||||
|
|
||||||
|
Path literals can also include [string interpolation], besides being [interpolated into other expressions].
|
||||||
|
|
||||||
|
[interpolated into other expressions]: ./string-interpolation.md#interpolated-expressions
|
||||||
|
|
||||||
|
At least one slash (`/`) must appear *before* any interpolated expression for the result to be recognized as a path.
|
||||||
|
|
||||||
|
`a.${foo}/b.${bar}` is a syntactically valid number division operation.
|
||||||
|
`./a.${foo}/b.${bar}` is a path.
|
||||||
|
|
||||||
|
[Lookup path](./constructs/lookup-path.md) literals such as `<nixpkgs>` also resolve to path values.
|
||||||
|
|
||||||
|
## List {#list-literal}
|
||||||
|
|
||||||
|
Lists are formed by enclosing a whitespace-separated list of values
|
||||||
|
between square brackets. For example,
|
||||||
|
|
||||||
|
```nix
|
||||||
|
[ 123 ./foo.nix "abc" (f { x = y; }) ]
|
||||||
|
```
|
||||||
|
|
||||||
|
defines a list of four elements, the last being the result of a call to
|
||||||
|
the function `f`. Note that function calls have to be enclosed in
|
||||||
|
parentheses. If they had been omitted, e.g.,
|
||||||
|
|
||||||
|
```nix
|
||||||
|
[ 123 ./foo.nix "abc" f { x = y; } ]
|
||||||
|
```
|
||||||
|
|
||||||
|
the result would be a list of five elements, the fourth one being a
|
||||||
|
function and the fifth being a set.
|
||||||
|
|
||||||
|
Note that lists are only lazy in values, and they are strict in length.
|
||||||
|
|
||||||
|
Elements in a list can be accessed using [`builtins.elemAt`](./builtins.md#builtins-elemAt).
|
||||||
|
|
||||||
|
## Attribute Set {#attrs-literal}
|
||||||
|
|
||||||
|
An attribute set is a collection of name-value-pairs (called *attributes*) enclosed in curly brackets (`{ }`).
|
||||||
|
|
||||||
|
An attribute name can be an identifier or a [string](#string).
|
||||||
|
An identifier must start with a letter (`a-z`, `A-Z`) or underscore (`_`), and can otherwise contain letters (`a-z`, `A-Z`), numbers (`0-9`), underscores (`_`), apostrophes (`'`), or dashes (`-`).
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
|
> *name* = *identifier* | *string* \
|
||||||
|
> *identifier* ~ `[a-zA-Z_][a-zA-Z0-9_'-]*`
|
||||||
|
|
||||||
|
Names and values are separated by an equal sign (`=`).
|
||||||
|
Each value is an arbitrary expression terminated by a semicolon (`;`).
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
|
> *attrset* = `{` [ *name* `=` *expr* `;` ]... `}`
|
||||||
|
|
||||||
|
Attributes can appear in any order.
|
||||||
|
An attribute name may only occur once.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
x = 123;
|
||||||
|
text = "Hello";
|
||||||
|
y = f { bla = 456; };
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This defines a set with attributes named `x`, `text`, `y`.
|
||||||
|
|
||||||
|
Attributes can be accessed with the [`.` operator](./operators.md#attribute-selection).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ a = "Foo"; b = "Bar"; }.a
|
||||||
|
```
|
||||||
|
|
||||||
|
This evaluates to `"Foo"`.
|
||||||
|
|
||||||
|
It is possible to provide a default value in an attribute selection using the `or` keyword.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ a = "Foo"; b = "Bar"; }.c or "Xyzzy"
|
||||||
|
```
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ a = "Foo"; b = "Bar"; }.c.d.e.f.g or "Xyzzy"
|
||||||
|
```
|
||||||
|
|
||||||
|
will both evaluate to `"Xyzzy"` because there is no `c` attribute in the set.
|
||||||
|
|
||||||
|
You can use arbitrary double-quoted strings as attribute names:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ "$!@#?" = 123; }."$!@#?"
|
||||||
|
```
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let bar = "bar"; in
|
||||||
|
{ "foo ${bar}" = 123; }."foo ${bar}"
|
||||||
|
```
|
||||||
|
|
||||||
|
Both will evaluate to `123`.
|
||||||
|
|
||||||
|
Attribute names support [string interpolation]:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let bar = "foo"; in
|
||||||
|
{ foo = 123; }.${bar}
|
||||||
|
```
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let bar = "foo"; in
|
||||||
|
{ ${bar} = 123; }.foo
|
||||||
|
```
|
||||||
|
|
||||||
|
Both will evaluate to `123`.
|
||||||
|
|
||||||
|
In the special case where an attribute name inside of a set declaration
|
||||||
|
evaluates to `null` (which is normally an error, as `null` cannot be coerced to
|
||||||
|
a string), that attribute is simply not added to the set:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ ${if foo then "bar" else null} = true; }
|
||||||
|
```
|
||||||
|
|
||||||
|
This will evaluate to `{}` if `foo` evaluates to `false`.
|
||||||
|
|
||||||
|
A set that has a `__functor` attribute whose value is callable (i.e. is
|
||||||
|
itself a function or a set with a `__functor` attribute whose value is
|
||||||
|
callable) can be applied as if it were a function, with the set itself
|
||||||
|
passed in first , e.g.,
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let add = { __functor = self: x: x + self.x; };
|
||||||
|
inc = add // { x = 1; };
|
||||||
|
in inc 1
|
||||||
|
```
|
||||||
|
|
||||||
|
evaluates to `2`. This can be used to attach metadata to a function
|
||||||
|
without the caller needing to treat it specially, or to implement a form
|
||||||
|
of object-oriented programming, for example.
|
||||||
|
|
||||||
|
## Recursive sets
|
||||||
|
|
||||||
|
Recursive sets are like normal [attribute sets](./types.md#attribute-set), but the attributes can refer to each other.
|
||||||
|
|
||||||
|
> *rec-attrset* = `rec {` [ *name* `=` *expr* `;` `]`... `}`
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
rec {
|
||||||
|
x = y;
|
||||||
|
y = 123;
|
||||||
|
}.x
|
||||||
|
```
|
||||||
|
|
||||||
|
This evaluates to `123`.
|
||||||
|
|
||||||
|
Note that without `rec` the binding `x = y;` would
|
||||||
|
refer to the variable `y` in the surrounding scope, if one exists, and
|
||||||
|
would be invalid if no such variable exists. That is, in a normal
|
||||||
|
(non-recursive) set, attributes are not added to the lexical scope; in a
|
||||||
|
recursive set, they are.
|
||||||
|
|
||||||
|
Recursive sets of course introduce the danger of infinite recursion. For
|
||||||
|
example, the expression
|
||||||
|
|
||||||
|
```nix
|
||||||
|
rec {
|
||||||
|
x = y;
|
||||||
|
y = x;
|
||||||
|
}.x
|
||||||
|
```
|
||||||
|
|
||||||
|
will crash with an `infinite recursion encountered` error message.
|
||||||
|
|
||||||
|
## Let-expressions
|
||||||
|
|
||||||
|
A let-expression allows you to define local variables for an expression.
|
||||||
|
|
||||||
|
> *let-in* = `let` [ *identifier* = *expr* ]... `in` *expr*
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let
|
||||||
|
x = "foo";
|
||||||
|
y = "bar";
|
||||||
|
in x + y
|
||||||
|
```
|
||||||
|
|
||||||
|
This evaluates to `"foobar"`.
|
||||||
|
|
||||||
|
## Inheriting attributes
|
||||||
|
|
||||||
|
When defining an [attribute set](./types.md#attribute-set) or in a [let-expression](#let-expressions) it is often convenient to copy variables from the surrounding lexical scope (e.g., when you want to propagate attributes).
|
||||||
|
This can be shortened using the `inherit` keyword.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let x = 123; in
|
||||||
|
{
|
||||||
|
inherit x;
|
||||||
|
y = 456;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
is equivalent to
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let x = 123; in
|
||||||
|
{
|
||||||
|
x = x;
|
||||||
|
y = 456;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
and both evaluate to `{ x = 123; y = 456; }`.
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
>
|
||||||
|
> This works because `x` is added to the lexical scope by the `let` construct.
|
||||||
|
|
||||||
|
It is also possible to inherit attributes from another attribute set.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
In this fragment from `all-packages.nix`,
|
||||||
|
|
||||||
|
```nix
|
||||||
|
graphviz = (import ../tools/graphics/graphviz) {
|
||||||
|
inherit fetchurl stdenv libpng libjpeg expat x11 yacc;
|
||||||
|
inherit (xorg) libXaw;
|
||||||
|
};
|
||||||
|
|
||||||
|
xorg = {
|
||||||
|
libX11 = ...;
|
||||||
|
libXaw = ...;
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
libpng = ...;
|
||||||
|
libjpg = ...;
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
the set used in the function call to the function defined in
|
||||||
|
`../tools/graphics/graphviz` inherits a number of variables from the
|
||||||
|
surrounding scope (`fetchurl` ... `yacc`), but also inherits `libXaw`
|
||||||
|
(the X Athena Widgets) from the `xorg` set.
|
||||||
|
|
||||||
|
Summarizing the fragment
|
||||||
|
|
||||||
|
```nix
|
||||||
|
...
|
||||||
|
inherit x y z;
|
||||||
|
inherit (src-set) a b c;
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
is equivalent to
|
||||||
|
|
||||||
|
```nix
|
||||||
|
...
|
||||||
|
x = x; y = y; z = z;
|
||||||
|
a = src-set.a; b = src-set.b; c = src-set.c;
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
when used while defining local variables in a let-expression or while
|
||||||
|
defining a set.
|
||||||
|
|
||||||
|
In a `let` expression, `inherit` can be used to selectively bring specific attributes of a set into scope. For example
|
||||||
|
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let
|
||||||
|
x = { a = 1; b = 2; };
|
||||||
|
inherit (builtins) attrNames;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
names = attrNames x;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
is equivalent to
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let
|
||||||
|
x = { a = 1; b = 2; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
names = builtins.attrNames x;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
both evaluate to `{ names = [ "a" "b" ]; }`.
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
Functions have the following form:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
pattern: body
|
||||||
|
```
|
||||||
|
|
||||||
|
The pattern specifies what the argument of the function must look like,
|
||||||
|
and binds variables in the body to (parts of) the argument. There are
|
||||||
|
three kinds of patterns:
|
||||||
|
|
||||||
|
- If a pattern is a single identifier, then the function matches any
|
||||||
|
argument. Example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let negate = x: !x;
|
||||||
|
concat = x: y: x + y;
|
||||||
|
in if negate true then concat "foo" "bar" else ""
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that `concat` is a function that takes one argument and returns
|
||||||
|
a function that takes another argument. This allows partial
|
||||||
|
parameterisation (i.e., only filling some of the arguments of a
|
||||||
|
function); e.g.,
|
||||||
|
|
||||||
|
```nix
|
||||||
|
map (concat "foo") [ "bar" "bla" "abc" ]
|
||||||
|
```
|
||||||
|
|
||||||
|
evaluates to `[ "foobar" "foobla" "fooabc" ]`.
|
||||||
|
|
||||||
|
- A *set pattern* of the form `{ name1, name2, …, nameN }` matches a
|
||||||
|
set containing the listed attributes, and binds the values of those
|
||||||
|
attributes to variables in the function body. For example, the
|
||||||
|
function
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ x, y, z }: z + y + x
|
||||||
|
```
|
||||||
|
|
||||||
|
can only be called with a set containing exactly the attributes `x`,
|
||||||
|
`y` and `z`. No other attributes are allowed. If you want to allow
|
||||||
|
additional arguments, you can use an ellipsis (`...`):
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ x, y, z, ... }: z + y + x
|
||||||
|
```
|
||||||
|
|
||||||
|
This works on any set that contains at least the three named
|
||||||
|
attributes.
|
||||||
|
|
||||||
|
It is possible to provide *default values* for attributes, in
|
||||||
|
which case they are allowed to be missing. A default value is
|
||||||
|
specified by writing `name ? e`, where *e* is an arbitrary
|
||||||
|
expression. For example,
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ x, y ? "foo", z ? "bar" }: z + y + x
|
||||||
|
```
|
||||||
|
|
||||||
|
specifies a function that only requires an attribute named `x`, but
|
||||||
|
optionally accepts `y` and `z`.
|
||||||
|
|
||||||
|
- An `@`-pattern provides a means of referring to the whole value
|
||||||
|
being matched:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
args@{ x, y, z, ... }: z + y + x + args.a
|
||||||
|
```
|
||||||
|
|
||||||
|
but can also be written as:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ x, y, z, ... } @ args: z + y + x + args.a
|
||||||
|
```
|
||||||
|
|
||||||
|
Here `args` is bound to the argument *as passed*, which is further
|
||||||
|
matched against the pattern `{ x, y, z, ... }`.
|
||||||
|
The `@`-pattern makes mainly sense with an ellipsis(`...`) as
|
||||||
|
you can access attribute names as `a`, using `args.a`, which was
|
||||||
|
given as an additional attribute to the function.
|
||||||
|
|
||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> `args@` binds the name `args` to the attribute set that is passed to the function.
|
||||||
|
> In particular, `args` does *not* include any default values specified with `?` in the function's set pattern.
|
||||||
|
>
|
||||||
|
> For instance
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> let
|
||||||
|
> f = args@{ a ? 23, ... }: [ a args ];
|
||||||
|
> in
|
||||||
|
> f {}
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> is equivalent to
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> let
|
||||||
|
> f = args @ { ... }: [ (args.a or 23) args ];
|
||||||
|
> in
|
||||||
|
> f {}
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> and both expressions will evaluate to:
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> [ 23 {} ]
|
||||||
|
> ```
|
||||||
|
|
||||||
|
Note that functions do not have names. If you want to give them a name,
|
||||||
|
you can bind them to an attribute, e.g.,
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let concat = { x, y }: x + y;
|
||||||
|
in concat { x = "foo"; y = "bar"; }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Conditionals
|
||||||
|
|
||||||
|
Conditionals look like this:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
if e1 then e2 else e3
|
||||||
|
```
|
||||||
|
|
||||||
|
where *e1* is an expression that should evaluate to a Boolean value
|
||||||
|
(`true` or `false`).
|
||||||
|
|
||||||
|
## Assertions
|
||||||
|
|
||||||
|
Assertions are generally used to check that certain requirements on or
|
||||||
|
between features and dependencies hold. They look like this:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
assert e1; e2
|
||||||
|
```
|
||||||
|
|
||||||
|
where *e1* is an expression that should evaluate to a Boolean value. If
|
||||||
|
it evaluates to `true`, *e2* is returned; otherwise expression
|
||||||
|
evaluation is aborted and a backtrace is printed.
|
||||||
|
|
||||||
|
Here is a Nix expression for the Subversion package that shows how
|
||||||
|
assertions can be used:.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ localServer ? false
|
||||||
|
, httpServer ? false
|
||||||
|
, sslSupport ? false
|
||||||
|
, pythonBindings ? false
|
||||||
|
, javaSwigBindings ? false
|
||||||
|
, javahlBindings ? false
|
||||||
|
, stdenv, fetchurl
|
||||||
|
, openssl ? null, httpd ? null, db4 ? null, expat, swig ? null, j2sdk ? null
|
||||||
|
}:
|
||||||
|
|
||||||
|
assert localServer -> db4 != null; ①
|
||||||
|
assert httpServer -> httpd != null && httpd.expat == expat; ②
|
||||||
|
assert sslSupport -> openssl != null && (httpServer -> httpd.openssl == openssl); ③
|
||||||
|
assert pythonBindings -> swig != null && swig.pythonSupport;
|
||||||
|
assert javaSwigBindings -> swig != null && swig.javaSupport;
|
||||||
|
assert javahlBindings -> j2sdk != null;
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "subversion-1.1.1";
|
||||||
|
...
|
||||||
|
openssl = if sslSupport then openssl else null; ④
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The points of interest are:
|
||||||
|
|
||||||
|
1. This assertion states that if Subversion is to have support for
|
||||||
|
local repositories, then Berkeley DB is needed. So if the Subversion
|
||||||
|
function is called with the `localServer` argument set to `true` but
|
||||||
|
the `db4` argument set to `null`, then the evaluation fails.
|
||||||
|
|
||||||
|
Note that `->` is the [logical
|
||||||
|
implication](https://en.wikipedia.org/wiki/Truth_table#Logical_implication)
|
||||||
|
Boolean operation.
|
||||||
|
|
||||||
|
2. This is a more subtle condition: if Subversion is built with Apache
|
||||||
|
(`httpServer`) support, then the Expat library (an XML library) used
|
||||||
|
by Subversion should be same as the one used by Apache. This is
|
||||||
|
because in this configuration Subversion code ends up being linked
|
||||||
|
with Apache code, and if the Expat libraries do not match, a build-
|
||||||
|
or runtime link error or incompatibility might occur.
|
||||||
|
|
||||||
|
3. This assertion says that in order for Subversion to have SSL support
|
||||||
|
(so that it can access `https` URLs), an OpenSSL library must be
|
||||||
|
passed. Additionally, it says that *if* Apache support is enabled,
|
||||||
|
then Apache's OpenSSL should match Subversion's. (Note that if
|
||||||
|
Apache support is not enabled, we don't care about Apache's
|
||||||
|
OpenSSL.)
|
||||||
|
|
||||||
|
4. The conditional here is not really related to assertions, but is
|
||||||
|
worth pointing out: it ensures that if SSL support is disabled, then
|
||||||
|
the Subversion derivation is not dependent on OpenSSL, even if a
|
||||||
|
non-`null` value was passed. This prevents an unnecessary rebuild of
|
||||||
|
Subversion if OpenSSL changes.
|
||||||
|
|
||||||
|
## With-expressions
|
||||||
|
|
||||||
|
A *with-expression*,
|
||||||
|
|
||||||
|
```nix
|
||||||
|
with e1; e2
|
||||||
|
```
|
||||||
|
|
||||||
|
introduces the set *e1* into the lexical scope of the expression *e2*.
|
||||||
|
For instance,
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let as = { x = "foo"; y = "bar"; };
|
||||||
|
in with as; x + y
|
||||||
|
```
|
||||||
|
|
||||||
|
evaluates to `"foobar"` since the `with` adds the `x` and `y` attributes
|
||||||
|
of `as` to the lexical scope in the expression `x + y`. The most common
|
||||||
|
use of `with` is in conjunction with the `import` function. E.g.,
|
||||||
|
|
||||||
|
```nix
|
||||||
|
with (import ./definitions.nix); ...
|
||||||
|
```
|
||||||
|
|
||||||
|
makes all attributes defined in the file `definitions.nix` available as
|
||||||
|
if they were defined locally in a `let`-expression.
|
||||||
|
|
||||||
|
The bindings introduced by `with` do not shadow bindings introduced by
|
||||||
|
other means, e.g.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let a = 3; in with { a = 1; }; let a = 4; in with { a = 2; }; ...
|
||||||
|
```
|
||||||
|
|
||||||
|
establishes the same scope as
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let a = 1; in let a = 2; in let a = 3; in let a = 4; in ...
|
||||||
|
```
|
||||||
|
|
||||||
|
Variables coming from outer `with` expressions *are* shadowed:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
with { a = "outer"; };
|
||||||
|
with { a = "inner"; };
|
||||||
|
a
|
||||||
|
```
|
||||||
|
|
||||||
|
Does evaluate to `"inner"`.
|
||||||
|
|
||||||
|
## Comments
|
||||||
|
|
||||||
|
- Inline comments start with `#` and run until the end of the line.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> # A number
|
||||||
|
> 2 # Equals 1 + 1
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> ```console
|
||||||
|
> 2
|
||||||
|
> ```
|
||||||
|
|
||||||
|
- Block comments start with `/*` and run until the next occurrence of `*/`.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> /*
|
||||||
|
> Block comments
|
||||||
|
> can span multiple lines.
|
||||||
|
> */ "hello"
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> ```console
|
||||||
|
> "hello"
|
||||||
|
> ```
|
||||||
|
|
||||||
|
This means that block comments cannot be nested.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> /* /* nope */ */ 1
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> ```console
|
||||||
|
> error: syntax error, unexpected '*'
|
||||||
|
>
|
||||||
|
> at «string»:1:15:
|
||||||
|
>
|
||||||
|
> 1| /* /* nope */ *
|
||||||
|
> | ^
|
||||||
|
> ```
|
||||||
|
|
||||||
|
Consider escaping nested comments and unescaping them in post-processing.
|
||||||
|
|
||||||
|
> **Example**
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> /* /* nested *\/ */ 1
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> ```console
|
||||||
|
> 1
|
||||||
|
> ```
|
91
doc/manual/src/language/types.md
Normal file
91
doc/manual/src/language/types.md
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
# Data Types
|
||||||
|
|
||||||
|
Every value in the Nix language has one of the following types:
|
||||||
|
|
||||||
|
* [Integer](#type-int)
|
||||||
|
* [Float](#type-float)
|
||||||
|
* [Boolean](#type-bool)
|
||||||
|
* [String](#type-string)
|
||||||
|
* [Path](#type-path)
|
||||||
|
* [Null](#type-null)
|
||||||
|
* [Attribute set](#type-attrs)
|
||||||
|
* [List](#type-list)
|
||||||
|
* [Function](#type-function)
|
||||||
|
* [External](#type-external)
|
||||||
|
|
||||||
|
## Primitives
|
||||||
|
|
||||||
|
### Integer {#type-int}
|
||||||
|
|
||||||
|
An _integer_ in the Nix language is a signed 64-bit integer.
|
||||||
|
|
||||||
|
Non-negative integers can be expressed as [integer literals](syntax.md#number-literal).
|
||||||
|
Negative integers are created with the [arithmetic negation operator](./operators.md#arithmetic).
|
||||||
|
The function [`builtins.isInt`](builtins.md#builtins-isInt) can be used to determine if a value is an integer.
|
||||||
|
|
||||||
|
### Float {#type-float}
|
||||||
|
|
||||||
|
A _float_ in the Nix language is a 64-bit [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) floating-point number.
|
||||||
|
|
||||||
|
Most non-negative floats can be expressed as [float literals](syntax.md#number-literal).
|
||||||
|
Negative floats are created with the [arithmetic negation operator](./operators.md#arithmetic).
|
||||||
|
The function [`builtins.isFloat`](builtins.md#builtins-isFloat) can be used to determine if a value is a float.
|
||||||
|
|
||||||
|
### Boolean {#type-bool}
|
||||||
|
|
||||||
|
A _boolean_ in the Nix language is one of _true_ or _false_.
|
||||||
|
|
||||||
|
<!-- TODO: mention the top-level environment -->
|
||||||
|
|
||||||
|
These values are available as attributes of [`builtins`](builtins.md#builtins-builtins) as [`builtins.true`](builtins.md#builtins-true) and [`builtins.false`](builtins.md#builtins-false).
|
||||||
|
The function [`builtins.isBool`](builtins.md#builtins-isBool) can be used to determine if a value is a boolean.
|
||||||
|
|
||||||
|
### String {#type-string}
|
||||||
|
|
||||||
|
A _string_ in the Nix language is an immutable, finite-length sequence of bytes, along with a [string context](string-context.md).
|
||||||
|
Nix does not assume or support working natively with character encodings.
|
||||||
|
|
||||||
|
String values without string context can be expressed as [string literals](syntax.md#string-literal).
|
||||||
|
The function [`builtins.isString`](builtins.md#builtins-isString) can be used to determine if a value is a string.
|
||||||
|
|
||||||
|
### Path {#type-path}
|
||||||
|
|
||||||
|
<!-- TODO(@rhendric, #10970): Incorporate content from syntax.md#path-literal -->
|
||||||
|
|
||||||
|
The function [`builtins.isPath`](builtins.md#builtins-isPath) can be used to determine if a value is a path.
|
||||||
|
|
||||||
|
### Null {#type-null}
|
||||||
|
|
||||||
|
There is a single value of type _null_ in the Nix language.
|
||||||
|
|
||||||
|
<!-- TODO: mention the top-level environment -->
|
||||||
|
|
||||||
|
This value is available as an attribute on the [`builtins`](builtins.md#builtins-builtins) attribute set as [`builtins.null`](builtins.md#builtins-null).
|
||||||
|
|
||||||
|
## Compound values
|
||||||
|
|
||||||
|
### Attribute set {#type-attrs}
|
||||||
|
|
||||||
|
<!-- TODO(@rhendric, #10970): fill this out -->
|
||||||
|
|
||||||
|
An attribute set can be constructed with an [attribute set literal](syntax.md#attrs-literal).
|
||||||
|
The function [`builtins.isAttrs`](builtins.md#builtins-isAttrs) can be used to determine if a value is an attribute set.
|
||||||
|
|
||||||
|
### List {#type-list}
|
||||||
|
|
||||||
|
<!-- TODO(@rhendric, #10970): fill this out -->
|
||||||
|
|
||||||
|
A list can be constructed with a [list literal](syntax.md#list-literal).
|
||||||
|
The function [`builtins.isList`](builtins.md#builtins-isList) can be used to determine if a value is a list.
|
||||||
|
|
||||||
|
## Function {#type-function}
|
||||||
|
|
||||||
|
<!-- TODO(@rhendric, #10970): fill this out -->
|
||||||
|
|
||||||
|
A function can be constructed with a [function expression](syntax.md#functions).
|
||||||
|
The function [`builtins.isFunction`](builtins.md#builtins-isFunction) can be used to determine if a value is a function.
|
||||||
|
|
||||||
|
## External {#type-external}
|
||||||
|
|
||||||
|
An _external_ value is an opaque value created by a Nix [plugin](../command-ref/conf-file.md#conf-plugin-files).
|
||||||
|
Such a value can be substituted in Nix expressions but only created and used by plugin code.
|
|
@ -1,280 +0,0 @@
|
||||||
# Data Types
|
|
||||||
|
|
||||||
## Primitives
|
|
||||||
|
|
||||||
- <a id="type-string" href="#type-string">String</a>
|
|
||||||
|
|
||||||
*Strings* can be written in three ways.
|
|
||||||
|
|
||||||
The most common way is to enclose the string between double quotes,
|
|
||||||
e.g., `"foo bar"`. Strings can span multiple lines. The special
|
|
||||||
characters `"` and `\` and the character sequence `${` must be
|
|
||||||
escaped by prefixing them with a backslash (`\`). Newlines, carriage
|
|
||||||
returns and tabs can be written as `\n`, `\r` and `\t`,
|
|
||||||
respectively.
|
|
||||||
|
|
||||||
You can include the results of other expressions into a string by enclosing them in `${ }`, a feature known as [string interpolation].
|
|
||||||
|
|
||||||
[string interpolation]: ./string-interpolation.md
|
|
||||||
|
|
||||||
The second way to write string literals is as an *indented string*,
|
|
||||||
which is enclosed between pairs of *double single-quotes*, like so:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
''
|
|
||||||
This is the first line.
|
|
||||||
This is the second line.
|
|
||||||
This is the third line.
|
|
||||||
''
|
|
||||||
```
|
|
||||||
|
|
||||||
This kind of string literal intelligently strips indentation from
|
|
||||||
the start of each line. To be precise, it strips from each line a
|
|
||||||
number of spaces equal to the minimal indentation of the string as a
|
|
||||||
whole (disregarding the indentation of empty lines). For instance,
|
|
||||||
the first and second line are indented two spaces, while the third
|
|
||||||
line is indented four spaces. Thus, two spaces are stripped from
|
|
||||||
each line, so the resulting string is
|
|
||||||
|
|
||||||
```nix
|
|
||||||
"This is the first line.\nThis is the second line.\n This is the third line.\n"
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that the whitespace and newline following the opening `''` is
|
|
||||||
ignored if there is no non-whitespace text on the initial line.
|
|
||||||
|
|
||||||
Indented strings support [string interpolation].
|
|
||||||
|
|
||||||
Since `${` and `''` have special meaning in indented strings, you
|
|
||||||
need a way to quote them. `$` can be escaped by prefixing it with
|
|
||||||
`''` (that is, two single quotes), i.e., `''$`. `''` can be escaped
|
|
||||||
by prefixing it with `'`, i.e., `'''`. `$` removes any special
|
|
||||||
meaning from the following `$`. Linefeed, carriage-return and tab
|
|
||||||
characters can be written as `''\n`, `''\r`, `''\t`, and `''\`
|
|
||||||
escapes any other character.
|
|
||||||
|
|
||||||
Indented strings are primarily useful in that they allow multi-line
|
|
||||||
string literals to follow the indentation of the enclosing Nix
|
|
||||||
expression, and that less escaping is typically necessary for
|
|
||||||
strings representing languages such as shell scripts and
|
|
||||||
configuration files because `''` is much less common than `"`.
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
...
|
|
||||||
postInstall =
|
|
||||||
''
|
|
||||||
mkdir $out/bin $out/etc
|
|
||||||
cp foo $out/bin
|
|
||||||
echo "Hello World" > $out/etc/foo.conf
|
|
||||||
${if enableBar then "cp bar $out/bin" else ""}
|
|
||||||
'';
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Finally, as a convenience, *URIs* as defined in appendix B of
|
|
||||||
[RFC 2396](http://www.ietf.org/rfc/rfc2396.txt) can be written *as
|
|
||||||
is*, without quotes. For instance, the string
|
|
||||||
`"http://example.org/foo.tar.bz2"` can also be written as
|
|
||||||
`http://example.org/foo.tar.bz2`.
|
|
||||||
|
|
||||||
- <a id="type-number" href="#type-number">Number</a>
|
|
||||||
|
|
||||||
Numbers, which can be *integers* (like `123`) or *floating point*
|
|
||||||
(like `123.43` or `.27e13`).
|
|
||||||
|
|
||||||
See [arithmetic] and [comparison] operators for semantics.
|
|
||||||
|
|
||||||
[arithmetic]: ./operators.md#arithmetic
|
|
||||||
[comparison]: ./operators.md#comparison
|
|
||||||
|
|
||||||
- <a id="type-path" href="#type-path">Path</a>
|
|
||||||
|
|
||||||
*Paths* are distinct from strings and can be expressed by path literals such as `./builder.sh`.
|
|
||||||
|
|
||||||
Paths are suitable for referring to local files, and are often preferable over strings.
|
|
||||||
- Path values do not contain trailing slashes, `.` and `..`, as they are resolved when evaluating a path literal.
|
|
||||||
- Path literals are automatically resolved relative to their [base directory](@docroot@/glossary.md#gloss-base-directory).
|
|
||||||
- The files referred to by path values are automatically copied into the Nix store when used in a string interpolation or concatenation.
|
|
||||||
- Tooling can recognize path literals and provide additional features, such as autocompletion, refactoring automation and jump-to-file.
|
|
||||||
|
|
||||||
A path literal must contain at least one slash to be recognised as such.
|
|
||||||
For instance, `builder.sh` is not a path:
|
|
||||||
it's parsed as an expression that selects the attribute `sh` from the variable `builder`.
|
|
||||||
|
|
||||||
Path literals may also refer to absolute paths by starting with a slash.
|
|
||||||
|
|
||||||
> **Note**
|
|
||||||
>
|
|
||||||
> Absolute paths make expressions less portable.
|
|
||||||
> In the case where a function translates a path literal into an absolute path string for a configuration file, it is recommended to write a string literal instead.
|
|
||||||
> This avoids some confusion about whether files at that location will be used during evaluation.
|
|
||||||
> It also avoids unintentional situations where some function might try to copy everything at the location into the store.
|
|
||||||
|
|
||||||
If the first component of a path is a `~`, it is interpreted such that the rest of the path were relative to the user's home directory.
|
|
||||||
For example, `~/foo` would be equivalent to `/home/edolstra/foo` for a user whose home directory is `/home/edolstra`.
|
|
||||||
Path literals that start with `~` are not allowed in [pure](@docroot@/command-ref/conf-file.md#conf-pure-eval) evaluation.
|
|
||||||
|
|
||||||
Paths can be used in [string interpolation] and string concatenation.
|
|
||||||
For instance, evaluating `"${./foo.txt}"` will cause `foo.txt` from the same directory to be copied into the Nix store and result in the string `"/nix/store/<hash>-foo.txt"`.
|
|
||||||
|
|
||||||
Note that the Nix language assumes that all input files will remain _unchanged_ while evaluating a Nix expression.
|
|
||||||
For example, assume you used a file path in an interpolated string during a `nix repl` session.
|
|
||||||
Later in the same session, after having changed the file contents, evaluating the interpolated string with the file path again might not return a new [store path], since Nix might not re-read the file contents. Use `:r` to reset the repl as needed.
|
|
||||||
|
|
||||||
[store path]: @docroot@/store/store-path.md
|
|
||||||
|
|
||||||
Path literals can also include [string interpolation], besides being [interpolated into other expressions].
|
|
||||||
|
|
||||||
[interpolated into other expressions]: ./string-interpolation.md#interpolated-expressions
|
|
||||||
|
|
||||||
At least one slash (`/`) must appear *before* any interpolated expression for the result to be recognized as a path.
|
|
||||||
|
|
||||||
`a.${foo}/b.${bar}` is a syntactically valid number division operation.
|
|
||||||
`./a.${foo}/b.${bar}` is a path.
|
|
||||||
|
|
||||||
[Lookup path](./constructs/lookup-path.md) literals such as `<nixpkgs>` also resolve to path values.
|
|
||||||
|
|
||||||
- <a id="type-boolean" href="#type-boolean">Boolean</a>
|
|
||||||
|
|
||||||
*Booleans* with values `true` and `false`.
|
|
||||||
|
|
||||||
- <a id="type-null" href="#type-null">Null</a>
|
|
||||||
|
|
||||||
The null value, denoted as `null`.
|
|
||||||
|
|
||||||
## List
|
|
||||||
|
|
||||||
Lists are formed by enclosing a whitespace-separated list of values
|
|
||||||
between square brackets. For example,
|
|
||||||
|
|
||||||
```nix
|
|
||||||
[ 123 ./foo.nix "abc" (f { x = y; }) ]
|
|
||||||
```
|
|
||||||
|
|
||||||
defines a list of four elements, the last being the result of a call to
|
|
||||||
the function `f`. Note that function calls have to be enclosed in
|
|
||||||
parentheses. If they had been omitted, e.g.,
|
|
||||||
|
|
||||||
```nix
|
|
||||||
[ 123 ./foo.nix "abc" f { x = y; } ]
|
|
||||||
```
|
|
||||||
|
|
||||||
the result would be a list of five elements, the fourth one being a
|
|
||||||
function and the fifth being a set.
|
|
||||||
|
|
||||||
Note that lists are only lazy in values, and they are strict in length.
|
|
||||||
|
|
||||||
Elements in a list can be accessed using [`builtins.elemAt`](./builtins.md#builtins-elemAt).
|
|
||||||
|
|
||||||
## Attribute Set
|
|
||||||
|
|
||||||
An attribute set is a collection of name-value-pairs (called *attributes*) enclosed in curly brackets (`{ }`).
|
|
||||||
|
|
||||||
An attribute name can be an identifier or a [string](#string).
|
|
||||||
An identifier must start with a letter (`a-z`, `A-Z`) or underscore (`_`), and can otherwise contain letters (`a-z`, `A-Z`), numbers (`0-9`), underscores (`_`), apostrophes (`'`), or dashes (`-`).
|
|
||||||
|
|
||||||
> **Syntax**
|
|
||||||
>
|
|
||||||
> *name* = *identifier* | *string* \
|
|
||||||
> *identifier* ~ `[a-zA-Z_][a-zA-Z0-9_'-]*`
|
|
||||||
|
|
||||||
Names and values are separated by an equal sign (`=`).
|
|
||||||
Each value is an arbitrary expression terminated by a semicolon (`;`).
|
|
||||||
|
|
||||||
> **Syntax**
|
|
||||||
>
|
|
||||||
> *attrset* = `{` [ *name* `=` *expr* `;` ]... `}`
|
|
||||||
|
|
||||||
Attributes can appear in any order.
|
|
||||||
An attribute name may only occur once.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{
|
|
||||||
x = 123;
|
|
||||||
text = "Hello";
|
|
||||||
y = f { bla = 456; };
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This defines a set with attributes named `x`, `text`, `y`.
|
|
||||||
|
|
||||||
Attributes can be accessed with the [`.` operator](./operators.md#attribute-selection).
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{ a = "Foo"; b = "Bar"; }.a
|
|
||||||
```
|
|
||||||
|
|
||||||
This evaluates to `"Foo"`.
|
|
||||||
|
|
||||||
It is possible to provide a default value in an attribute selection using the `or` keyword.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{ a = "Foo"; b = "Bar"; }.c or "Xyzzy"
|
|
||||||
```
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{ a = "Foo"; b = "Bar"; }.c.d.e.f.g or "Xyzzy"
|
|
||||||
```
|
|
||||||
|
|
||||||
will both evaluate to `"Xyzzy"` because there is no `c` attribute in the set.
|
|
||||||
|
|
||||||
You can use arbitrary double-quoted strings as attribute names:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{ "$!@#?" = 123; }."$!@#?"
|
|
||||||
```
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let bar = "bar"; in
|
|
||||||
{ "foo ${bar}" = 123; }."foo ${bar}"
|
|
||||||
```
|
|
||||||
|
|
||||||
Both will evaluate to `123`.
|
|
||||||
|
|
||||||
Attribute names support [string interpolation]:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let bar = "foo"; in
|
|
||||||
{ foo = 123; }.${bar}
|
|
||||||
```
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let bar = "foo"; in
|
|
||||||
{ ${bar} = 123; }.foo
|
|
||||||
```
|
|
||||||
|
|
||||||
Both will evaluate to `123`.
|
|
||||||
|
|
||||||
In the special case where an attribute name inside of a set declaration
|
|
||||||
evaluates to `null` (which is normally an error, as `null` cannot be coerced to
|
|
||||||
a string), that attribute is simply not added to the set:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
{ ${if foo then "bar" else null} = true; }
|
|
||||||
```
|
|
||||||
|
|
||||||
This will evaluate to `{}` if `foo` evaluates to `false`.
|
|
||||||
|
|
||||||
A set that has a `__functor` attribute whose value is callable (i.e. is
|
|
||||||
itself a function or a set with a `__functor` attribute whose value is
|
|
||||||
callable) can be applied as if it were a function, with the set itself
|
|
||||||
passed in first , e.g.,
|
|
||||||
|
|
||||||
```nix
|
|
||||||
let add = { __functor = self: x: x + self.x; };
|
|
||||||
inc = add // { x = 1; };
|
|
||||||
in inc 1
|
|
||||||
```
|
|
||||||
|
|
||||||
evaluates to `2`. This can be used to attach metadata to a function
|
|
||||||
without the caller needing to treat it specially, or to implement a form
|
|
||||||
of object-oriented programming, for example.
|
|
|
@ -29,7 +29,7 @@ regular = [ str("executable"), str("") ], str("contents"), str(contents);
|
||||||
symlink = str("target"), str(target);
|
symlink = str("target"), str(target);
|
||||||
|
|
||||||
(* side condition: directory entries must be ordered by their names *)
|
(* side condition: directory entries must be ordered by their names *)
|
||||||
directory = str("type"), str("directory") { directory-entry };
|
directory = { directory-entry };
|
||||||
|
|
||||||
directory-entry = str("entry"), str("("), str("name"), str(name), str("node"), nar-obj, str(")");
|
directory-entry = str("entry"), str("("), str("name"), str(name), str("node"), nar-obj, str(")");
|
||||||
```
|
```
|
||||||
|
|
213
flake.nix
213
flake.nix
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
inherit (lib) fileset;
|
|
||||||
|
|
||||||
officialRelease = false;
|
officialRelease = false;
|
||||||
|
|
||||||
|
@ -58,6 +57,18 @@
|
||||||
"stdenv"
|
"stdenv"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
`flatMapAttrs attrs f` applies `f` to each attribute in `attrs` and
|
||||||
|
merges the results into a single attribute set.
|
||||||
|
|
||||||
|
This can be nested to form a build matrix where all the attributes
|
||||||
|
generated by the innermost `f` are returned as is.
|
||||||
|
(Provided that the names are unique.)
|
||||||
|
|
||||||
|
See https://nixos.org/manual/nixpkgs/stable/index.html#function-library-lib.attrsets.concatMapAttrs
|
||||||
|
*/
|
||||||
|
flatMapAttrs = attrs: f: lib.concatMapAttrs f attrs;
|
||||||
|
|
||||||
forAllSystems = lib.genAttrs systems;
|
forAllSystems = lib.genAttrs systems;
|
||||||
|
|
||||||
forAllCrossSystems = lib.genAttrs crossSystems;
|
forAllCrossSystems = lib.genAttrs crossSystems;
|
||||||
|
@ -117,76 +128,23 @@
|
||||||
{
|
{
|
||||||
nixStable = prev.nix;
|
nixStable = prev.nix;
|
||||||
|
|
||||||
default-busybox-sandbox-shell = final.busybox.override {
|
# A new scope, so that we can use `callPackage` to inject our own interdependencies
|
||||||
useMusl = true;
|
# without "polluting" the top level "`pkgs`" attrset.
|
||||||
enableStatic = true;
|
# This also has the benefit of providing us with a distinct set of packages
|
||||||
enableMinimal = true;
|
# we can iterate over.
|
||||||
extraConfig = ''
|
nixComponents = lib.makeScope final.nixDependencies.newScope (import ./packaging/components.nix);
|
||||||
CONFIG_FEATURE_FANCY_ECHO y
|
|
||||||
CONFIG_FEATURE_SH_MATH y
|
|
||||||
CONFIG_FEATURE_SH_MATH_64 y
|
|
||||||
|
|
||||||
CONFIG_ASH y
|
# The dependencies are in their own scope, so that they don't have to be
|
||||||
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
|
# in Nixpkgs top level `pkgs` or `nixComponents`.
|
||||||
|
nixDependencies = lib.makeScope final.newScope (import ./packaging/dependencies.nix {
|
||||||
CONFIG_ASH_ALIAS y
|
inherit inputs stdenv versionSuffix;
|
||||||
CONFIG_ASH_BASH_COMPAT y
|
pkgs = final;
|
||||||
CONFIG_ASH_CMDCMD y
|
|
||||||
CONFIG_ASH_ECHO y
|
|
||||||
CONFIG_ASH_GETOPTS y
|
|
||||||
CONFIG_ASH_INTERNAL_GLOB y
|
|
||||||
CONFIG_ASH_JOB_CONTROL y
|
|
||||||
CONFIG_ASH_PRINTF y
|
|
||||||
CONFIG_ASH_TEST y
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
libgit2-nix = final.libgit2.overrideAttrs (attrs: {
|
|
||||||
src = libgit2;
|
|
||||||
version = libgit2.lastModifiedDate;
|
|
||||||
cmakeFlags = attrs.cmakeFlags or []
|
|
||||||
++ [ "-DUSE_SSH=exec" ];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
boehmgc-nix = final.boehmgc.override {
|
nix = final.nixComponents.nix;
|
||||||
enableLargeConfig = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
libseccomp-nix = final.libseccomp.overrideAttrs (_: rec {
|
nix_noTests = final.nix.override {
|
||||||
version = "2.5.5";
|
doInstallCheck = false;
|
||||||
src = final.fetchurl {
|
|
||||||
url = "https://github.com/seccomp/libseccomp/releases/download/v${version}/libseccomp-${version}.tar.gz";
|
|
||||||
hash = "sha256-JIosik2bmFiqa69ScSw0r+/PnJ6Ut23OAsHJqiX7M3U=";
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
nix =
|
|
||||||
let
|
|
||||||
officialRelease = false;
|
|
||||||
versionSuffix =
|
|
||||||
if officialRelease
|
|
||||||
then ""
|
|
||||||
else "pre${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}_${self.shortRev or "dirty"}";
|
|
||||||
|
|
||||||
in final.callPackage ./package.nix {
|
|
||||||
inherit
|
|
||||||
fileset
|
|
||||||
stdenv
|
|
||||||
versionSuffix
|
|
||||||
;
|
|
||||||
officialRelease = false;
|
|
||||||
boehmgc = final.boehmgc-nix;
|
|
||||||
libgit2 = final.libgit2-nix;
|
|
||||||
libseccomp = final.libseccomp-nix;
|
|
||||||
busybox-sandbox-shell = final.busybox-sandbox-shell or final.default-busybox-sandbox-shell;
|
|
||||||
} // {
|
|
||||||
# this is a proper separate downstream package, but put
|
|
||||||
# here also for back compat reasons.
|
|
||||||
perl-bindings = final.nix-perl-bindings;
|
|
||||||
};
|
|
||||||
|
|
||||||
nix-perl-bindings = final.callPackage ./perl {
|
|
||||||
inherit fileset stdenv;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# See https://github.com/NixOS/nixpkgs/pull/214409
|
# See https://github.com/NixOS/nixpkgs/pull/214409
|
||||||
|
@ -200,10 +158,10 @@
|
||||||
|
|
||||||
in {
|
in {
|
||||||
# A Nixpkgs overlay that overrides the 'nix' and
|
# A Nixpkgs overlay that overrides the 'nix' and
|
||||||
# 'nix.perl-bindings' packages.
|
# 'nix-perl-bindings' packages.
|
||||||
overlays.default = overlayFor (p: p.stdenv);
|
overlays.default = overlayFor (p: p.stdenv);
|
||||||
|
|
||||||
hydraJobs = import ./build/hydra.nix {
|
hydraJobs = import ./packaging/hydra.nix {
|
||||||
inherit
|
inherit
|
||||||
inputs
|
inputs
|
||||||
binaryTarball
|
binaryTarball
|
||||||
|
@ -232,15 +190,67 @@
|
||||||
# Some perl dependencies are broken on i686-linux.
|
# Some perl dependencies are broken on i686-linux.
|
||||||
# Since the support is only best-effort there, disable the perl
|
# Since the support is only best-effort there, disable the perl
|
||||||
# bindings
|
# bindings
|
||||||
perlBindings = self.hydraJobs.perlBindings.${system};
|
|
||||||
} // devFlake.checks.${system} or {}
|
# Temporarily disabled because GitHub Actions OOM issues. Once
|
||||||
|
# the old build system is gone and we are back to one build
|
||||||
|
# system, we should reenable this.
|
||||||
|
#perlBindings = self.hydraJobs.perlBindings.${system};
|
||||||
|
}
|
||||||
|
# Add "passthru" tests
|
||||||
|
// flatMapAttrs ({
|
||||||
|
"" = nixpkgsFor.${system}.native;
|
||||||
|
} // lib.optionalAttrs (! nixpkgsFor.${system}.native.stdenv.hostPlatform.isDarwin) {
|
||||||
|
# TODO: enable static builds for darwin, blocked on:
|
||||||
|
# https://github.com/NixOS/nixpkgs/issues/320448
|
||||||
|
"static-" = nixpkgsFor.${system}.static;
|
||||||
|
})
|
||||||
|
(nixpkgsPrefix: nixpkgs:
|
||||||
|
flatMapAttrs nixpkgs.nixComponents
|
||||||
|
(pkgName: pkg:
|
||||||
|
flatMapAttrs pkg.tests or {}
|
||||||
|
(testName: test: {
|
||||||
|
"${nixpkgsPrefix}${pkgName}-${testName}" = test;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
// devFlake.checks.${system} or {}
|
||||||
);
|
);
|
||||||
|
|
||||||
packages = forAllSystems (system: rec {
|
packages = forAllSystems (system:
|
||||||
inherit (nixpkgsFor.${system}.native) nix changelog-d;
|
{ # Here we put attributes that map 1:1 into packages.<system>, ie
|
||||||
default = nix;
|
# for which we don't apply the full build matrix such as cross or static.
|
||||||
} // (lib.optionalAttrs (builtins.elem system linux64BitSystems) {
|
inherit (nixpkgsFor.${system}.native)
|
||||||
nix-static = nixpkgsFor.${system}.static.nix;
|
changelog-d;
|
||||||
|
default = self.packages.${system}.nix;
|
||||||
|
nix-internal-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-internal-api-docs;
|
||||||
|
nix-external-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-external-api-docs;
|
||||||
|
}
|
||||||
|
# We need to flatten recursive attribute sets of derivations to pass `flake check`.
|
||||||
|
// flatMapAttrs
|
||||||
|
{ # Components we'll iterate over in the upcoming lambda
|
||||||
|
"nix" = { };
|
||||||
|
# Temporarily disabled because GitHub Actions OOM issues. Once
|
||||||
|
# the old build system is gone and we are back to one build
|
||||||
|
# system, we should reenable these.
|
||||||
|
#"nix-util" = { };
|
||||||
|
#"nix-store" = { };
|
||||||
|
#"nix-fetchers" = { };
|
||||||
|
}
|
||||||
|
(pkgName: {}: {
|
||||||
|
# These attributes go right into `packages.<system>`.
|
||||||
|
"${pkgName}" = nixpkgsFor.${system}.native.nixComponents.${pkgName};
|
||||||
|
"${pkgName}-static" = nixpkgsFor.${system}.static.nixComponents.${pkgName};
|
||||||
|
}
|
||||||
|
// flatMapAttrs (lib.genAttrs crossSystems (_: { })) (crossSystem: {}: {
|
||||||
|
# These attributes go right into `packages.<system>`.
|
||||||
|
"${pkgName}-${crossSystem}" = nixpkgsFor.${system}.cross.${crossSystem}.nixComponents.${pkgName};
|
||||||
|
})
|
||||||
|
// flatMapAttrs (lib.genAttrs stdenvs (_: { })) (stdenvName: {}: {
|
||||||
|
# These attributes go right into `packages.<system>`.
|
||||||
|
"${pkgName}-${stdenvName}" = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".nixComponents.${pkgName};
|
||||||
|
})
|
||||||
|
)
|
||||||
|
// lib.optionalAttrs (builtins.elem system linux64BitSystems) {
|
||||||
dockerImage =
|
dockerImage =
|
||||||
let
|
let
|
||||||
pkgs = nixpkgsFor.${system}.native;
|
pkgs = nixpkgsFor.${system}.native;
|
||||||
|
@ -255,25 +265,26 @@
|
||||||
ln -s ${image} $image
|
ln -s ${image} $image
|
||||||
echo "file binary-dist $image" >> $out/nix-support/hydra-build-products
|
echo "file binary-dist $image" >> $out/nix-support/hydra-build-products
|
||||||
'';
|
'';
|
||||||
} // builtins.listToAttrs (map
|
});
|
||||||
(crossSystem: {
|
|
||||||
name = "nix-${crossSystem}";
|
|
||||||
value = nixpkgsFor.${system}.cross.${crossSystem}.nix;
|
|
||||||
})
|
|
||||||
crossSystems)
|
|
||||||
// builtins.listToAttrs (map
|
|
||||||
(stdenvName: {
|
|
||||||
name = "nix-${stdenvName}";
|
|
||||||
value = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".nix;
|
|
||||||
})
|
|
||||||
stdenvs)));
|
|
||||||
|
|
||||||
devShells = let
|
devShells = let
|
||||||
makeShell = pkgs: stdenv: (pkgs.nix.override { inherit stdenv; forDevShell = true; }).overrideAttrs (attrs:
|
makeShell = pkgs: stdenv: (pkgs.nix.override { inherit stdenv; forDevShell = true; }).overrideAttrs (attrs:
|
||||||
let
|
let
|
||||||
modular = devFlake.getSystem stdenv.buildPlatform.system;
|
modular = devFlake.getSystem stdenv.buildPlatform.system;
|
||||||
|
transformFlag = prefix: flag:
|
||||||
|
assert builtins.isString flag;
|
||||||
|
let
|
||||||
|
rest = builtins.substring 2 (builtins.stringLength flag) flag;
|
||||||
|
in
|
||||||
|
"-D${prefix}:${rest}";
|
||||||
|
havePerl = stdenv.buildPlatform == stdenv.hostPlatform && stdenv.hostPlatform.isUnix;
|
||||||
in {
|
in {
|
||||||
pname = "shell-for-" + attrs.pname;
|
pname = "shell-for-" + attrs.pname;
|
||||||
|
|
||||||
|
# Remove the version suffix to avoid unnecessary attempts to substitute in nix develop
|
||||||
|
version = lib.fileContents ./.version;
|
||||||
|
name = attrs.pname;
|
||||||
|
|
||||||
installFlags = "sysconfdir=$(out)/etc";
|
installFlags = "sysconfdir=$(out)/etc";
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
PATH=$prefix/bin:$PATH
|
PATH=$prefix/bin:$PATH
|
||||||
|
@ -288,13 +299,31 @@
|
||||||
src = null;
|
src = null;
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
|
# Needed for Meson to find Boost.
|
||||||
|
# https://github.com/NixOS/nixpkgs/issues/86131.
|
||||||
|
BOOST_INCLUDEDIR = "${lib.getDev pkgs.nixDependencies.boost}/include";
|
||||||
|
BOOST_LIBRARYDIR = "${lib.getLib pkgs.nixDependencies.boost}/lib";
|
||||||
# For `make format`, to work without installing pre-commit
|
# For `make format`, to work without installing pre-commit
|
||||||
_NIX_PRE_COMMIT_HOOKS_CONFIG =
|
_NIX_PRE_COMMIT_HOOKS_CONFIG =
|
||||||
"${(pkgs.formats.yaml { }).generate "pre-commit-config.yaml" modular.pre-commit.settings.rawConfig}";
|
"${(pkgs.formats.yaml { }).generate "pre-commit-config.yaml" modular.pre-commit.settings.rawConfig}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mesonFlags =
|
||||||
|
map (transformFlag "libutil") pkgs.nixComponents.nix-util.mesonFlags
|
||||||
|
++ map (transformFlag "libstore") pkgs.nixComponents.nix-store.mesonFlags
|
||||||
|
++ map (transformFlag "libfetchers") pkgs.nixComponents.nix-fetchers.mesonFlags
|
||||||
|
++ lib.optionals havePerl (map (transformFlag "perl") pkgs.nixComponents.nix-perl-bindings.mesonFlags)
|
||||||
|
;
|
||||||
|
|
||||||
nativeBuildInputs = attrs.nativeBuildInputs or []
|
nativeBuildInputs = attrs.nativeBuildInputs or []
|
||||||
|
++ pkgs.nixComponents.nix-util.nativeBuildInputs
|
||||||
|
++ pkgs.nixComponents.nix-store.nativeBuildInputs
|
||||||
|
++ pkgs.nixComponents.nix-fetchers.nativeBuildInputs
|
||||||
|
++ lib.optionals havePerl pkgs.nixComponents.nix-perl-bindings.nativeBuildInputs
|
||||||
|
++ pkgs.nixComponents.nix-internal-api-docs.nativeBuildInputs
|
||||||
|
++ pkgs.nixComponents.nix-external-api-docs.nativeBuildInputs
|
||||||
++ [
|
++ [
|
||||||
|
pkgs.buildPackages.cmake
|
||||||
modular.pre-commit.settings.package
|
modular.pre-commit.settings.package
|
||||||
(pkgs.writeScriptBin "pre-commit-hooks-install"
|
(pkgs.writeScriptBin "pre-commit-hooks-install"
|
||||||
modular.pre-commit.settings.installationScript)
|
modular.pre-commit.settings.installationScript)
|
||||||
|
@ -303,6 +332,14 @@
|
||||||
# https://github.com/NixOS/nixpkgs/pull/291814 is available
|
# https://github.com/NixOS/nixpkgs/pull/291814 is available
|
||||||
++ lib.optional (stdenv.cc.isClang && !stdenv.buildPlatform.isDarwin) pkgs.buildPackages.bear
|
++ lib.optional (stdenv.cc.isClang && !stdenv.buildPlatform.isDarwin) pkgs.buildPackages.bear
|
||||||
++ lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) pkgs.buildPackages.clang-tools;
|
++ lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) pkgs.buildPackages.clang-tools;
|
||||||
|
|
||||||
|
buildInputs = attrs.buildInputs or []
|
||||||
|
++ [
|
||||||
|
pkgs.gtest
|
||||||
|
pkgs.rapidcheck
|
||||||
|
]
|
||||||
|
++ lib.optional havePerl pkgs.perl
|
||||||
|
;
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
forAllSystems (system:
|
forAllSystems (system:
|
||||||
|
|
|
@ -30,7 +30,6 @@ We aim to achieve this by improving the contributor experience and attracting mo
|
||||||
## Members
|
## Members
|
||||||
|
|
||||||
- Eelco Dolstra (@edolstra) – Team lead
|
- Eelco Dolstra (@edolstra) – Team lead
|
||||||
- Théophane Hufschmitt (@thufschmitt)
|
|
||||||
- Valentin Gagarin (@fricklerhandwerk)
|
- Valentin Gagarin (@fricklerhandwerk)
|
||||||
- Thomas Bereknyei (@tomberek)
|
- Thomas Bereknyei (@tomberek)
|
||||||
- Robert Hensing (@roberth)
|
- Robert Hensing (@roberth)
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
''^tests/unit/[^/]*/data/.*$''
|
''^tests/unit/[^/]*/data/.*$''
|
||||||
|
|
||||||
# Don't format vendored code
|
# Don't format vendored code
|
||||||
''^src/toml11/.*''
|
|
||||||
''^doc/manual/redirects\.js$''
|
''^doc/manual/redirects\.js$''
|
||||||
''^doc/manual/theme/highlight\.js$''
|
''^doc/manual/theme/highlight\.js$''
|
||||||
|
|
||||||
|
@ -65,14 +64,6 @@
|
||||||
''^src/libexpr/eval-settings\.hh$''
|
''^src/libexpr/eval-settings\.hh$''
|
||||||
''^src/libexpr/eval\.cc$''
|
''^src/libexpr/eval\.cc$''
|
||||||
''^src/libexpr/eval\.hh$''
|
''^src/libexpr/eval\.hh$''
|
||||||
''^src/libexpr/flake/config\.cc$''
|
|
||||||
''^src/libexpr/flake/flake\.cc$''
|
|
||||||
''^src/libexpr/flake/flake\.hh$''
|
|
||||||
''^src/libexpr/flake/flakeref\.cc$''
|
|
||||||
''^src/libexpr/flake/flakeref\.hh$''
|
|
||||||
''^src/libexpr/flake/lockfile\.cc$''
|
|
||||||
''^src/libexpr/flake/lockfile\.hh$''
|
|
||||||
''^src/libexpr/flake/url-name\.cc$''
|
|
||||||
''^src/libexpr/function-trace\.cc$''
|
''^src/libexpr/function-trace\.cc$''
|
||||||
''^src/libexpr/gc-small-vector\.hh$''
|
''^src/libexpr/gc-small-vector\.hh$''
|
||||||
''^src/libexpr/get-drvs\.cc$''
|
''^src/libexpr/get-drvs\.cc$''
|
||||||
|
@ -127,6 +118,14 @@
|
||||||
''^src/libfetchers/tarball\.hh$''
|
''^src/libfetchers/tarball\.hh$''
|
||||||
''^src/libfetchers/git\.cc$''
|
''^src/libfetchers/git\.cc$''
|
||||||
''^src/libfetchers/mercurial\.cc$''
|
''^src/libfetchers/mercurial\.cc$''
|
||||||
|
''^src/libflake/flake/config\.cc$''
|
||||||
|
''^src/libflake/flake/flake\.cc$''
|
||||||
|
''^src/libflake/flake/flake\.hh$''
|
||||||
|
''^src/libflake/flake/flakeref\.cc$''
|
||||||
|
''^src/libflake/flake/flakeref\.hh$''
|
||||||
|
''^src/libflake/flake/lockfile\.cc$''
|
||||||
|
''^src/libflake/flake/lockfile\.hh$''
|
||||||
|
''^src/libflake/flake/url-name\.cc$''
|
||||||
''^src/libmain/common-args\.cc$''
|
''^src/libmain/common-args\.cc$''
|
||||||
''^src/libmain/common-args\.hh$''
|
''^src/libmain/common-args\.hh$''
|
||||||
''^src/libmain/loggers\.cc$''
|
''^src/libmain/loggers\.cc$''
|
||||||
|
@ -429,14 +428,13 @@
|
||||||
''^tests/functional/test-libstoreconsumer/main\.cc''
|
''^tests/functional/test-libstoreconsumer/main\.cc''
|
||||||
''^tests/nixos/ca-fd-leak/sender\.c''
|
''^tests/nixos/ca-fd-leak/sender\.c''
|
||||||
''^tests/nixos/ca-fd-leak/smuggler\.c''
|
''^tests/nixos/ca-fd-leak/smuggler\.c''
|
||||||
|
''^tests/nixos/user-sandboxing/attacker\.c''
|
||||||
''^tests/unit/libexpr-support/tests/libexpr\.hh''
|
''^tests/unit/libexpr-support/tests/libexpr\.hh''
|
||||||
''^tests/unit/libexpr-support/tests/value/context\.cc''
|
''^tests/unit/libexpr-support/tests/value/context\.cc''
|
||||||
''^tests/unit/libexpr-support/tests/value/context\.hh''
|
''^tests/unit/libexpr-support/tests/value/context\.hh''
|
||||||
''^tests/unit/libexpr/derived-path\.cc''
|
''^tests/unit/libexpr/derived-path\.cc''
|
||||||
''^tests/unit/libexpr/error_traces\.cc''
|
''^tests/unit/libexpr/error_traces\.cc''
|
||||||
''^tests/unit/libexpr/eval\.cc''
|
''^tests/unit/libexpr/eval\.cc''
|
||||||
''^tests/unit/libexpr/flake/flakeref\.cc''
|
|
||||||
''^tests/unit/libexpr/flake/url-name\.cc''
|
|
||||||
''^tests/unit/libexpr/json\.cc''
|
''^tests/unit/libexpr/json\.cc''
|
||||||
''^tests/unit/libexpr/main\.cc''
|
''^tests/unit/libexpr/main\.cc''
|
||||||
''^tests/unit/libexpr/primops\.cc''
|
''^tests/unit/libexpr/primops\.cc''
|
||||||
|
@ -445,9 +443,10 @@
|
||||||
''^tests/unit/libexpr/value/context\.cc''
|
''^tests/unit/libexpr/value/context\.cc''
|
||||||
''^tests/unit/libexpr/value/print\.cc''
|
''^tests/unit/libexpr/value/print\.cc''
|
||||||
''^tests/unit/libfetchers/public-key\.cc''
|
''^tests/unit/libfetchers/public-key\.cc''
|
||||||
|
''^tests/unit/libflake/flakeref\.cc''
|
||||||
|
''^tests/unit/libflake/url-name\.cc''
|
||||||
''^tests/unit/libstore-support/tests/derived-path\.cc''
|
''^tests/unit/libstore-support/tests/derived-path\.cc''
|
||||||
''^tests/unit/libstore-support/tests/derived-path\.hh''
|
''^tests/unit/libstore-support/tests/derived-path\.hh''
|
||||||
''^tests/unit/libstore-support/tests/libstore\.hh''
|
|
||||||
''^tests/unit/libstore-support/tests/nix_api_store\.hh''
|
''^tests/unit/libstore-support/tests/nix_api_store\.hh''
|
||||||
''^tests/unit/libstore-support/tests/outputs-spec\.cc''
|
''^tests/unit/libstore-support/tests/outputs-spec\.cc''
|
||||||
''^tests/unit/libstore-support/tests/outputs-spec\.hh''
|
''^tests/unit/libstore-support/tests/outputs-spec\.hh''
|
||||||
|
@ -500,57 +499,37 @@
|
||||||
''^misc/bash/completion\.sh$''
|
''^misc/bash/completion\.sh$''
|
||||||
''^misc/fish/completion\.fish$''
|
''^misc/fish/completion\.fish$''
|
||||||
''^misc/zsh/completion\.zsh$''
|
''^misc/zsh/completion\.zsh$''
|
||||||
''^scripts/check-hydra-status\.sh$''
|
|
||||||
''^scripts/create-darwin-volume\.sh$''
|
''^scripts/create-darwin-volume\.sh$''
|
||||||
''^scripts/install-darwin-multi-user\.sh$''
|
''^scripts/install-darwin-multi-user\.sh$''
|
||||||
''^scripts/install-multi-user\.sh$''
|
''^scripts/install-multi-user\.sh$''
|
||||||
''^scripts/install-nix-from-closure\.sh$''
|
''^scripts/install-nix-from-closure\.sh$''
|
||||||
''^scripts/install-systemd-multi-user\.sh$''
|
''^scripts/install-systemd-multi-user\.sh$''
|
||||||
''^src/nix/get-env\.sh$''
|
''^src/nix/get-env\.sh$''
|
||||||
''^tests/functional/bash-profile\.sh$''
|
|
||||||
''^tests/functional/binary-cache-build-remote\.sh$''
|
|
||||||
''^tests/functional/binary-cache\.sh$''
|
|
||||||
''^tests/functional/brotli\.sh$''
|
|
||||||
''^tests/functional/build-delete\.sh$''
|
|
||||||
''^tests/functional/build-dry\.sh$''
|
|
||||||
''^tests/functional/build\.sh$''
|
''^tests/functional/build\.sh$''
|
||||||
''^tests/functional/ca/build-cache\.sh$''
|
|
||||||
''^tests/functional/ca/build-dry\.sh$''
|
''^tests/functional/ca/build-dry\.sh$''
|
||||||
''^tests/functional/ca/build-with-garbage-path\.sh$''
|
''^tests/functional/ca/build-with-garbage-path\.sh$''
|
||||||
''^tests/functional/ca/build\.sh$''
|
|
||||||
''^tests/functional/ca/common\.sh$''
|
''^tests/functional/ca/common\.sh$''
|
||||||
''^tests/functional/ca/concurrent-builds\.sh$''
|
''^tests/functional/ca/concurrent-builds\.sh$''
|
||||||
''^tests/functional/ca/derivation-json\.sh$''
|
|
||||||
''^tests/functional/ca/duplicate-realisation-in-closure\.sh$''
|
|
||||||
''^tests/functional/ca/eval-store\.sh$''
|
''^tests/functional/ca/eval-store\.sh$''
|
||||||
''^tests/functional/ca/gc\.sh$''
|
''^tests/functional/ca/gc\.sh$''
|
||||||
''^tests/functional/ca/import-derivation\.sh$''
|
''^tests/functional/ca/import-derivation\.sh$''
|
||||||
''^tests/functional/ca/new-build-cmd\.sh$''
|
''^tests/functional/ca/new-build-cmd\.sh$''
|
||||||
''^tests/functional/ca/nix-copy\.sh$''
|
|
||||||
''^tests/functional/ca/nix-run\.sh$''
|
|
||||||
''^tests/functional/ca/nix-shell\.sh$''
|
''^tests/functional/ca/nix-shell\.sh$''
|
||||||
''^tests/functional/ca/post-hook\.sh$''
|
''^tests/functional/ca/post-hook\.sh$''
|
||||||
''^tests/functional/ca/recursive\.sh$''
|
''^tests/functional/ca/recursive\.sh$''
|
||||||
''^tests/functional/ca/repl\.sh$''
|
''^tests/functional/ca/repl\.sh$''
|
||||||
''^tests/functional/ca/selfref-gc\.sh$''
|
''^tests/functional/ca/selfref-gc\.sh$''
|
||||||
''^tests/functional/ca/signatures\.sh$''
|
|
||||||
''^tests/functional/ca/substitute\.sh$''
|
|
||||||
''^tests/functional/ca/why-depends\.sh$''
|
''^tests/functional/ca/why-depends\.sh$''
|
||||||
''^tests/functional/case-hack\.sh$''
|
''^tests/functional/characterisation-test-infra\.sh$''
|
||||||
''^tests/functional/check-refs\.sh$''
|
|
||||||
''^tests/functional/check-reqs\.sh$''
|
|
||||||
''^tests/functional/check\.sh$''
|
''^tests/functional/check\.sh$''
|
||||||
''^tests/functional/chroot-store\.sh$''
|
|
||||||
''^tests/functional/common/vars-and-functions\.sh$''
|
''^tests/functional/common/vars-and-functions\.sh$''
|
||||||
''^tests/functional/completions\.sh$''
|
''^tests/functional/completions\.sh$''
|
||||||
''^tests/functional/compression-levels\.sh$''
|
|
||||||
''^tests/functional/compute-levels\.sh$''
|
''^tests/functional/compute-levels\.sh$''
|
||||||
''^tests/functional/config\.sh$''
|
''^tests/functional/config\.sh$''
|
||||||
''^tests/functional/db-migration\.sh$''
|
''^tests/functional/db-migration\.sh$''
|
||||||
''^tests/functional/debugger\.sh$''
|
''^tests/functional/debugger\.sh$''
|
||||||
''^tests/functional/dependencies\.builder0\.sh$''
|
''^tests/functional/dependencies\.builder0\.sh$''
|
||||||
''^tests/functional/dependencies\.sh$''
|
''^tests/functional/dependencies\.sh$''
|
||||||
''^tests/functional/derivation-json\.sh$''
|
|
||||||
''^tests/functional/dump-db\.sh$''
|
''^tests/functional/dump-db\.sh$''
|
||||||
''^tests/functional/dyn-drv/build-built-drv\.sh$''
|
''^tests/functional/dyn-drv/build-built-drv\.sh$''
|
||||||
''^tests/functional/dyn-drv/common\.sh$''
|
''^tests/functional/dyn-drv/common\.sh$''
|
||||||
|
@ -558,10 +537,8 @@
|
||||||
''^tests/functional/dyn-drv/eval-outputOf\.sh$''
|
''^tests/functional/dyn-drv/eval-outputOf\.sh$''
|
||||||
''^tests/functional/dyn-drv/old-daemon-error-hack\.sh$''
|
''^tests/functional/dyn-drv/old-daemon-error-hack\.sh$''
|
||||||
''^tests/functional/dyn-drv/recursive-mod-json\.sh$''
|
''^tests/functional/dyn-drv/recursive-mod-json\.sh$''
|
||||||
''^tests/functional/dyn-drv/text-hashed-output\.sh$''
|
|
||||||
''^tests/functional/eval-store\.sh$''
|
''^tests/functional/eval-store\.sh$''
|
||||||
''^tests/functional/eval\.sh$''
|
''^tests/functional/eval\.sh$''
|
||||||
''^tests/functional/experimental-features\.sh$''
|
|
||||||
''^tests/functional/export-graph\.sh$''
|
''^tests/functional/export-graph\.sh$''
|
||||||
''^tests/functional/export\.sh$''
|
''^tests/functional/export\.sh$''
|
||||||
''^tests/functional/extra-sandbox-profile\.sh$''
|
''^tests/functional/extra-sandbox-profile\.sh$''
|
||||||
|
@ -571,56 +548,37 @@
|
||||||
''^tests/functional/fetchGitSubmodules\.sh$''
|
''^tests/functional/fetchGitSubmodules\.sh$''
|
||||||
''^tests/functional/fetchGitVerification\.sh$''
|
''^tests/functional/fetchGitVerification\.sh$''
|
||||||
''^tests/functional/fetchMercurial\.sh$''
|
''^tests/functional/fetchMercurial\.sh$''
|
||||||
''^tests/functional/fetchPath\.sh$''
|
|
||||||
''^tests/functional/fetchTree-file\.sh$''
|
|
||||||
''^tests/functional/fetchurl\.sh$''
|
''^tests/functional/fetchurl\.sh$''
|
||||||
''^tests/functional/filter-source\.sh$''
|
|
||||||
''^tests/functional/fixed\.builder1\.sh$''
|
''^tests/functional/fixed\.builder1\.sh$''
|
||||||
''^tests/functional/fixed\.builder2\.sh$''
|
''^tests/functional/fixed\.builder2\.sh$''
|
||||||
''^tests/functional/fixed\.sh$''
|
''^tests/functional/fixed\.sh$''
|
||||||
''^tests/functional/flakes/absolute-attr-paths\.sh$''
|
|
||||||
''^tests/functional/flakes/absolute-paths\.sh$''
|
''^tests/functional/flakes/absolute-paths\.sh$''
|
||||||
''^tests/functional/flakes/build-paths\.sh$''
|
|
||||||
''^tests/functional/flakes/bundle\.sh$''
|
|
||||||
''^tests/functional/flakes/check\.sh$''
|
''^tests/functional/flakes/check\.sh$''
|
||||||
''^tests/functional/flakes/circular\.sh$''
|
|
||||||
''^tests/functional/flakes/common\.sh$''
|
''^tests/functional/flakes/common\.sh$''
|
||||||
''^tests/functional/flakes/config\.sh$''
|
''^tests/functional/flakes/config\.sh$''
|
||||||
''^tests/functional/flakes/develop\.sh$''
|
''^tests/functional/flakes/develop\.sh$''
|
||||||
''^tests/functional/flakes/flake-in-submodule\.sh$''
|
|
||||||
''^tests/functional/flakes/flakes\.sh$''
|
''^tests/functional/flakes/flakes\.sh$''
|
||||||
''^tests/functional/flakes/follow-paths\.sh$''
|
''^tests/functional/flakes/follow-paths\.sh$''
|
||||||
''^tests/functional/flakes/init\.sh$''
|
|
||||||
''^tests/functional/flakes/inputs\.sh$''
|
|
||||||
''^tests/functional/flakes/mercurial\.sh$''
|
|
||||||
''^tests/functional/flakes/prefetch\.sh$''
|
''^tests/functional/flakes/prefetch\.sh$''
|
||||||
''^tests/functional/flakes/run\.sh$''
|
''^tests/functional/flakes/run\.sh$''
|
||||||
''^tests/functional/flakes/search-root\.sh$''
|
|
||||||
''^tests/functional/flakes/show\.sh$''
|
''^tests/functional/flakes/show\.sh$''
|
||||||
''^tests/functional/flakes/unlocked-override\.sh$''
|
|
||||||
''^tests/functional/fmt\.sh$''
|
''^tests/functional/fmt\.sh$''
|
||||||
''^tests/functional/fmt\.simple\.sh$''
|
''^tests/functional/fmt\.simple\.sh$''
|
||||||
''^tests/functional/function-trace\.sh$''
|
|
||||||
''^tests/functional/gc-auto\.sh$''
|
''^tests/functional/gc-auto\.sh$''
|
||||||
''^tests/functional/gc-concurrent\.builder\.sh$''
|
''^tests/functional/gc-concurrent\.builder\.sh$''
|
||||||
''^tests/functional/gc-concurrent\.sh$''
|
''^tests/functional/gc-concurrent\.sh$''
|
||||||
''^tests/functional/gc-concurrent2\.builder\.sh$''
|
''^tests/functional/gc-concurrent2\.builder\.sh$''
|
||||||
''^tests/functional/gc-non-blocking\.sh$''
|
''^tests/functional/gc-non-blocking\.sh$''
|
||||||
''^tests/functional/gc-runtime\.sh$''
|
|
||||||
''^tests/functional/gc\.sh$''
|
''^tests/functional/gc\.sh$''
|
||||||
''^tests/functional/git-hashing/common\.sh$''
|
''^tests/functional/git-hashing/common\.sh$''
|
||||||
''^tests/functional/git-hashing/simple\.sh$''
|
''^tests/functional/git-hashing/simple\.sh$''
|
||||||
''^tests/functional/hash-convert\.sh$''
|
''^tests/functional/hash-convert\.sh$''
|
||||||
''^tests/functional/hash-path\.sh$''
|
|
||||||
''^tests/functional/help\.sh$''
|
''^tests/functional/help\.sh$''
|
||||||
''^tests/functional/import-derivation\.sh$''
|
|
||||||
''^tests/functional/impure-derivations\.sh$''
|
''^tests/functional/impure-derivations\.sh$''
|
||||||
''^tests/functional/impure-env\.sh$''
|
''^tests/functional/impure-env\.sh$''
|
||||||
''^tests/functional/impure-eval\.sh$''
|
''^tests/functional/impure-eval\.sh$''
|
||||||
''^tests/functional/install-darwin\.sh$''
|
''^tests/functional/install-darwin\.sh$''
|
||||||
''^tests/functional/lang-test-infra\.sh$''
|
|
||||||
''^tests/functional/lang\.sh$''
|
''^tests/functional/lang\.sh$''
|
||||||
''^tests/functional/lang/framework\.sh$''
|
|
||||||
''^tests/functional/legacy-ssh-store\.sh$''
|
''^tests/functional/legacy-ssh-store\.sh$''
|
||||||
''^tests/functional/linux-sandbox\.sh$''
|
''^tests/functional/linux-sandbox\.sh$''
|
||||||
''^tests/functional/local-overlay-store/add-lower-inner\.sh$''
|
''^tests/functional/local-overlay-store/add-lower-inner\.sh$''
|
||||||
|
|
41
meson.build
Normal file
41
meson.build
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# This is just a stub project to include all the others as subprojects
|
||||||
|
# for development shell purposes
|
||||||
|
|
||||||
|
project('nix-dev-shell', 'cpp',
|
||||||
|
version : files('.version'),
|
||||||
|
subproject_dir : 'src',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Internal Libraries
|
||||||
|
subproject('libutil')
|
||||||
|
subproject('libstore')
|
||||||
|
subproject('libfetchers')
|
||||||
|
subproject('libexpr')
|
||||||
|
subproject('libflake')
|
||||||
|
subproject('libmain')
|
||||||
|
subproject('libcmd')
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
subproject('nix')
|
||||||
|
|
||||||
|
# Docs
|
||||||
|
subproject('internal-api-docs')
|
||||||
|
subproject('external-api-docs')
|
||||||
|
|
||||||
|
# External C wrapper libraries
|
||||||
|
subproject('libutil-c')
|
||||||
|
subproject('libstore-c')
|
||||||
|
subproject('libexpr-c')
|
||||||
|
|
||||||
|
# Language Bindings
|
||||||
|
subproject('perl')
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
subproject('nix-util-test-support')
|
||||||
|
subproject('nix-util-tests')
|
||||||
|
subproject('nix-store-test-support')
|
||||||
|
subproject('nix-store-tests')
|
||||||
|
subproject('nix-fetchers-tests')
|
||||||
|
subproject('nix-expr-test-support')
|
||||||
|
subproject('nix-expr-tests')
|
||||||
|
subproject('nix-flake-tests')
|
|
@ -4,7 +4,7 @@
|
||||||
# remove file extension.
|
# remove file extension.
|
||||||
|
|
||||||
test_name=$(echo -n "${test?must be defined by caller (test runner)}" | sed \
|
test_name=$(echo -n "${test?must be defined by caller (test runner)}" | sed \
|
||||||
-e "s|^tests/unit/[^/]*/data/||" \
|
-e "s|^src/[^/]*-test/data/||" \
|
||||||
-e "s|^tests/functional/||" \
|
-e "s|^tests/functional/||" \
|
||||||
-e "s|\.sh$||" \
|
-e "s|\.sh$||" \
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,7 +8,7 @@ GCH = $(buildprefix)precompiled-headers.h.gch
|
||||||
$(GCH): precompiled-headers.h
|
$(GCH): precompiled-headers.h
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
@mkdir -p "$(dir $@)"
|
@mkdir -p "$(dir $@)"
|
||||||
$(trace-gen) $(CXX) -x c++-header -o $@ $< $(GLOBAL_CXXFLAGS) $(GCH_CXXFLAGS)
|
$(trace-gen) $(CXX) -c -x c++-header -o $@ $< $(GLOBAL_CXXFLAGS) $(GCH_CXXFLAGS)
|
||||||
|
|
||||||
clean-files += $(GCH)
|
clean-files += $(GCH)
|
||||||
|
|
||||||
|
|
90
package.nix
90
package.nix
|
@ -1,12 +1,10 @@
|
||||||
{ lib
|
{ lib
|
||||||
, fetchurl
|
|
||||||
, stdenv
|
, stdenv
|
||||||
, releaseTools
|
, releaseTools
|
||||||
, autoconf-archive
|
, autoconf-archive
|
||||||
, autoreconfHook
|
, autoreconfHook
|
||||||
, aws-sdk-cpp
|
, aws-sdk-cpp
|
||||||
, boehmgc
|
, boehmgc
|
||||||
, buildPackages
|
|
||||||
, nlohmann_json
|
, nlohmann_json
|
||||||
, bison
|
, bison
|
||||||
, boost
|
, boost
|
||||||
|
@ -15,12 +13,10 @@
|
||||||
, curl
|
, curl
|
||||||
, editline
|
, editline
|
||||||
, readline
|
, readline
|
||||||
, fileset
|
|
||||||
, flex
|
, flex
|
||||||
, git
|
, git
|
||||||
, gtest
|
, gtest
|
||||||
, jq
|
, jq
|
||||||
, doxygen
|
|
||||||
, libarchive
|
, libarchive
|
||||||
, libcpuid
|
, libcpuid
|
||||||
, libgit2
|
, libgit2
|
||||||
|
@ -36,7 +32,8 @@
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, rapidcheck
|
, rapidcheck
|
||||||
, sqlite
|
, sqlite
|
||||||
, util-linux
|
, toml11
|
||||||
|
, unixtools
|
||||||
, xz
|
, xz
|
||||||
|
|
||||||
, busybox-sandbox-shell ? null
|
, busybox-sandbox-shell ? null
|
||||||
|
@ -51,10 +48,8 @@
|
||||||
, pname ? "nix"
|
, pname ? "nix"
|
||||||
|
|
||||||
, versionSuffix ? ""
|
, versionSuffix ? ""
|
||||||
, officialRelease ? false
|
|
||||||
|
|
||||||
# Whether to build Nix. Useful to skip for tasks like (a) just
|
# Whether to build Nix. Useful to skip for tasks like testing existing pre-built versions of Nix
|
||||||
# generating API docs or (b) testing existing pre-built versions of Nix
|
|
||||||
, doBuild ? true
|
, doBuild ? true
|
||||||
|
|
||||||
# Run the unit tests as part of the build. See `installUnitTests` for an
|
# Run the unit tests as part of the build. See `installUnitTests` for an
|
||||||
|
@ -93,11 +88,6 @@
|
||||||
# - readline
|
# - readline
|
||||||
, readlineFlavor ? if stdenv.hostPlatform.isWindows then "readline" else "editline"
|
, readlineFlavor ? if stdenv.hostPlatform.isWindows then "readline" else "editline"
|
||||||
|
|
||||||
# Whether to build the internal/external API docs, can be done separately from
|
|
||||||
# everything else.
|
|
||||||
, enableInternalAPIDocs ? forDevShell
|
|
||||||
, enableExternalAPIDocs ? forDevShell
|
|
||||||
|
|
||||||
# Whether to install unit tests. This is useful when cross compiling
|
# Whether to install unit tests. This is useful when cross compiling
|
||||||
# since we cannot run them natively during the build, but can do so
|
# since we cannot run them natively during the build, but can do so
|
||||||
# later.
|
# later.
|
||||||
|
@ -120,6 +110,8 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib) fileset;
|
||||||
|
|
||||||
version = lib.fileContents ./.version + versionSuffix;
|
version = lib.fileContents ./.version + versionSuffix;
|
||||||
|
|
||||||
# selected attributes with defaults, will be used to define some
|
# selected attributes with defaults, will be used to define some
|
||||||
|
@ -180,20 +172,11 @@ in {
|
||||||
./doc
|
./doc
|
||||||
./misc
|
./misc
|
||||||
./precompiled-headers.h
|
./precompiled-headers.h
|
||||||
./src
|
(fileset.difference ./src ./src/perl)
|
||||||
./COPYING
|
./COPYING
|
||||||
./scripts/local.mk
|
./scripts/local.mk
|
||||||
] ++ lib.optionals buildUnitTests [
|
] ++ lib.optionals enableManual [
|
||||||
./doc/manual
|
./doc/manual
|
||||||
] ++ lib.optionals enableInternalAPIDocs [
|
|
||||||
./doc/internal-api
|
|
||||||
] ++ lib.optionals enableExternalAPIDocs [
|
|
||||||
./doc/external-api
|
|
||||||
] ++ lib.optionals (enableInternalAPIDocs || enableExternalAPIDocs) [
|
|
||||||
# Source might not be compiled, but still must be available
|
|
||||||
# for Doxygen to gather comments.
|
|
||||||
./src
|
|
||||||
./tests/unit
|
|
||||||
] ++ lib.optionals buildUnitTests [
|
] ++ lib.optionals buildUnitTests [
|
||||||
./tests/unit
|
./tests/unit
|
||||||
] ++ lib.optionals doInstallCheck [
|
] ++ lib.optionals doInstallCheck [
|
||||||
|
@ -207,8 +190,10 @@ in {
|
||||||
++ lib.optional doBuild "dev"
|
++ lib.optional doBuild "dev"
|
||||||
# If we are doing just build or just docs, the one thing will use
|
# If we are doing just build or just docs, the one thing will use
|
||||||
# "out". We only need additional outputs if we are doing both.
|
# "out". We only need additional outputs if we are doing both.
|
||||||
++ lib.optional (doBuild && (enableManual || enableInternalAPIDocs || enableExternalAPIDocs)) "doc"
|
++ lib.optional (doBuild && enableManual) "doc"
|
||||||
++ lib.optional installUnitTests "check";
|
++ lib.optional installUnitTests "check"
|
||||||
|
++ lib.optional doCheck "testresults"
|
||||||
|
;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
autoconf-archive
|
autoconf-archive
|
||||||
|
@ -228,12 +213,10 @@ in {
|
||||||
man # for testing `nix-* --help`
|
man # for testing `nix-* --help`
|
||||||
] ++ lib.optionals (doInstallCheck || enableManual) [
|
] ++ lib.optionals (doInstallCheck || enableManual) [
|
||||||
jq # Also for custom mdBook preprocessor.
|
jq # Also for custom mdBook preprocessor.
|
||||||
] ++ lib.optional stdenv.hostPlatform.isLinux util-linux
|
] ++ lib.optional stdenv.hostPlatform.isStatic unixtools.hexdump
|
||||||
++ lib.optional (enableInternalAPIDocs || enableExternalAPIDocs) doxygen
|
|
||||||
;
|
;
|
||||||
|
|
||||||
buildInputs = lib.optionals doBuild [
|
buildInputs = lib.optionals doBuild [
|
||||||
boost
|
|
||||||
brotli
|
brotli
|
||||||
bzip2
|
bzip2
|
||||||
curl
|
curl
|
||||||
|
@ -242,6 +225,7 @@ in {
|
||||||
libsodium
|
libsodium
|
||||||
openssl
|
openssl
|
||||||
sqlite
|
sqlite
|
||||||
|
toml11
|
||||||
xz
|
xz
|
||||||
({ inherit readline editline; }.${readlineFlavor})
|
({ inherit readline editline; }.${readlineFlavor})
|
||||||
] ++ lib.optionals enableMarkdown [
|
] ++ lib.optionals enableMarkdown [
|
||||||
|
@ -260,40 +244,17 @@ in {
|
||||||
;
|
;
|
||||||
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
|
boost
|
||||||
nlohmann_json
|
nlohmann_json
|
||||||
] ++ lib.optional enableGC boehmgc;
|
] ++ lib.optional enableGC boehmgc;
|
||||||
|
|
||||||
dontBuild = !attrs.doBuild;
|
dontBuild = !attrs.doBuild;
|
||||||
doCheck = attrs.doCheck;
|
doCheck = attrs.doCheck;
|
||||||
|
|
||||||
disallowedReferences = [ boost ];
|
|
||||||
|
|
||||||
preConfigure = lib.optionalString (doBuild && ! stdenv.hostPlatform.isStatic) (
|
|
||||||
''
|
|
||||||
# Copy libboost_context so we don't get all of Boost in our closure.
|
|
||||||
# https://github.com/NixOS/nixpkgs/issues/45462
|
|
||||||
mkdir -p $out/lib
|
|
||||||
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
|
|
||||||
rm -f $out/lib/*.a
|
|
||||||
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
||||||
chmod u+w $out/lib/*.so.*
|
|
||||||
patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
|
|
||||||
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
||||||
for LIB in $out/lib/*.dylib; do
|
|
||||||
chmod u+w $LIB
|
|
||||||
install_name_tool -id $LIB $LIB
|
|
||||||
install_name_tool -delete_rpath ${boost}/lib/ $LIB || true
|
|
||||||
done
|
|
||||||
install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
|
|
||||||
''
|
|
||||||
);
|
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
(lib.enableFeature doBuild "build")
|
(lib.enableFeature doBuild "build")
|
||||||
(lib.enableFeature buildUnitTests "unit-tests")
|
(lib.enableFeature buildUnitTests "unit-tests")
|
||||||
(lib.enableFeature doInstallCheck "functional-tests")
|
(lib.enableFeature doInstallCheck "functional-tests")
|
||||||
(lib.enableFeature enableInternalAPIDocs "internal-api-docs")
|
|
||||||
(lib.enableFeature enableExternalAPIDocs "external-api-docs")
|
|
||||||
(lib.enableFeature enableManual "doc-gen")
|
(lib.enableFeature enableManual "doc-gen")
|
||||||
(lib.enableFeature enableGC "gc")
|
(lib.enableFeature enableGC "gc")
|
||||||
(lib.enableFeature enableMarkdown "markdown")
|
(lib.enableFeature enableMarkdown "markdown")
|
||||||
|
@ -317,9 +278,11 @@ in {
|
||||||
|
|
||||||
makeFlags = "profiledir=$(out)/etc/profile.d PRECOMPILE_HEADERS=1";
|
makeFlags = "profiledir=$(out)/etc/profile.d PRECOMPILE_HEADERS=1";
|
||||||
|
|
||||||
installTargets = lib.optional doBuild "install"
|
preCheck = ''
|
||||||
++ lib.optional enableInternalAPIDocs "internal-api-html"
|
mkdir $testresults
|
||||||
++ lib.optional enableExternalAPIDocs "external-api-html";
|
'';
|
||||||
|
|
||||||
|
installTargets = lib.optional doBuild "install";
|
||||||
|
|
||||||
installFlags = "sysconfdir=$(out)/etc";
|
installFlags = "sysconfdir=$(out)/etc";
|
||||||
|
|
||||||
|
@ -334,22 +297,10 @@ in {
|
||||||
lib.optionalString stdenv.hostPlatform.isStatic ''
|
lib.optionalString stdenv.hostPlatform.isStatic ''
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products
|
echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products
|
||||||
'' + lib.optionalString stdenv.isDarwin ''
|
|
||||||
install_name_tool \
|
|
||||||
-change ${boost}/lib/libboost_context.dylib \
|
|
||||||
$out/lib/libboost_context.dylib \
|
|
||||||
$out/lib/libnixutil.dylib
|
|
||||||
''
|
''
|
||||||
) + lib.optionalString enableManual ''
|
) + lib.optionalString enableManual ''
|
||||||
mkdir -p ''${!outputDoc}/nix-support
|
mkdir -p ''${!outputDoc}/nix-support
|
||||||
echo "doc manual ''${!outputDoc}/share/doc/nix/manual" >> ''${!outputDoc}/nix-support/hydra-build-products
|
echo "doc manual ''${!outputDoc}/share/doc/nix/manual" >> ''${!outputDoc}/nix-support/hydra-build-products
|
||||||
'' + lib.optionalString enableInternalAPIDocs ''
|
|
||||||
mkdir -p ''${!outputDoc}/nix-support
|
|
||||||
echo "doc internal-api-docs $out/share/doc/nix/internal-api/html" >> ''${!outputDoc}/nix-support/hydra-build-products
|
|
||||||
''
|
|
||||||
+ lib.optionalString enableExternalAPIDocs ''
|
|
||||||
mkdir -p ''${!outputDoc}/nix-support
|
|
||||||
echo "doc external-api-docs $out/share/doc/nix/external-api/html" >> ''${!outputDoc}/nix-support/hydra-build-products
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# So the check output gets links for DLLs in the out output.
|
# So the check output gets links for DLLs in the out output.
|
||||||
|
@ -385,8 +336,7 @@ in {
|
||||||
|
|
||||||
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
||||||
|
|
||||||
# TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated
|
# TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564
|
||||||
# to work with `strictDeps`.
|
|
||||||
strictDeps = !withCoverageChecks;
|
strictDeps = !withCoverageChecks;
|
||||||
|
|
||||||
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
|
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
|
||||||
|
|
42
packaging/components.nix
Normal file
42
packaging/components.nix
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
scope:
|
||||||
|
let
|
||||||
|
inherit (scope) callPackage;
|
||||||
|
in
|
||||||
|
|
||||||
|
# This becomes the pkgs.nixComponents attribute set
|
||||||
|
{
|
||||||
|
nix = callPackage ../package.nix { };
|
||||||
|
|
||||||
|
nix-util = callPackage ../src/libutil/package.nix { };
|
||||||
|
nix-util-c = callPackage ../src/libutil-c/package.nix { };
|
||||||
|
nix-util-test-support = callPackage ../tests/unit/libutil-support/package.nix { };
|
||||||
|
nix-util-tests = callPackage ../tests/unit/libutil/package.nix { };
|
||||||
|
|
||||||
|
nix-store = callPackage ../src/libstore/package.nix { };
|
||||||
|
nix-store-c = callPackage ../src/libstore-c/package.nix { };
|
||||||
|
nix-store-test-support = callPackage ../tests/unit/libstore-support/package.nix { };
|
||||||
|
nix-store-tests = callPackage ../tests/unit/libstore/package.nix { };
|
||||||
|
|
||||||
|
nix-fetchers = callPackage ../src/libfetchers/package.nix { };
|
||||||
|
nix-fetchers-tests = callPackage ../tests/unit/libfetchers/package.nix { };
|
||||||
|
|
||||||
|
nix-expr = callPackage ../src/libexpr/package.nix { };
|
||||||
|
nix-expr-c = callPackage ../src/libexpr-c/package.nix { };
|
||||||
|
nix-expr-test-support = callPackage ../tests/unit/libexpr-support/package.nix { };
|
||||||
|
nix-expr-tests = callPackage ../tests/unit/libexpr/package.nix { };
|
||||||
|
|
||||||
|
nix-flake = callPackage ../src/libflake/package.nix { };
|
||||||
|
nix-flake-tests = callPackage ../tests/unit/libflake/package.nix { };
|
||||||
|
|
||||||
|
nix-main = callPackage ../src/libmain/package.nix { };
|
||||||
|
|
||||||
|
nix-cmd = callPackage ../src/libcmd/package.nix { };
|
||||||
|
|
||||||
|
# Will replace `nix` once the old build system is gone.
|
||||||
|
nix-ng = callPackage ../src/nix/package.nix { };
|
||||||
|
|
||||||
|
nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { };
|
||||||
|
nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { };
|
||||||
|
|
||||||
|
nix-perl-bindings = callPackage ../src/perl/package.nix { };
|
||||||
|
}
|
117
packaging/dependencies.nix
Normal file
117
packaging/dependencies.nix
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
# These overrides are applied to the dependencies of the Nix components.
|
||||||
|
|
||||||
|
{
|
||||||
|
# Flake inputs; used for sources
|
||||||
|
inputs,
|
||||||
|
|
||||||
|
# The raw Nixpkgs, not affected by this scope
|
||||||
|
pkgs,
|
||||||
|
|
||||||
|
stdenv,
|
||||||
|
versionSuffix,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
|
root = ../.;
|
||||||
|
|
||||||
|
# Nixpkgs implements this by returning a subpath into the fetched Nix sources.
|
||||||
|
resolvePath = p: p;
|
||||||
|
|
||||||
|
# Indirection for Nixpkgs to override when package.nix files are vendored
|
||||||
|
filesetToSource = lib.fileset.toSource;
|
||||||
|
|
||||||
|
localSourceLayer = finalAttrs: prevAttrs:
|
||||||
|
let
|
||||||
|
workDirPath =
|
||||||
|
# Ideally we'd pick finalAttrs.workDir, but for now `mkDerivation` has
|
||||||
|
# the requirement that everything except passthru and meta must be
|
||||||
|
# serialized by mkDerivation, which doesn't work for this.
|
||||||
|
prevAttrs.workDir;
|
||||||
|
|
||||||
|
workDirSubpath = lib.path.removePrefix root workDirPath;
|
||||||
|
sources = assert prevAttrs.fileset._type == "fileset"; prevAttrs.fileset;
|
||||||
|
src = lib.fileset.toSource { fileset = sources; inherit root; };
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
sourceRoot = "${src.name}/" + workDirSubpath;
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
# Clear what `derivation` can't/shouldn't serialize; see prevAttrs.workDir.
|
||||||
|
fileset = null;
|
||||||
|
workDir = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
scope: {
|
||||||
|
inherit stdenv versionSuffix;
|
||||||
|
version = lib.fileContents ../.version + versionSuffix;
|
||||||
|
|
||||||
|
libseccomp = pkgs.libseccomp.overrideAttrs (_: rec {
|
||||||
|
version = "2.5.5";
|
||||||
|
src = pkgs.fetchurl {
|
||||||
|
url = "https://github.com/seccomp/libseccomp/releases/download/v${version}/libseccomp-${version}.tar.gz";
|
||||||
|
hash = "sha256-JIosik2bmFiqa69ScSw0r+/PnJ6Ut23OAsHJqiX7M3U=";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
boehmgc = pkgs.boehmgc.override {
|
||||||
|
enableLargeConfig = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
|
||||||
|
boost = (pkgs.boost.override {
|
||||||
|
extraB2Args = [
|
||||||
|
"--with-container"
|
||||||
|
"--with-context"
|
||||||
|
"--with-coroutine"
|
||||||
|
];
|
||||||
|
}).overrideAttrs (old: {
|
||||||
|
# Need to remove `--with-*` to use `--with-libraries=...`
|
||||||
|
buildPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.buildPhase;
|
||||||
|
installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase;
|
||||||
|
});
|
||||||
|
|
||||||
|
libgit2 = pkgs.libgit2.overrideAttrs (attrs: {
|
||||||
|
src = inputs.libgit2;
|
||||||
|
version = inputs.libgit2.lastModifiedDate;
|
||||||
|
cmakeFlags = attrs.cmakeFlags or []
|
||||||
|
++ [ "-DUSE_SSH=exec" ];
|
||||||
|
});
|
||||||
|
|
||||||
|
busybox-sandbox-shell = pkgs.busybox-sandbox-shell or (pkgs.busybox.override {
|
||||||
|
useMusl = true;
|
||||||
|
enableStatic = true;
|
||||||
|
enableMinimal = true;
|
||||||
|
extraConfig = ''
|
||||||
|
CONFIG_FEATURE_FANCY_ECHO y
|
||||||
|
CONFIG_FEATURE_SH_MATH y
|
||||||
|
CONFIG_FEATURE_SH_MATH_64 y
|
||||||
|
|
||||||
|
CONFIG_ASH y
|
||||||
|
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
|
||||||
|
|
||||||
|
CONFIG_ASH_ALIAS y
|
||||||
|
CONFIG_ASH_BASH_COMPAT y
|
||||||
|
CONFIG_ASH_CMDCMD y
|
||||||
|
CONFIG_ASH_ECHO y
|
||||||
|
CONFIG_ASH_GETOPTS y
|
||||||
|
CONFIG_ASH_INTERNAL_GLOB y
|
||||||
|
CONFIG_ASH_JOB_CONTROL y
|
||||||
|
CONFIG_ASH_PRINTF y
|
||||||
|
CONFIG_ASH_TEST y
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
# TODO change in Nixpkgs, Windows works fine. First commit of
|
||||||
|
# https://github.com/NixOS/nixpkgs/pull/322977 backported will fix.
|
||||||
|
toml11 = pkgs.toml11.overrideAttrs (old: {
|
||||||
|
meta.platforms = lib.platforms.all;
|
||||||
|
});
|
||||||
|
|
||||||
|
inherit resolvePath filesetToSource;
|
||||||
|
|
||||||
|
mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f);
|
||||||
|
}
|
|
@ -9,7 +9,6 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (inputs) nixpkgs nixpkgs-regression;
|
inherit (inputs) nixpkgs nixpkgs-regression;
|
||||||
inherit (lib) fileset;
|
|
||||||
|
|
||||||
installScriptFor = tarballs:
|
installScriptFor = tarballs:
|
||||||
nixpkgsFor.x86_64-linux.native.callPackage ../scripts/installer.nix {
|
nixpkgsFor.x86_64-linux.native.callPackage ../scripts/installer.nix {
|
||||||
|
@ -25,36 +24,57 @@ let
|
||||||
lib.versionAtLeast client.version "2.4pre20211005")
|
lib.versionAtLeast client.version "2.4pre20211005")
|
||||||
"-${client.version}-against-${daemon.version}";
|
"-${client.version}-against-${daemon.version}";
|
||||||
|
|
||||||
inherit fileset;
|
|
||||||
|
|
||||||
test-client = client;
|
test-client = client;
|
||||||
test-daemon = daemon;
|
test-daemon = daemon;
|
||||||
|
|
||||||
doBuild = false;
|
doBuild = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Technically we could just return `pkgs.nixComponents`, but for Hydra it's
|
||||||
|
# convention to transpose it, and to transpose it efficiently, we need to
|
||||||
|
# enumerate them manually, so that we don't evaluate unnecessary package sets.
|
||||||
|
forAllPackages = lib.genAttrs [
|
||||||
|
"nix"
|
||||||
|
"nix-util"
|
||||||
|
"nix-util-c"
|
||||||
|
"nix-util-test-support"
|
||||||
|
"nix-util-tests"
|
||||||
|
"nix-store"
|
||||||
|
"nix-store-c"
|
||||||
|
"nix-store-test-support"
|
||||||
|
"nix-store-tests"
|
||||||
|
"nix-fetchers"
|
||||||
|
"nix-fetchers-tests"
|
||||||
|
"nix-expr"
|
||||||
|
"nix-expr-c"
|
||||||
|
"nix-expr-test-support"
|
||||||
|
"nix-expr-tests"
|
||||||
|
"nix-flake"
|
||||||
|
"nix-flake-tests"
|
||||||
|
"nix-main"
|
||||||
|
"nix-cmd"
|
||||||
|
"nix-ng"
|
||||||
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Binary package for various platforms.
|
# Binary package for various platforms.
|
||||||
build = forAllSystems (system: self.packages.${system}.nix);
|
build = forAllPackages (pkgName:
|
||||||
|
forAllSystems (system: nixpkgsFor.${system}.native.nixComponents.${pkgName}));
|
||||||
|
|
||||||
shellInputs = forAllSystems (system: self.devShells.${system}.default.inputDerivation);
|
shellInputs = forAllSystems (system: self.devShells.${system}.default.inputDerivation);
|
||||||
|
|
||||||
buildStatic = lib.genAttrs linux64BitSystems (system: self.packages.${system}.nix-static);
|
buildStatic = forAllPackages (pkgName:
|
||||||
|
lib.genAttrs linux64BitSystems (system: nixpkgsFor.${system}.static.nixComponents.${pkgName}));
|
||||||
|
|
||||||
buildCross = forAllCrossSystems (crossSystem:
|
buildCross = forAllPackages (pkgName:
|
||||||
lib.genAttrs [ "x86_64-linux" ] (system: self.packages.${system}."nix-${crossSystem}"));
|
forAllCrossSystems (crossSystem:
|
||||||
|
lib.genAttrs [ "x86_64-linux" ] (system: nixpkgsFor.${system}.cross.${crossSystem}.nixComponents.${pkgName})));
|
||||||
|
|
||||||
buildNoGc = forAllSystems (system:
|
buildNoGc = forAllSystems (system:
|
||||||
self.packages.${system}.nix.override { enableGC = false; }
|
self.packages.${system}.nix.override { enableGC = false; }
|
||||||
);
|
);
|
||||||
|
|
||||||
buildNoTests = forAllSystems (system:
|
buildNoTests = forAllSystems (system: nixpkgsFor.${system}.native.nix_noTests);
|
||||||
self.packages.${system}.nix.override {
|
|
||||||
doCheck = false;
|
|
||||||
doInstallCheck = false;
|
|
||||||
installUnitTests = false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
# Toggles some settings for better coverage. Windows needs these
|
# Toggles some settings for better coverage. Windows needs these
|
||||||
# library combinations, and Debian build Nix with GNU readline too.
|
# library combinations, and Debian build Nix with GNU readline too.
|
||||||
|
@ -66,7 +86,7 @@ in
|
||||||
);
|
);
|
||||||
|
|
||||||
# Perl bindings for various platforms.
|
# Perl bindings for various platforms.
|
||||||
perlBindings = forAllSystems (system: nixpkgsFor.${system}.native.nix.perl-bindings);
|
perlBindings = forAllSystems (system: nixpkgsFor.${system}.native.nixComponents.nix-perl-bindings);
|
||||||
|
|
||||||
# Binary tarball for various platforms, containing a Nix store
|
# Binary tarball for various platforms, containing a Nix store
|
||||||
# with the closure of 'nix' package, and the second half of
|
# with the closure of 'nix' package, and the second half of
|
||||||
|
@ -76,7 +96,7 @@ in
|
||||||
binaryTarballCross = lib.genAttrs [ "x86_64-linux" ] (system:
|
binaryTarballCross = lib.genAttrs [ "x86_64-linux" ] (system:
|
||||||
forAllCrossSystems (crossSystem:
|
forAllCrossSystems (crossSystem:
|
||||||
binaryTarball
|
binaryTarball
|
||||||
self.packages.${system}."nix-${crossSystem}"
|
nixpkgsFor.${system}.cross.${crossSystem}.nix
|
||||||
nixpkgsFor.${system}.cross.${crossSystem}));
|
nixpkgsFor.${system}.cross.${crossSystem}));
|
||||||
|
|
||||||
# The first half of the installation script. This is uploaded
|
# The first half of the installation script. This is uploaded
|
||||||
|
@ -98,7 +118,7 @@ in
|
||||||
installerScriptForGHA = installScriptFor [
|
installerScriptForGHA = installScriptFor [
|
||||||
# Native
|
# Native
|
||||||
self.hydraJobs.binaryTarball."x86_64-linux"
|
self.hydraJobs.binaryTarball."x86_64-linux"
|
||||||
self.hydraJobs.binaryTarball."x86_64-darwin"
|
self.hydraJobs.binaryTarball."aarch64-darwin"
|
||||||
# Cross
|
# Cross
|
||||||
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv6l-unknown-linux-gnueabihf"
|
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv6l-unknown-linux-gnueabihf"
|
||||||
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv7l-unknown-linux-gnueabihf"
|
self.hydraJobs.binaryTarballCross."x86_64-linux"."armv7l-unknown-linux-gnueabihf"
|
||||||
|
@ -115,18 +135,10 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
# API docs for Nix's unstable internal C++ interfaces.
|
# API docs for Nix's unstable internal C++ interfaces.
|
||||||
internal-api-docs = nixpkgsFor.x86_64-linux.native.callPackage ../package.nix {
|
internal-api-docs = nixpkgsFor.x86_64-linux.native.nixComponents.nix-internal-api-docs;
|
||||||
inherit fileset;
|
|
||||||
doBuild = false;
|
|
||||||
enableInternalAPIDocs = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# API docs for Nix's C bindings.
|
# API docs for Nix's C bindings.
|
||||||
external-api-docs = nixpkgsFor.x86_64-linux.native.callPackage ../package.nix {
|
external-api-docs = nixpkgsFor.x86_64-linux.native.nixComponents.nix-external-api-docs;
|
||||||
inherit fileset;
|
|
||||||
doBuild = false;
|
|
||||||
enableExternalAPIDocs = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# System tests.
|
# System tests.
|
||||||
tests = import ../tests/nixos { inherit lib nixpkgs nixpkgsFor self; } // {
|
tests = import ../tests/nixos { inherit lib nixpkgs nixpkgsFor self; } // {
|
|
@ -1,33 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
# set -x
|
|
||||||
|
|
||||||
|
|
||||||
# mapfile BUILDS_FOR_LATEST_EVAL < <(
|
|
||||||
# curl -H 'Accept: application/json' https://hydra.nixos.org/jobset/nix/master/evals | \
|
|
||||||
# jq -r '.evals[0].builds[] | @sh')
|
|
||||||
BUILDS_FOR_LATEST_EVAL=$(
|
|
||||||
curl -sS -H 'Accept: application/json' https://hydra.nixos.org/jobset/nix/master/evals | \
|
|
||||||
jq -r '.evals[0].builds[]')
|
|
||||||
|
|
||||||
someBuildFailed=0
|
|
||||||
|
|
||||||
for buildId in $BUILDS_FOR_LATEST_EVAL; do
|
|
||||||
buildInfo=$(curl --fail -sS -H 'Accept: application/json' "https://hydra.nixos.org/build/$buildId")
|
|
||||||
|
|
||||||
finished=$(echo "$buildInfo" | jq -r '.finished')
|
|
||||||
|
|
||||||
if [[ $finished = 0 ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
buildStatus=$(echo "$buildInfo" | jq -r '.buildstatus')
|
|
||||||
|
|
||||||
if [[ $buildStatus != 0 ]]; then
|
|
||||||
someBuildFailed=1
|
|
||||||
echo "Job “$(echo "$buildInfo" | jq -r '.job')” failed on hydra: $buildInfo"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
exit "$someBuildFailed"
|
|
|
@ -754,7 +754,7 @@ I will:
|
||||||
(if it does, I will tell you how to clean them up.)
|
(if it does, I will tell you how to clean them up.)
|
||||||
- create local users (see the list above for the users I'll make)
|
- create local users (see the list above for the users I'll make)
|
||||||
- create a local group ($NIX_BUILD_GROUP_NAME)
|
- create a local group ($NIX_BUILD_GROUP_NAME)
|
||||||
- install Nix in to $NIX_ROOT
|
- install Nix in $NIX_ROOT
|
||||||
- create a configuration file in /etc/nix
|
- create a configuration file in /etc/nix
|
||||||
- set up the "default profile" by creating some Nix-related files in
|
- set up the "default profile" by creating some Nix-related files in
|
||||||
$ROOT_HOME
|
$ROOT_HOME
|
||||||
|
|
1
src/external-api-docs/.version
Symbolic link
1
src/external-api-docs/.version
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../.version
|
|
@ -12,7 +12,9 @@ PROJECT_NAME = "Nix"
|
||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = @PACKAGE_VERSION@
|
PROJECT_NUMBER = @PROJECT_NUMBER@
|
||||||
|
|
||||||
|
OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
|
@ -36,10 +38,10 @@ GENERATE_LATEX = NO
|
||||||
# so they can expand variables despite configure variables.
|
# so they can expand variables despite configure variables.
|
||||||
|
|
||||||
INPUT = \
|
INPUT = \
|
||||||
src/libutil-c \
|
@src@/src/libutil-c \
|
||||||
src/libexpr-c \
|
@src@/src/libexpr-c \
|
||||||
src/libstore-c \
|
@src@/src/libstore-c \
|
||||||
doc/external-api/README.md
|
@src@/doc/external-api/README.md
|
||||||
|
|
||||||
FILE_PATTERNS = nix_api_*.h *.md
|
FILE_PATTERNS = nix_api_*.h *.md
|
||||||
|
|
||||||
|
@ -49,7 +51,6 @@ FILE_PATTERNS = nix_api_*.h *.md
|
||||||
# RECURSIVE has no effect here.
|
# RECURSIVE has no effect here.
|
||||||
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
|
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
|
||||||
|
|
||||||
INCLUDE_PATH = @RAPIDCHECK_HEADERS@
|
|
||||||
EXCLUDE_PATTERNS = *_internal.h
|
EXCLUDE_PATTERNS = *_internal.h
|
||||||
GENERATE_TREEVIEW = YES
|
GENERATE_TREEVIEW = YES
|
||||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
OPTIMIZE_OUTPUT_FOR_C = YES
|
31
src/external-api-docs/meson.build
Normal file
31
src/external-api-docs/meson.build
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
project('nix-external-api-docs',
|
||||||
|
version : files('.version'),
|
||||||
|
meson_version : '>= 1.1',
|
||||||
|
license : 'LGPL-2.1-or-later',
|
||||||
|
)
|
||||||
|
|
||||||
|
fs = import('fs')
|
||||||
|
|
||||||
|
doxygen_cfg = configure_file(
|
||||||
|
input : 'doxygen.cfg.in',
|
||||||
|
output : 'doxygen.cfg',
|
||||||
|
configuration : {
|
||||||
|
'PROJECT_NUMBER': meson.project_version(),
|
||||||
|
'OUTPUT_DIRECTORY' : meson.current_build_dir(),
|
||||||
|
'src' : fs.parent(fs.parent(meson.project_source_root())),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
doxygen = find_program('doxygen', native : true, required : true)
|
||||||
|
|
||||||
|
custom_target(
|
||||||
|
'external-api-docs',
|
||||||
|
command : [ doxygen , doxygen_cfg ],
|
||||||
|
input : [
|
||||||
|
doxygen_cfg,
|
||||||
|
],
|
||||||
|
output : 'html',
|
||||||
|
install : true,
|
||||||
|
install_dir : get_option('datadir') / 'doc/nix/external-api',
|
||||||
|
build_always_stale : true,
|
||||||
|
)
|
63
src/external-api-docs/package.nix
Normal file
63
src/external-api-docs/package.nix
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
{ lib
|
||||||
|
, mkMesonDerivation
|
||||||
|
|
||||||
|
, meson
|
||||||
|
, ninja
|
||||||
|
, doxygen
|
||||||
|
|
||||||
|
# Configuration Options
|
||||||
|
|
||||||
|
, version
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) fileset;
|
||||||
|
in
|
||||||
|
|
||||||
|
mkMesonDerivation (finalAttrs: {
|
||||||
|
pname = "nix-external-api-docs";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
workDir = ./.;
|
||||||
|
fileset =
|
||||||
|
let
|
||||||
|
cpp = fileset.fileFilter (file: file.hasExt "cc" || file.hasExt "h");
|
||||||
|
in
|
||||||
|
fileset.unions [
|
||||||
|
./.version
|
||||||
|
../../.version
|
||||||
|
./meson.build
|
||||||
|
./doxygen.cfg.in
|
||||||
|
./README.md
|
||||||
|
# Source is not compiled, but still must be available for Doxygen
|
||||||
|
# to gather comments.
|
||||||
|
(cpp ../libexpr-c)
|
||||||
|
(cpp ../libstore-c)
|
||||||
|
(cpp ../libutil-c)
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
meson
|
||||||
|
ninja
|
||||||
|
doxygen
|
||||||
|
];
|
||||||
|
|
||||||
|
preConfigure =
|
||||||
|
''
|
||||||
|
chmod u+w ./.version
|
||||||
|
echo ${finalAttrs.version} > ./.version
|
||||||
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
mkdir -p ''${!outputDoc}/nix-support
|
||||||
|
echo "doc external-api-docs $out/share/doc/nix/external-api/html" >> ''${!outputDoc}/nix-support/hydra-build-products
|
||||||
|
'';
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
platforms = lib.platforms.all;
|
||||||
|
};
|
||||||
|
})
|
1
src/internal-api-docs/.version
Symbolic link
1
src/internal-api-docs/.version
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../.version
|
|
@ -12,7 +12,9 @@ PROJECT_NAME = "Nix"
|
||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = @PACKAGE_VERSION@
|
PROJECT_NUMBER = @PROJECT_NUMBER@
|
||||||
|
|
||||||
|
OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
|
@ -36,27 +38,27 @@ GENERATE_LATEX = NO
|
||||||
# so they can expand variables despite configure variables.
|
# so they can expand variables despite configure variables.
|
||||||
|
|
||||||
INPUT = \
|
INPUT = \
|
||||||
src/libcmd \
|
@src@/libcmd \
|
||||||
src/libexpr \
|
@src@/libexpr \
|
||||||
src/libexpr/flake \
|
@src@/libexpr/flake \
|
||||||
tests/unit/libexpr \
|
@src@/nix-expr-tests \
|
||||||
tests/unit/libexpr/value \
|
@src@/nix-expr-tests/value \
|
||||||
tests/unit/libexpr/test \
|
@src@/nix-expr-test-support/test \
|
||||||
tests/unit/libexpr/test/value \
|
@src@/nix-expr-test-support/test/value \
|
||||||
src/libexpr/value \
|
@src@/libexpr/value \
|
||||||
src/libfetchers \
|
@src@/libfetchers \
|
||||||
src/libmain \
|
@src@/libmain \
|
||||||
src/libstore \
|
@src@/libstore \
|
||||||
src/libstore/build \
|
@src@/libstore/build \
|
||||||
src/libstore/builtins \
|
@src@/libstore/builtins \
|
||||||
tests/unit/libstore \
|
@src@/nix-store-tests \
|
||||||
tests/unit/libstore/test \
|
@src@/nix-store-test-support/test \
|
||||||
src/libutil \
|
@src@/libutil \
|
||||||
tests/unit/libutil \
|
@src@/nix-util-tests \
|
||||||
tests/unit/libutil/test \
|
@src@/nix-util-test-support/test \
|
||||||
src/nix \
|
@src@/nix \
|
||||||
src/nix-env \
|
@src@/nix-env \
|
||||||
src/nix-store
|
@src@/nix-store
|
||||||
|
|
||||||
# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
|
# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
|
||||||
# in the source code. If set to NO, only conditional compilation will be
|
# in the source code. If set to NO, only conditional compilation will be
|
31
src/internal-api-docs/meson.build
Normal file
31
src/internal-api-docs/meson.build
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
project('nix-internal-api-docs',
|
||||||
|
version : files('.version'),
|
||||||
|
meson_version : '>= 1.1',
|
||||||
|
license : 'LGPL-2.1-or-later',
|
||||||
|
)
|
||||||
|
|
||||||
|
fs = import('fs')
|
||||||
|
|
||||||
|
doxygen_cfg = configure_file(
|
||||||
|
input : 'doxygen.cfg.in',
|
||||||
|
output : 'doxygen.cfg',
|
||||||
|
configuration : {
|
||||||
|
'PROJECT_NUMBER': meson.project_version(),
|
||||||
|
'OUTPUT_DIRECTORY' : meson.current_build_dir(),
|
||||||
|
'src' : fs.parent(fs.parent(meson.project_source_root())) / 'src',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
doxygen = find_program('doxygen', native : true, required : true)
|
||||||
|
|
||||||
|
custom_target(
|
||||||
|
'internal-api-docs',
|
||||||
|
command : [ doxygen , doxygen_cfg ],
|
||||||
|
input : [
|
||||||
|
doxygen_cfg,
|
||||||
|
],
|
||||||
|
output : 'html',
|
||||||
|
install : true,
|
||||||
|
install_dir : get_option('datadir') / 'doc/nix/internal-api',
|
||||||
|
build_always_stale : true,
|
||||||
|
)
|
58
src/internal-api-docs/package.nix
Normal file
58
src/internal-api-docs/package.nix
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{ lib
|
||||||
|
, mkMesonDerivation
|
||||||
|
|
||||||
|
, meson
|
||||||
|
, ninja
|
||||||
|
, doxygen
|
||||||
|
|
||||||
|
# Configuration Options
|
||||||
|
|
||||||
|
, version
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) fileset;
|
||||||
|
in
|
||||||
|
|
||||||
|
mkMesonDerivation (finalAttrs: {
|
||||||
|
pname = "nix-internal-api-docs";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
workDir = ./.;
|
||||||
|
fileset = let
|
||||||
|
cpp = fileset.fileFilter (file: file.hasExt "cc" || file.hasExt "hh");
|
||||||
|
in fileset.unions [
|
||||||
|
./.version
|
||||||
|
../../.version
|
||||||
|
./meson.build
|
||||||
|
./doxygen.cfg.in
|
||||||
|
# Source is not compiled, but still must be available for Doxygen
|
||||||
|
# to gather comments.
|
||||||
|
(cpp ../.)
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
meson
|
||||||
|
ninja
|
||||||
|
doxygen
|
||||||
|
];
|
||||||
|
|
||||||
|
preConfigure =
|
||||||
|
''
|
||||||
|
chmod u+w ./.version
|
||||||
|
echo ${finalAttrs.version} > ./.version
|
||||||
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
mkdir -p ''${!outputDoc}/nix-support
|
||||||
|
echo "doc internal-api-docs $out/share/doc/nix/internal-api/html" >> ''${!outputDoc}/nix-support/hydra-build-products
|
||||||
|
'';
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
platforms = lib.platforms.all;
|
||||||
|
};
|
||||||
|
})
|
1
src/libcmd/.version
Symbolic link
1
src/libcmd/.version
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../.version
|
1
src/libcmd/build-utils-meson
Symbolic link
1
src/libcmd/build-utils-meson
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../build-utils-meson
|
|
@ -127,12 +127,12 @@ ref<EvalState> EvalCommand::getEvalState()
|
||||||
if (!evalState) {
|
if (!evalState) {
|
||||||
evalState =
|
evalState =
|
||||||
#if HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
std::allocate_shared<EvalState>(traceable_allocator<EvalState>(),
|
std::allocate_shared<EvalState>(
|
||||||
lookupPath, getEvalStore(), getStore())
|
traceable_allocator<EvalState>(),
|
||||||
#else
|
#else
|
||||||
std::make_shared<EvalState>(
|
std::make_shared<EvalState>(
|
||||||
lookupPath, getEvalStore(), getStore())
|
|
||||||
#endif
|
#endif
|
||||||
|
lookupPath, getEvalStore(), evalSettings, getStore())
|
||||||
;
|
;
|
||||||
|
|
||||||
evalState->repair = repair;
|
evalState->repair = repair;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "eval-settings.hh"
|
#include "eval-settings.hh"
|
||||||
#include "common-eval-args.hh"
|
#include "common-eval-args.hh"
|
||||||
#include "shared.hh"
|
#include "shared.hh"
|
||||||
|
#include "config-global.hh"
|
||||||
#include "filetransfer.hh"
|
#include "filetransfer.hh"
|
||||||
#include "eval.hh"
|
#include "eval.hh"
|
||||||
#include "fetchers.hh"
|
#include "fetchers.hh"
|
||||||
|
@ -10,9 +11,35 @@
|
||||||
#include "command.hh"
|
#include "command.hh"
|
||||||
#include "tarball.hh"
|
#include "tarball.hh"
|
||||||
#include "fetch-to-store.hh"
|
#include "fetch-to-store.hh"
|
||||||
|
#include "compatibility-settings.hh"
|
||||||
|
#include "eval-settings.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
EvalSettings evalSettings {
|
||||||
|
settings.readOnlyMode,
|
||||||
|
{
|
||||||
|
{
|
||||||
|
"flake",
|
||||||
|
[](ref<Store> store, std::string_view rest) {
|
||||||
|
experimentalFeatureSettings.require(Xp::Flakes);
|
||||||
|
// FIXME `parseFlakeRef` should take a `std::string_view`.
|
||||||
|
auto flakeRef = parseFlakeRef(std::string { rest }, {}, true, false);
|
||||||
|
debug("fetching flake search path element '%s''", rest);
|
||||||
|
auto storePath = flakeRef.resolve(store).fetchTree(store).first;
|
||||||
|
return store->toRealPath(storePath);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static GlobalConfig::Register rEvalSettings(&evalSettings);
|
||||||
|
|
||||||
|
CompatibilitySettings compatibilitySettings {};
|
||||||
|
|
||||||
|
static GlobalConfig::Register rCompatibilitySettings(&compatibilitySettings);
|
||||||
|
|
||||||
|
|
||||||
MixEvalArgs::MixEvalArgs()
|
MixEvalArgs::MixEvalArgs()
|
||||||
{
|
{
|
||||||
addFlag({
|
addFlag({
|
||||||
|
@ -54,7 +81,7 @@ MixEvalArgs::MixEvalArgs()
|
||||||
.description = R"(
|
.description = R"(
|
||||||
Add *path* to the Nix search path. The Nix search path is
|
Add *path* to the Nix search path. The Nix search path is
|
||||||
initialized from the colon-separated [`NIX_PATH`](@docroot@/command-ref/env-common.md#env-NIX_PATH) environment
|
initialized from the colon-separated [`NIX_PATH`](@docroot@/command-ref/env-common.md#env-NIX_PATH) environment
|
||||||
variable, and is used to look up the location of Nix expressions using [paths](@docroot@/language/values.md#type-path) enclosed in angle
|
variable, and is used to look up the location of Nix expressions using [paths](@docroot@/language/types.md#type-path) enclosed in angle
|
||||||
brackets (i.e., `<nixpkgs>`).
|
brackets (i.e., `<nixpkgs>`).
|
||||||
|
|
||||||
For instance, passing
|
For instance, passing
|
||||||
|
|
|
@ -12,9 +12,21 @@ namespace nix {
|
||||||
|
|
||||||
class Store;
|
class Store;
|
||||||
class EvalState;
|
class EvalState;
|
||||||
|
struct EvalSettings;
|
||||||
|
struct CompatibilitySettings;
|
||||||
class Bindings;
|
class Bindings;
|
||||||
struct SourcePath;
|
struct SourcePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo Get rid of global setttings variables
|
||||||
|
*/
|
||||||
|
extern EvalSettings evalSettings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings that control behaviors that have changed since Nix 2.3.
|
||||||
|
*/
|
||||||
|
extern CompatibilitySettings compatibilitySettings;
|
||||||
|
|
||||||
struct MixEvalArgs : virtual Args, virtual MixRepair
|
struct MixEvalArgs : virtual Args, virtual MixRepair
|
||||||
{
|
{
|
||||||
static constexpr auto category = "Common evaluation options";
|
static constexpr auto category = "Common evaluation options";
|
||||||
|
|
19
src/libcmd/compatibility-settings.hh
Normal file
19
src/libcmd/compatibility-settings.hh
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#pragma once
|
||||||
|
#include "config.hh"
|
||||||
|
|
||||||
|
namespace nix {
|
||||||
|
struct CompatibilitySettings : public Config
|
||||||
|
{
|
||||||
|
|
||||||
|
CompatibilitySettings() = default;
|
||||||
|
|
||||||
|
Setting<bool> nixShellAlwaysLooksForShellNix{this, true, "nix-shell-always-looks-for-shell-nix", R"(
|
||||||
|
Before Nix 2.24, [`nix-shell`](@docroot@/command-ref/nix-shell.md) would only look at `shell.nix` if it was in the working directory - when no file was specified.
|
||||||
|
|
||||||
|
Since Nix 2.24, `nix-shell` always looks for a `shell.nix`, whether that's in the working directory, or in a directory that was passed as an argument.
|
||||||
|
|
||||||
|
You may set this to `false` to revert to the Nix 2.3 behavior.
|
||||||
|
)"};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
|
@ -6,10 +6,10 @@ libcmd_DIR := $(d)
|
||||||
|
|
||||||
libcmd_SOURCES := $(wildcard $(d)/*.cc)
|
libcmd_SOURCES := $(wildcard $(d)/*.cc)
|
||||||
|
|
||||||
libcmd_CXXFLAGS += $(INCLUDE_libutil) $(INCLUDE_libstore) $(INCLUDE_libfetchers) $(INCLUDE_libexpr) $(INCLUDE_libmain)
|
libcmd_CXXFLAGS += $(INCLUDE_libutil) $(INCLUDE_libstore) $(INCLUDE_libfetchers) $(INCLUDE_libexpr) $(INCLUDE_libflake) $(INCLUDE_libmain)
|
||||||
|
|
||||||
libcmd_LDFLAGS = $(EDITLINE_LIBS) $(LOWDOWN_LIBS) $(THREAD_LDFLAGS)
|
libcmd_LDFLAGS = $(EDITLINE_LIBS) $(LOWDOWN_LIBS) $(THREAD_LDFLAGS)
|
||||||
|
|
||||||
libcmd_LIBS = libstore libutil libexpr libmain libfetchers
|
libcmd_LIBS = libutil libstore libfetchers libflake libexpr libmain
|
||||||
|
|
||||||
$(eval $(call install-file-in, $(buildprefix)$(d)/nix-cmd.pc, $(libdir)/pkgconfig, 0644))
|
$(eval $(call install-file-in, $(buildprefix)$(d)/nix-cmd.pc, $(libdir)/pkgconfig, 0644))
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue