Merge remote-tracking branch 'upstream/master' into more-nix-shell

This commit is contained in:
Robert Hensing 2024-07-10 16:19:18 +02:00
commit d942d505ca
71 changed files with 518 additions and 321 deletions

View file

@ -205,4 +205,6 @@ 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.build.{nix-fetchers,nix-store,nix-util}.$(nix-instantiate --eval --expr builtins.currentSystem | sed -e 's/"//g') # 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')

View file

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

View 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',
)

View file

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

View file

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

View file

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

View file

@ -32,11 +32,10 @@
- [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)
- [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)

View file

@ -29,6 +29,7 @@
/expressions/* /language/:splat 301! /expressions/* /language/:splat 301!
/language/values /language/types 301! /language/values /language/types 301!
/language/constructs /language/syntax 301! /language/constructs /language/syntax 301!
/language/builtin-constants /language/builtins 301!
/installation/installation /installation 301! /installation/installation /installation 301!

View file

@ -1,5 +0,0 @@
# Built-in Constants
These constants are built into the Nix language evaluator:
<dl>

View file

@ -1 +0,0 @@
</dl>

View file

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

View file

@ -6,7 +6,7 @@
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. 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.

View file

@ -64,7 +64,7 @@ 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/types.md#type-path) | [String](@docroot@/language/types.md#type-string)) - [`builder`]{#attr-builder} ([Path](@docroot@/language/types.md#type-path) | [String](@docroot@/language/types.md#type-string))

View file

@ -37,7 +37,7 @@ A _boolean_ in the Nix language is one of _true_ or _false_.
<!-- TODO: mention the top-level environment --> <!-- TODO: mention the top-level environment -->
These values are available as attributes of [`builtins`](builtin-constants.md#builtins-builtins) as [`builtins.true`](builtin-constants.md#builtins-true) and [`builtins.false`](builtin-constants.md#builtins-false). 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. The function [`builtins.isBool`](builtins.md#builtins-isBool) can be used to determine if a value is a boolean.
### String {#type-string} ### String {#type-string}
@ -60,7 +60,7 @@ There is a single value of type _null_ in the Nix language.
<!-- TODO: mention the top-level environment --> <!-- TODO: mention the top-level environment -->
This value is available as an attribute on the [`builtins`](builtin-constants.md#builtins-builtins) attribute set as [`builtins.null`](builtin-constants.md#builtins-null). 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 ## Compound values

View file

@ -25,7 +25,6 @@
let let
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
inherit (lib) fileset;
officialRelease = false; officialRelease = false;

View file

@ -499,7 +499,6 @@
''^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$''

View file

@ -6,6 +6,7 @@ project('nix-dev-shell', 'cpp',
subproject_dir : 'src', subproject_dir : 'src',
) )
# Internal Libraries
subproject('libutil') subproject('libutil')
subproject('libstore') subproject('libstore')
subproject('libfetchers') subproject('libfetchers')
@ -14,11 +15,14 @@ subproject('libflake')
subproject('libmain') subproject('libmain')
subproject('libcmd') subproject('libcmd')
# Executables
subproject('nix')
# Docs # Docs
subproject('internal-api-docs') subproject('internal-api-docs')
subproject('external-api-docs') subproject('external-api-docs')
# C wrappers # External C wrapper libraries
subproject('libutil-c') subproject('libutil-c')
subproject('libstore-c') subproject('libstore-c')
subproject('libexpr-c') subproject('libexpr-c')

View file

@ -32,6 +32,9 @@ in
nix-cmd = callPackage ../src/libcmd/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-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { };
nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { }; nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { };

View file

@ -14,9 +14,16 @@
let let
inherit (pkgs) lib; 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: localSourceLayer = finalAttrs: prevAttrs:
let let
root = ../.;
workDirPath = workDirPath =
# Ideally we'd pick finalAttrs.workDir, but for now `mkDerivation` has # Ideally we'd pick finalAttrs.workDir, but for now `mkDerivation` has
# the requirement that everything except passthru and meta must be # the requirement that everything except passthru and meta must be
@ -40,6 +47,7 @@ let
in in
scope: { scope: {
inherit stdenv versionSuffix; inherit stdenv versionSuffix;
version = lib.fileContents ../.version + versionSuffix;
libseccomp = pkgs.libseccomp.overrideAttrs (_: rec { libseccomp = pkgs.libseccomp.overrideAttrs (_: rec {
version = "2.5.5"; version = "2.5.5";
@ -103,5 +111,7 @@ scope: {
meta.platforms = lib.platforms.all; meta.platforms = lib.platforms.all;
}); });
inherit resolvePath filesetToSource;
mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f); mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f);
} }

View file

@ -53,6 +53,7 @@ let
"nix-flake-tests" "nix-flake-tests"
"nix-main" "nix-main"
"nix-cmd" "nix-cmd"
"nix-ng"
]; ];
in in
{ {

View file

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

View file

@ -1,5 +1,5 @@
{ lib { lib
, stdenv , mkMesonDerivation
, meson , meson
, ninja , ninja
@ -7,24 +7,25 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
in in
stdenv.mkDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
pname = "nix-external-api-docs"; pname = "nix-external-api-docs";
version = lib.fileContents ./.version + versionSuffix; inherit version;
src = fileset.toSource { workDir = ./.;
root = ../..;
fileset = fileset =
let let
cpp = fileset.fileFilter (file: file.hasExt "cc" || file.hasExt "h"); cpp = fileset.fileFilter (file: file.hasExt "cc" || file.hasExt "h");
in in
fileset.unions [ fileset.unions [
./.version
../../.version
./meson.build ./meson.build
./doxygen.cfg.in ./doxygen.cfg.in
./README.md ./README.md
@ -34,7 +35,6 @@ stdenv.mkDerivation (finalAttrs: {
(cpp ../libstore-c) (cpp ../libstore-c)
(cpp ../libutil-c) (cpp ../libutil-c)
]; ];
};
nativeBuildInputs = [ nativeBuildInputs = [
meson meson
@ -42,14 +42,10 @@ stdenv.mkDerivation (finalAttrs: {
doxygen doxygen
]; ];
postUnpack = ''
sourceRoot=$sourceRoot/src/external-api-docs
'';
preConfigure = preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix
'' ''
echo ${finalAttrs.version} > .version chmod u+w ./.version
echo ${finalAttrs.version} > ./.version
''; '';
postInstall = '' postInstall = ''

View file

@ -1,5 +1,5 @@
{ lib { lib
, stdenv , mkMesonDerivation
, meson , meson
, ninja , ninja
@ -7,29 +7,29 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
in in
stdenv.mkDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
pname = "nix-internal-api-docs"; pname = "nix-internal-api-docs";
version = lib.fileContents ./.version + versionSuffix; inherit version;
src = fileset.toSource { workDir = ./.;
root = ../..;
fileset = let fileset = let
cpp = fileset.fileFilter (file: file.hasExt "cc" || file.hasExt "hh"); cpp = fileset.fileFilter (file: file.hasExt "cc" || file.hasExt "hh");
in fileset.unions [ in fileset.unions [
./.version
../../.version
./meson.build ./meson.build
./doxygen.cfg.in ./doxygen.cfg.in
# Source is not compiled, but still must be available for Doxygen # Source is not compiled, but still must be available for Doxygen
# to gather comments. # to gather comments.
(cpp ../.) (cpp ../.)
]; ];
};
nativeBuildInputs = [ nativeBuildInputs = [
meson meson
@ -37,14 +37,10 @@ stdenv.mkDerivation (finalAttrs: {
doxygen doxygen
]; ];
postUnpack = ''
sourceRoot=$sourceRoot/src/internal-api-docs
'';
preConfigure = preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix
'' ''
echo ${finalAttrs.version} > .version chmod u+w ./.version
echo ${finalAttrs.version} > ./.version
''; '';
postInstall = '' postInstall = ''

View file

@ -64,6 +64,7 @@ add_project_arguments(
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
# '-include', 'config-fetchers.h', # '-include', 'config-fetchers.h',
'-include', 'config-expr.hh',
'-include', 'config-main.hh', '-include', 'config-main.hh',
'-include', 'config-cmd.hh', '-include', 'config-cmd.hh',
language : 'cpp', language : 'cpp',

View file

@ -20,7 +20,7 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
# Whether to enable Markdown rendering in the Nix binary. # Whether to enable Markdown rendering in the Nix binary.
, enableMarkdown ? !stdenv.hostPlatform.isWindows , enableMarkdown ? !stdenv.hostPlatform.isWindows
@ -36,8 +36,6 @@
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -11,13 +11,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -74,7 +74,7 @@ struct EvalSettings : Config
R"( R"(
List of search paths to use for [lookup path](@docroot@/language/constructs/lookup-path.md) resolution. List of search paths to use for [lookup path](@docroot@/language/constructs/lookup-path.md) resolution.
This setting determines the value of This setting determines the value of
[`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath) and can be used with [`builtins.findFile`](@docroot@/language/builtin-constants.md#builtins-findFile). [`builtins.nixPath`](@docroot@/language/builtins.md#builtins-nixPath) and can be used with [`builtins.findFile`](@docroot@/language/builtins.md#builtins-findFile).
The default value is The default value is
@ -95,7 +95,7 @@ struct EvalSettings : Config
this, "", "eval-system", this, "", "eval-system",
R"( R"(
This option defines This option defines
[`builtins.currentSystem`](@docroot@/language/builtin-constants.md#builtins-currentSystem) [`builtins.currentSystem`](@docroot@/language/builtins.md#builtins-currentSystem)
in the Nix language if it is set as a non-empty string. in the Nix language if it is set as a non-empty string.
Otherwise, if it is defined as the empty string (the default), the value of the Otherwise, if it is defined as the empty string (the default), the value of the
[`system` ](#conf-system) [`system` ](#conf-system)
@ -116,7 +116,7 @@ struct EvalSettings : Config
R"( R"(
If set to `true`, the Nix evaluator will not allow access to any If set to `true`, the Nix evaluator will not allow access to any
files outside of files outside of
[`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath), [`builtins.nixPath`](@docroot@/language/builtins.md#builtins-nixPath),
or to URIs outside of or to URIs outside of
[`allowed-uris`](@docroot@/command-ref/conf-file.md#conf-allowed-uris). [`allowed-uris`](@docroot@/command-ref/conf-file.md#conf-allowed-uris).
)"}; )"};
@ -127,10 +127,10 @@ struct EvalSettings : Config
- Restrict file system and network access to files specified by cryptographic hash - Restrict file system and network access to files specified by cryptographic hash
- Disable impure constants: - Disable impure constants:
- [`builtins.currentSystem`](@docroot@/language/builtin-constants.md#builtins-currentSystem) - [`builtins.currentSystem`](@docroot@/language/builtins.md#builtins-currentSystem)
- [`builtins.currentTime`](@docroot@/language/builtin-constants.md#builtins-currentTime) - [`builtins.currentTime`](@docroot@/language/builtins.md#builtins-currentTime)
- [`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath) - [`builtins.nixPath`](@docroot@/language/builtins.md#builtins-nixPath)
- [`builtins.storePath`](@docroot@/language/builtin-constants.md#builtins-storePath) - [`builtins.storePath`](@docroot@/language/builtins.md#builtins-storePath)
)" )"
}; };

View file

@ -69,6 +69,7 @@ add_project_arguments(
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
# '-include', 'config-fetchers.h', # '-include', 'config-fetchers.h',
'-include', 'config-expr.hh',
language : 'cpp', language : 'cpp',
) )
@ -116,20 +117,17 @@ lexer_tab = custom_target(
install_dir : get_option('includedir') / 'nix', install_dir : get_option('includedir') / 'nix',
) )
subdir('build-utils-meson/generate-header')
generated_headers = [] generated_headers = []
foreach header : [ foreach header : [
'imported-drv-to-derivation.nix', 'imported-drv-to-derivation.nix',
'fetchurl.nix', 'fetchurl.nix',
'call-flake.nix', 'call-flake.nix',
] ]
generated_headers += custom_target( generated_headers += gen_header.process(header)
command : [ 'bash', '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ],
input : header,
output : '@PLAINNAME@.gen.hh',
)
endforeach endforeach
sources = files( sources = files(
'attr-path.cc', 'attr-path.cc',
'attr-set.cc', 'attr-set.cc',

View file

@ -20,7 +20,7 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
# Whether to use garbage collection for the Nix language evaluator. # Whether to use garbage collection for the Nix language evaluator.
# #
@ -36,8 +36,6 @@
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -1872,7 +1872,7 @@ static RegisterPrimOp primop_findFile(PrimOp {
- If the suffix is found inside that directory, then the entry is a match. - If the suffix is found inside that directory, then the entry is a match.
The combined absolute path of the directory (now downloaded if need be) and the suffix is returned. The combined absolute path of the directory (now downloaded if need be) and the suffix is returned.
[Lookup path](@docroot@/language/constructs/lookup-path.md) expressions are [desugared](https://en.wikipedia.org/wiki/Syntactic_sugar) using this and [`builtins.nixPath`](@docroot@/language/builtin-constants.md#builtins-nixPath): [Lookup path](@docroot@/language/constructs/lookup-path.md) expressions are [desugared](https://en.wikipedia.org/wiki/Syntactic_sugar) using this and [`builtins.nixPath`](#builtins-nixPath):
```nix ```nix
<nixpkgs> <nixpkgs>
@ -4519,7 +4519,7 @@ void EvalState::createBaseEnv()
addConstant("builtins", v, { addConstant("builtins", v, {
.type = nAttrs, .type = nAttrs,
.doc = R"( .doc = R"(
Contains all the [built-in functions](@docroot@/language/builtins.md) and values. Contains all the built-in functions and values.
Since built-in functions were added over time, [testing for attributes](./operators.md#has-attribute) in `builtins` can be used for graceful fallback on older Nix installations: Since built-in functions were added over time, [testing for attributes](./operators.md#has-attribute) in `builtins` can be used for graceful fallback on older Nix installations:

View file

@ -1,12 +1,7 @@
foreach header : [ generated_headers += gen_header.process(
'derivation.nix', 'derivation.nix',
] preserve_path_from: meson.project_source_root(),
generated_headers += custom_target(
command : [ 'bash', '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ],
input : header,
output : '@PLAINNAME@.gen.hh',
) )
endforeach
sources += files( sources += files(
'context.cc', 'context.cc',

View file

@ -15,13 +15,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -17,13 +17,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -7,18 +7,18 @@
, ninja , ninja
, pkg-config , pkg-config
, openssl
, nix-util , nix-util
, nix-store , nix-store
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
@ -47,6 +47,7 @@ mkMesonDerivation (finalAttrs: {
propagatedBuildInputs = [ propagatedBuildInputs = [
nix-util nix-util
nix-store nix-store
openssl
]; ];
preConfigure = preConfigure =

View file

@ -12,13 +12,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -228,7 +228,7 @@ public:
While you can force Nix to run a Darwin-specific `builder` executable on a Linux machine, the result would obviously be wrong. While you can force Nix to run a Darwin-specific `builder` executable on a Linux machine, the result would obviously be wrong.
This value is available in the Nix language as This value is available in the Nix language as
[`builtins.currentSystem`](@docroot@/language/builtin-constants.md#builtins-currentSystem) [`builtins.currentSystem`](@docroot@/language/builtins.md#builtins-currentSystem)
if the if the
[`eval-system`](#conf-eval-system) [`eval-system`](#conf-eval-system)
configuration option is set as the empty string. configuration option is set as the empty string.

View file

@ -99,18 +99,14 @@ deps_public += nlohmann_json
sqlite = dependency('sqlite3', 'sqlite', version : '>=3.6.19') sqlite = dependency('sqlite3', 'sqlite', version : '>=3.6.19')
deps_private += sqlite deps_private += sqlite
subdir('build-utils-meson/generate-header')
generated_headers = [] generated_headers = []
foreach header : [ foreach header : [
'schema.sql', 'schema.sql',
'ca-specific-schema.sql', 'ca-specific-schema.sql',
] ]
generated_headers += custom_target( generated_headers += gen_header.process(header)
command : [ 'bash', '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ],
input : header,
output : '@PLAINNAME@.gen.hh',
install : true,
install_dir : get_option('includedir') / 'nix',
)
endforeach endforeach
busybox = find_program(get_option('sandbox-shell'), required : false) busybox = find_program(get_option('sandbox-shell'), required : false)

View file

@ -20,15 +20,13 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
, embeddedSandboxShell ? stdenv.hostPlatform.isStatic , embeddedSandboxShell ? stdenv.hostPlatform.isStatic
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -132,6 +132,7 @@ ref<Aws::Client::ClientConfiguration> S3Helper::makeConfig(
{ {
initAWS(); initAWS();
auto res = make_ref<Aws::Client::ClientConfiguration>(); auto res = make_ref<Aws::Client::ClientConfiguration>();
res->allowSystemProxy = true;
res->region = region; res->region = region;
if (!scheme.empty()) { if (!scheme.empty()) {
res->scheme = Aws::Http::SchemeMapper::FromString(scheme.c_str()); res->scheme = Aws::Http::SchemeMapper::FromString(scheme.c_str());

View file

@ -11,13 +11,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -66,7 +66,7 @@ constexpr std::array<ExperimentalFeatureDetails, numXpFeatures> xpFeatureDetails
an impure derivation cannot also be an impure derivation cannot also be
[content-addressed](#xp-feature-ca-derivations). [content-addressed](#xp-feature-ca-derivations).
This is a more explicit alternative to using [`builtins.currentTime`](@docroot@/language/builtin-constants.md#builtins-currentTime). This is a more explicit alternative to using [`builtins.currentTime`](@docroot@/language/builtins.md#builtins-currentTime).
)", )",
.trackingUrl = "https://github.com/NixOS/nix/milestone/42", .trackingUrl = "https://github.com/NixOS/nix/milestone/42",
}, },

View file

@ -17,13 +17,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

1
src/nix/.version Symbolic link
View file

@ -0,0 +1 @@
../../.version

1
src/nix/build-remote Symbolic link
View file

@ -0,0 +1 @@
../build-remote

1
src/nix/build-utils-meson Symbolic link
View file

@ -0,0 +1 @@
../../build-utils-meson/

1
src/nix/doc Symbolic link
View file

@ -0,0 +1 @@
../../doc

1
src/nix/help-stores.md Symbolic link
View file

@ -0,0 +1 @@
../../doc/manual/src/store/types/index.md.in

View file

@ -42,27 +42,16 @@ $(eval $(call install-symlink, $(bindir)/nix, $(libexecdir)/nix/build-remote))
src/nix-env/user-env.cc: src/nix-env/buildenv.nix.gen.hh src/nix-env/user-env.cc: src/nix-env/buildenv.nix.gen.hh
src/nix/develop.cc: src/nix/get-env.sh.gen.hh $(d)/develop.cc: $(d)/get-env.sh.gen.hh
src/nix-channel/nix-channel.cc: src/nix-channel/unpack-channel.nix.gen.hh src/nix-channel/nix-channel.cc: src/nix-channel/unpack-channel.nix.gen.hh
src/nix/main.cc: \ $(d)/main.cc: \
doc/manual/generate-manpage.nix.gen.hh \ doc/manual/generate-manpage.nix.gen.hh \
doc/manual/utils.nix.gen.hh doc/manual/generate-settings.nix.gen.hh \ doc/manual/utils.nix.gen.hh doc/manual/generate-settings.nix.gen.hh \
doc/manual/generate-store-info.nix.gen.hh \ doc/manual/generate-store-info.nix.gen.hh \
src/nix/generated-doc/help-stores.md $(d)/help-stores.md.gen.hh
src/nix/generated-doc/files/%.md: doc/manual/src/command-ref/files/%.md $(d)/profile.cc: $(d)/profile.md
@mkdir -p $$(dirname $@)
@cp $< $@
src/nix/profile.cc: src/nix/profile.md src/nix/generated-doc/files/profiles.md.gen.hh $(d)/profile.md: $(d)/profiles.md.gen.hh
src/nix/generated-doc/help-stores.md: doc/manual/src/store/types/index.md.in
@mkdir -p $$(dirname $@)
@echo 'R"(' >> $@.tmp
@echo >> $@.tmp
@cat $^ >> $@.tmp
@echo >> $@.tmp
@echo ')"' >> $@.tmp
@mv $@.tmp $@

View file

@ -333,7 +333,7 @@ struct CmdHelpStores : Command
std::string doc() override std::string doc() override
{ {
return return
#include "generated-doc/help-stores.md" #include "help-stores.md.gen.hh"
; ;
} }
@ -419,35 +419,28 @@ void mainWrapped(int argc, char * * argv)
}; };
evalSettings.pureEval = false; evalSettings.pureEval = false;
EvalState state({}, openStore("dummy://"), evalSettings); EvalState state({}, openStore("dummy://"), evalSettings);
auto res = nlohmann::json::object();
res["builtins"] = ({
auto builtinsJson = nlohmann::json::object(); auto builtinsJson = nlohmann::json::object();
for (auto & builtin : *state.baseEnv.values[0]->attrs()) { for (auto & builtin : *state.baseEnv.values[0]->attrs()) {
auto b = nlohmann::json::object(); auto b = nlohmann::json::object();
if (!builtin.value->isPrimOp()) continue; if (!builtin.value->isPrimOp()) continue;
auto primOp = builtin.value->primOp(); auto primOp = builtin.value->primOp();
if (!primOp->doc) continue; if (!primOp->doc) continue;
b["arity"] = primOp->arity;
b["args"] = primOp->args; b["args"] = primOp->args;
b["doc"] = trim(stripIndentation(primOp->doc)); b["doc"] = trim(stripIndentation(primOp->doc));
if (primOp->experimentalFeature)
b["experimental-feature"] = primOp->experimentalFeature; b["experimental-feature"] = primOp->experimentalFeature;
builtinsJson[state.symbols[builtin.name]] = std::move(b); builtinsJson[state.symbols[builtin.name]] = std::move(b);
} }
std::move(builtinsJson);
});
res["constants"] = ({
auto constantsJson = nlohmann::json::object();
for (auto & [name, info] : state.constantInfos) { for (auto & [name, info] : state.constantInfos) {
auto c = nlohmann::json::object(); auto b = nlohmann::json::object();
if (!info.doc) continue; if (!info.doc) continue;
c["doc"] = trim(stripIndentation(info.doc)); b["doc"] = trim(stripIndentation(info.doc));
c["type"] = showType(info.type, false); b["type"] = showType(info.type, false);
c["impure-only"] = info.impureOnly; if (info.impureOnly)
constantsJson[name] = std::move(c); b["impure-only"] = true;
builtinsJson[name] = std::move(b);
} }
std::move(constantsJson); logger->cout("%s", builtinsJson);
});
logger->cout("%s", res);
return; return;
} }

170
src/nix/meson.build Normal file
View file

@ -0,0 +1,170 @@
project('nix', 'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
# TODO(Qyriad): increase the warning level
'warning_level=1',
'debug=true',
'optimization=2',
'errorlogs=true', # Please print logs for tests that fail
],
meson_version : '>= 1.1',
license : 'LGPL-2.1-or-later',
)
cxx = meson.get_compiler('cpp')
subdir('build-utils-meson/deps-lists')
deps_private_maybe_subproject = [
dependency('nix-util'),
dependency('nix-store'),
dependency('nix-expr'),
dependency('nix-fetchers'),
dependency('nix-main'),
dependency('nix-cmd'),
]
deps_public_maybe_subproject = [
]
subdir('build-utils-meson/subprojects')
subdir('build-utils-meson/export-all-symbols')
add_project_arguments(
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
# It would be nice for our headers to be idempotent instead.
'-include', 'config-util.hh',
'-include', 'config-store.hh',
'-include', 'config-expr.hh',
#'-include', 'config-fetchers.hh',
'-include', 'config-main.hh',
'-include', 'config-cmd.hh',
language : 'cpp',
)
subdir('build-utils-meson/diagnostics')
subdir('build-utils-meson/generate-header')
nix_sources = files(
'add-to-store.cc',
'app.cc',
'build.cc',
'bundle.cc',
'cat.cc',
'config-check.cc',
'config.cc',
'copy.cc',
'derivation-add.cc',
'derivation-show.cc',
'derivation.cc',
'develop.cc',
'diff-closures.cc',
'dump-path.cc',
'edit.cc',
'env.cc',
'eval.cc',
'flake.cc',
'fmt.cc',
'hash.cc',
'log.cc',
'ls.cc',
'main.cc',
'make-content-addressed.cc',
'nar.cc',
'optimise-store.cc',
'path-from-hash-part.cc',
'path-info.cc',
'prefetch.cc',
'profile.cc',
'realisation.cc',
'registry.cc',
'repl.cc',
'run.cc',
'search.cc',
'sigs.cc',
'store-copy-log.cc',
'store-delete.cc',
'store-gc.cc',
'store-info.cc',
'store-repair.cc',
'store.cc',
'unix/daemon.cc',
'upgrade-nix.cc',
'verify.cc',
'why-depends.cc',
)
nix_sources += [
gen_header.process('doc/manual/generate-manpage.nix'),
gen_header.process('doc/manual/generate-settings.nix'),
gen_header.process('doc/manual/generate-store-info.nix'),
gen_header.process('doc/manual/utils.nix'),
gen_header.process('get-env.sh'),
gen_header.process('profiles.md'),
gen_header.process('help-stores.md'),
]
if host_machine.system() != 'windows'
nix_sources += files(
'unix/daemon.cc',
)
endif
# The rest of the subdirectories aren't separate components,
# just source files in another directory, so we process them here.
build_remote_sources = files(
'build-remote/build-remote.cc',
)
nix_build_sources = files(
'nix-build/nix-build.cc',
)
nix_channel_sources = files(
'nix-channel/nix-channel.cc',
)
unpack_channel_gen = gen_header.process('nix-channel/unpack-channel.nix')
nix_collect_garbage_sources = files(
'nix-collect-garbage/nix-collect-garbage.cc',
)
nix_copy_closure_sources = files(
'nix-copy-closure/nix-copy-closure.cc',
)
nix_env_buildenv_gen = gen_header.process('nix-env/buildenv.nix')
nix_env_sources = files(
'nix-env/nix-env.cc',
'nix-env/user-env.cc',
)
nix_instantiate_sources = files(
'nix-instantiate/nix-instantiate.cc',
)
nix_store_sources = files(
'nix-store/dotgraph.cc',
'nix-store/graphml.cc',
'nix-store/nix-store.cc',
)
# Hurray for Meson list flattening!
sources = [
nix_sources,
build_remote_sources,
nix_build_sources,
nix_channel_sources,
unpack_channel_gen,
nix_collect_garbage_sources,
nix_copy_closure_sources,
nix_env_buildenv_gen,
nix_env_sources,
nix_instantiate_sources,
nix_store_sources,
]
include_dirs = [include_directories('.')]
this_exe = executable(
meson.project_name(),
sources,
dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs,
link_args: linker_export_flags,
install : true,
)

1
src/nix/nix-build Symbolic link
View file

@ -0,0 +1 @@
../nix-build

1
src/nix/nix-channel Symbolic link
View file

@ -0,0 +1 @@
../nix-channel

1
src/nix/nix-collect-garbage Symbolic link
View file

@ -0,0 +1 @@
../nix-collect-garbage

1
src/nix/nix-copy-closure Symbolic link
View file

@ -0,0 +1 @@
../nix-copy-closure

1
src/nix/nix-env Symbolic link
View file

@ -0,0 +1 @@
../nix-env

1
src/nix/nix-instantiate Symbolic link
View file

@ -0,0 +1 @@
../nix-instantiate

1
src/nix/nix-store Symbolic link
View file

@ -0,0 +1 @@
../nix-store/

129
src/nix/package.nix Normal file
View file

@ -0,0 +1,129 @@
{ lib
, stdenv
, mkMesonDerivation
, releaseTools
, meson
, ninja
, pkg-config
, nix-store
, nix-expr
, nix-main
, nix-cmd
, rapidcheck
, gtest
, runCommand
# Configuration Options
, version
}:
let
inherit (lib) fileset;
in
mkMesonDerivation (finalAttrs: {
pname = "nix";
inherit version;
workDir = ./.;
fileset = fileset.unions ([
../../build-utils-meson
./build-utils-meson
../../.version
./.version
./meson.build
# ./meson.options
# Symbolic links to other dirs
./build-remote
./doc
./nix-build
./nix-channel
./nix-collect-garbage
./nix-copy-closure
./nix-env
./nix-instantiate
./nix-store
# Doc nix files for --help
../../doc/manual/generate-manpage.nix
../../doc/manual/utils.nix
../../doc/manual/generate-settings.nix
../../doc/manual/generate-store-info.nix
# Other files to be included as string literals
../nix-channel/unpack-channel.nix
../nix-env/buildenv.nix
./get-env.sh
./help-stores.md
../../doc/manual/src/store/types/index.md.in
./profiles.md
../../doc/manual/src/command-ref/files/profiles.md
# Files
] ++ lib.concatMap
(dir: [
(fileset.fileFilter (file: file.hasExt "cc") dir)
(fileset.fileFilter (file: file.hasExt "hh") dir)
(fileset.fileFilter (file: file.hasExt "md") dir)
])
[
./.
../build-remote
../nix-build
../nix-channel
../nix-collect-garbage
../nix-copy-closure
../nix-env
../nix-instantiate
../nix-store
]
);
outputs = [ "out" "dev" ];
nativeBuildInputs = [
meson
ninja
pkg-config
];
buildInputs = [
nix-store
nix-expr
nix-main
nix-cmd
];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../../.version
'';
mesonFlags = [
];
env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) {
LDFLAGS = "-fuse-ld=gold";
};
enableParallelBuilding = true;
separateDebugInfo = !stdenv.hostPlatform.isStatic;
strictDeps = true;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View file

@ -11,7 +11,7 @@ them to be rolled back easily.
)"" )""
#include "generated-doc/files/profiles.md.gen.hh" #include "profiles.md.gen.hh"
R""( R""(

1
src/nix/profiles.md Symbolic link
View file

@ -0,0 +1 @@
../../doc/manual/src/command-ref/files/profiles.md

View file

@ -1,5 +1,6 @@
{ lib { lib
, stdenv , stdenv
, mkMesonDerivation
, perl , perl
, perlPackages , perlPackages
, meson , meson
@ -7,20 +8,24 @@
, pkg-config , pkg-config
, nix-store , nix-store
, darwin , darwin
, versionSuffix ? "" , version
, curl
, bzip2
, libsodium
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
in in
perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: { perl.pkgs.toPerlModule (mkMesonDerivation (finalAttrs: {
pname = "nix-perl"; pname = "nix-perl";
version = lib.fileContents ./.version + versionSuffix; inherit version;
src = fileset.toSource { workDir = ./.;
root = ./.;
fileset = fileset.unions ([ fileset = fileset.unions ([
./.version
../../.version
./MANIFEST ./MANIFEST
./lib ./lib
./meson.build ./meson.build
@ -29,17 +34,19 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: {
./.yath.rc.in ./.yath.rc.in
./t ./t
]); ]);
};
nativeBuildInputs = [ nativeBuildInputs = [
meson meson
ninja ninja
pkg-config pkg-config
perl perl
curl
]; ];
buildInputs = [ buildInputs = [
nix-store nix-store
bzip2
libsodium
]; ];
# `perlPackages.Test2Harness` is marked broken for Darwin # `perlPackages.Test2Harness` is marked broken for Darwin
@ -52,6 +59,7 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: {
preConfigure = preConfigure =
# "Inline" .version so its not a symlink, and includes the suffix # "Inline" .version so its not a symlink, and includes the suffix
'' ''
chmod u+w .version
echo ${finalAttrs.version} > .version echo ${finalAttrs.version} > .version
''; '';

View file

@ -14,13 +14,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -41,7 +41,7 @@ add_project_arguments(
# It would be nice for our headers to be idempotent instead. # It would be nice for our headers to be idempotent instead.
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
'-include', 'config-store.hh', '-include', 'config-expr.hh',
'-include', 'config-util.h', '-include', 'config-util.h',
'-include', 'config-store.h', '-include', 'config-store.h',
'-include', 'config-expr.h', '-include', 'config-expr.h',

View file

@ -17,13 +17,12 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
, resolvePath
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
@ -86,7 +85,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" { run = runCommand "${finalAttrs.pname}-run" {
} '' } ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data} export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-expr-tests nix-expr-tests
touch $out touch $out
''; '';

View file

@ -37,7 +37,7 @@ add_project_arguments(
# It would be nice for our headers to be idempotent instead. # It would be nice for our headers to be idempotent instead.
'-include', 'config-util.hh', '-include', 'config-util.hh',
'-include', 'config-store.hh', '-include', 'config-store.hh',
'-include', 'config-store.hh', # '-include', 'config-fetchers.h',
language : 'cpp', language : 'cpp',
) )

View file

@ -16,13 +16,12 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
, resolvePath
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
@ -84,7 +83,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" { run = runCommand "${finalAttrs.pname}-run" {
} '' } ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data} export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-fetchers-tests nix-fetchers-tests
touch $out touch $out
''; '';

View file

@ -16,13 +16,12 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
, resolvePath
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
@ -84,7 +83,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" { run = runCommand "${finalAttrs.pname}-run" {
} '' } ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data} export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-flake-tests nix-flake-tests
touch $out touch $out
''; '';

View file

@ -14,13 +14,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -18,13 +18,12 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
, filesetToSource
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
@ -88,7 +87,7 @@ mkMesonDerivation (finalAttrs: {
run = let run = let
# Some data is shared with the functional tests: they create it, # Some data is shared with the functional tests: they create it,
# we consume it. # we consume it.
data = lib.fileset.toSource { data = filesetToSource {
root = ../..; root = ../..;
fileset = lib.fileset.unions [ fileset = lib.fileset.unions [
./data ./data

View file

@ -13,13 +13,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -17,13 +17,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {