nixVersions.nix_2_26: init at 2.26.1 (#375856)

This commit is contained in:
Robert Hensing 2025-02-09 21:17:48 +01:00 committed by GitHub
commit 248de28772
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
35 changed files with 2493 additions and 31 deletions

View File

@ -0,0 +1 @@
2.26.1

View File

@ -0,0 +1,49 @@
{
lib,
fetchFromGitHub,
splicePackages,
generateSplicesForMkScope,
newScope,
pkgs,
stdenv,
...
}:
let
officialRelease = true;
src = fetchFromGitHub (builtins.fromJSON (builtins.readFile ./source.json));
# A new scope, so that we can use `callPackage` to inject our own interdependencies
# without "polluting" the top level "`pkgs`" attrset.
# This also has the benefit of providing us with a distinct set of packages
# we can iterate over.
nixComponents =
lib.makeScopeWithSplicing'
{
inherit splicePackages;
inherit (nixDependencies) newScope;
}
{
otherSplices = generateSplicesForMkScope "nixComponents";
f = import ./packaging/components.nix {
inherit lib officialRelease src;
};
};
# The dependencies are in their own scope, so that they don't have to be
# in Nixpkgs top level `pkgs` or `nixComponents`.
nixDependencies =
lib.makeScopeWithSplicing'
{
inherit splicePackages;
inherit newScope; # layered directly on pkgs, unlike nixComponents above
}
{
otherSplices = generateSplicesForMkScope "nixDependencies";
f = import ./dependencies.nix {
inherit pkgs;
inherit stdenv;
inherit src;
};
};
in
nixComponents.nix-everything

View File

@ -0,0 +1,182 @@
# These overrides are applied to the dependencies of the Nix components.
{
src,
# The raw Nixpkgs, not affected by this scope
pkgs,
stdenv,
}:
let
prevStdenv = stdenv;
in
let
inherit (pkgs) lib;
root = ./.;
stdenv = if prevStdenv.isDarwin && prevStdenv.isx86_64 then darwinStdenv else prevStdenv;
# Fix the following error with the default x86_64-darwin SDK:
#
# error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer
#
# Despite the use of the 10.13 deployment target here, the aligned
# allocation function Clang uses with this setting actually works
# all the way back to 10.6.
darwinStdenv = pkgs.overrideSDK prevStdenv { darwinMinVersion = "10.13"; };
resolveRelPath = p: lib.path.removePrefix root p;
resolvePath = p: src + "/${resolveRelPath p}";
# Indirection for Nixpkgs to override when package.nix files are vendored
# fileset filtering is not possible without IFD on src, so we ignore the fileset
# and produce a path containing _more_, but the extra files generally won't be
# accessed.
# The Nix flake uses fileset.toSource for this.
filesetToSource = { root, fileset }: resolvePath root;
/**
Given a set of layers, create a mkDerivation-like function
*/
mkPackageBuilder =
exts: userFn: stdenv.mkDerivation (lib.extends (lib.composeManyExtensions exts) userFn);
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 = resolveRelPath 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;
};
mesonLayer = finalAttrs: prevAttrs: {
# NOTE:
# As of https://github.com/NixOS/nixpkgs/blob/8baf8241cea0c7b30e0b8ae73474cb3de83c1a30/pkgs/by-name/me/meson/setup-hook.sh#L26,
# `mesonBuildType` defaults to `plain` if not specified. We want our Nix-built binaries to be optimized by default.
# More on build types here: https://mesonbuild.com/Builtin-options.html#details-for-buildtype.
mesonBuildType = "release";
# NOTE:
# Users who are debugging Nix builds are expected to set the environment variable `mesonBuildType`, per the
# guidance in https://github.com/NixOS/nix/blob/8a3fc27f1b63a08ac983ee46435a56cf49ebaf4a/doc/manual/source/development/debugging.md?plain=1#L10.
# For this reason, we don't want to refer to `finalAttrs.mesonBuildType` here, but rather use the environment variable.
preConfigure =
prevAttrs.preConfigure or ""
+
lib.optionalString
(
!stdenv.hostPlatform.isWindows
# build failure
&& !stdenv.hostPlatform.isStatic
# LTO breaks exception handling on x86-64-darwin.
&& stdenv.system != "x86_64-darwin"
)
''
case "$mesonBuildType" in
release|minsize) appendToVar mesonFlags "-Db_lto=true" ;;
*) appendToVar mesonFlags "-Db_lto=false" ;;
esac
'';
nativeBuildInputs = [
pkgs.buildPackages.meson
pkgs.buildPackages.ninja
] ++ prevAttrs.nativeBuildInputs or [ ];
mesonCheckFlags = prevAttrs.mesonCheckFlags or [ ] ++ [
"--print-errorlogs"
];
};
mesonBuildLayer = finalAttrs: prevAttrs: {
nativeBuildInputs = prevAttrs.nativeBuildInputs or [ ] ++ [
pkgs.buildPackages.pkg-config
];
separateDebugInfo = !stdenv.hostPlatform.isStatic;
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
env =
prevAttrs.env or { }
// lib.optionalAttrs (
stdenv.isLinux
&& !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")
&& !(stdenv.hostPlatform.useLLVM or false)
) { LDFLAGS = "-fuse-ld=gold"; };
};
mesonLibraryLayer = finalAttrs: prevAttrs: {
outputs = prevAttrs.outputs or [ "out" ] ++ [ "dev" ];
};
# Work around weird `--as-needed` linker behavior with BSD, see
# https://github.com/mesonbuild/meson/issues/3593
bsdNoLinkAsNeeded =
finalAttrs: prevAttrs:
lib.optionalAttrs stdenv.hostPlatform.isBSD {
mesonFlags = [ (lib.mesonBool "b_asneeded" false) ] ++ prevAttrs.mesonFlags or [ ];
};
miscGoodPractice = finalAttrs: prevAttrs: {
strictDeps = prevAttrs.strictDeps or true;
enableParallelBuilding = true;
};
in
scope: {
inherit stdenv;
aws-sdk-cpp =
(pkgs.aws-sdk-cpp.override {
apis = [
"s3"
"transfer"
];
customMemoryManagement = false;
}).overrideAttrs
{
# only a stripped down version is built, which takes a lot less resources
# to build, so we don't need a "big-parallel" machine.
requiredSystemFeatures = [ ];
};
boehmgc = pkgs.boehmgc.override {
enableLargeConfig = true;
};
inherit resolvePath filesetToSource;
mkMesonDerivation = mkPackageBuilder [
miscGoodPractice
localSourceLayer
mesonLayer
];
mkMesonExecutable = mkPackageBuilder [
miscGoodPractice
bsdNoLinkAsNeeded
localSourceLayer
mesonLayer
mesonBuildLayer
];
mkMesonLibrary = mkPackageBuilder [
miscGoodPractice
bsdNoLinkAsNeeded
localSourceLayer
mesonLayer
mesonBuildLayer
mesonLibraryLayer
];
}

View File

@ -0,0 +1,75 @@
{
lib,
mkMesonDerivation,
meson,
ninja,
lowdown-unsandboxed,
mdbook,
mdbook-linkcheck,
jq,
python3,
rsync,
nix-cli,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonDerivation (finalAttrs: {
pname = "nix-manual";
inherit version;
workDir = ./.;
fileset =
fileset.difference
(fileset.unions [
../../.version
# Too many different types of files to filter for now
../../doc/manual
./.
])
# Do a blacklist instead
../../doc/manual/package.nix;
# TODO the man pages should probably be separate
outputs = [
"out"
"man"
];
# Hack for sake of the dev shell
passthru.externalNativeBuildInputs = [
meson
ninja
(lib.getBin lowdown-unsandboxed)
mdbook
mdbook-linkcheck
jq
python3
rsync
];
nativeBuildInputs = finalAttrs.passthru.externalNativeBuildInputs ++ [
nix-cli
];
preConfigure = ''
chmod u+w ./.version
echo ${finalAttrs.version} > ./.version
'';
postInstall = ''
mkdir -p ''$out/nix-support
echo "doc manual ''$out/share/doc/nix/manual" >> ''$out/nix-support/hydra-build-products
'';
meta = {
platforms = lib.platforms.all;
};
})

View File

@ -0,0 +1,68 @@
{
lib,
src,
officialRelease,
}:
scope:
let
inherit (scope) callPackage;
baseVersion = lib.fileContents ../.version;
versionSuffix = lib.optionalString (!officialRelease) "pre";
fineVersionSuffix =
lib.optionalString (!officialRelease)
"pre${
builtins.substring 0 8 (src.lastModifiedDate or src.lastModified or "19700101")
}_${src.shortRev or "dirty"}";
fineVersion = baseVersion + fineVersionSuffix;
in
# This becomes the pkgs.nixComponents attribute set
{
version = baseVersion + versionSuffix;
inherit versionSuffix;
nix-util = callPackage ../src/libutil/package.nix { };
nix-util-c = callPackage ../src/libutil-c/package.nix { };
nix-util-test-support = callPackage ../src/libutil-test-support/package.nix { };
nix-util-tests = callPackage ../src/libutil-tests/package.nix { };
nix-store = callPackage ../src/libstore/package.nix { };
nix-store-c = callPackage ../src/libstore-c/package.nix { };
nix-store-test-support = callPackage ../src/libstore-test-support/package.nix { };
nix-store-tests = callPackage ../src/libstore-tests/package.nix { };
nix-fetchers = callPackage ../src/libfetchers/package.nix { };
nix-fetchers-tests = callPackage ../src/libfetchers-tests/package.nix { };
nix-expr = callPackage ../src/libexpr/package.nix { };
nix-expr-c = callPackage ../src/libexpr-c/package.nix { };
nix-expr-test-support = callPackage ../src/libexpr-test-support/package.nix { };
nix-expr-tests = callPackage ../src/libexpr-tests/package.nix { };
nix-flake = callPackage ../src/libflake/package.nix { };
nix-flake-c = callPackage ../src/libflake-c/package.nix { };
nix-flake-tests = callPackage ../src/libflake-tests/package.nix { };
nix-main = callPackage ../src/libmain/package.nix { };
nix-main-c = callPackage ../src/libmain-c/package.nix { };
nix-cmd = callPackage ../src/libcmd/package.nix { };
nix-cli = callPackage ../src/nix/package.nix { version = fineVersion; };
nix-functional-tests = callPackage ../tests/functional/package.nix { version = fineVersion; };
nix-manual = callPackage ../doc/manual/package.nix { version = fineVersion; };
nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { version = fineVersion; };
nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { version = fineVersion; };
nix-perl-bindings = callPackage ../src/perl/package.nix { };
nix-everything = callPackage ../packaging/everything.nix { };
}

View File

@ -0,0 +1,208 @@
{
lib,
stdenv,
buildEnv,
nix-util,
nix-util-c,
nix-util-tests,
nix-store,
nix-store-c,
nix-store-tests,
nix-fetchers,
nix-fetchers-tests,
nix-expr,
nix-expr-c,
nix-expr-tests,
nix-flake,
nix-flake-c,
nix-flake-tests,
nix-main,
nix-main-c,
nix-cmd,
nix-cli,
nix-functional-tests,
nix-manual,
nix-internal-api-docs,
nix-external-api-docs,
nix-perl-bindings,
testers,
runCommand,
}:
let
libs =
{
inherit
nix-util
nix-util-c
nix-store
nix-store-c
nix-fetchers
nix-expr
nix-expr-c
nix-flake
nix-flake-c
nix-main
nix-main-c
nix-cmd
;
}
// lib.optionalAttrs
(!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform)
{
# Currently fails in static build
inherit
nix-perl-bindings
;
};
dev =
nixAttrs:
stdenv.mkDerivation (finalAttrs: {
name = "nix-${nix-cli.version}-dev";
pname = "nix";
version = nix-cli.version;
dontUnpack = true;
dontBuild = true;
libs = map lib.getDev (lib.attrValues libs);
installPhase = ''
mkdir -p $out/nix-support
echo $libs >> $out/nix-support/propagated-build-inputs
echo ${nixAttrs.finalPackage} >> $out/nix-support/propagated-build-inputs
'';
passthru = {
tests = {
# TODO: is this supposed to work for a dev output?
# pkg-config = testers.hasPkgConfigModules {
# package = finalAttrs.finalPackage;
# };
};
# If we were to fully emulate output selection here, we'd confuse the Nix CLIs,
# because they rely on `drvPath`.
dev = finalAttrs.finalPackage.out;
out = nixAttrs.finalPackage.out;
libs = throw "`nix.dev.libs` is not meant to be used; use `nix.libs` instead.";
};
meta = {
pkgConfigModules = [
"nix-cmd"
"nix-expr"
"nix-expr-c"
"nix-fetchers"
"nix-flake"
"nix-flake-c"
"nix-main"
"nix-main-c"
"nix-store"
"nix-store-c"
"nix-util"
"nix-util-c"
];
};
});
devdoc = buildEnv {
name = "nix-${nix-cli.version}-devdoc";
paths = [
nix-internal-api-docs
nix-external-api-docs
];
};
in
(buildEnv {
name = "nix-${nix-cli.version}";
paths = [
nix-cli
nix-manual.man
];
meta.mainProgram = "nix";
}).overrideAttrs
(
finalAttrs: prevAttrs: {
doCheck = true;
doInstallCheck = true;
checkInputs =
[
# Make sure the unit tests have passed
nix-util-tests.tests.run
nix-store-tests.tests.run
nix-expr-tests.tests.run
nix-fetchers-tests.tests.run
nix-flake-tests.tests.run
# Make sure the functional tests have passed
nix-functional-tests
]
++ lib.optionals
(!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform)
[
# Perl currently fails in static build
# TODO: Split out tests into a separate derivation?
nix-perl-bindings
];
passthru = prevAttrs.passthru // {
inherit (nix-cli) version;
/**
These are the libraries that are part of the Nix project. They are used
by the Nix CLI and other tools.
If you need to use these libraries in your project, we recommend to use
the `-c` C API libraries exclusively, if possible.
We also recommend that you build the complete package to ensure that the unit tests pass.
You could do this in CI, or by passing it in an unused environment variable. e.g in a `mkDerivation` call:
```nix
buildInputs = [ nix.libs.nix-util-c nix.libs.nix-store-c ];
# Make sure the nix libs we use are ok
unusedInputsForTests = [ nix ];
disallowedReferences = nix.all;
```
*/
inherit libs;
tests = prevAttrs.passthru.tests or { } // {
pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
};
};
/**
A derivation referencing the `dev` outputs of the Nix libraries.
*/
dev = dev finalAttrs;
inherit devdoc;
doc = nix-manual;
outputs = [
"out"
"dev"
"devdoc"
"doc"
];
all = lib.attrValues (
lib.genAttrs finalAttrs.passthru.outputs (outName: finalAttrs.finalPackage.${outName})
);
};
meta = prevAttrs.meta // {
description = "The Nix package manager";
pkgConfigModules = (dev finalAttrs).meta.pkgConfigModules;
};
}
)

View File

@ -0,0 +1,6 @@
{
"owner": "NixOS",
"repo": "nix",
"rev": "36bd92736faaf81c6af3dff8f560963eb4e76b14",
"hash": "sha256-1T7WRNfUMsiiNB77BuHElzjavguL8oJx+wBtfMcobq8="
}

View File

@ -0,0 +1,56 @@
{
lib,
mkMesonDerivation,
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 ../libflake-c)
(cpp ../libstore-c)
(cpp ../libutil-c)
];
nativeBuildInputs = [
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
'';
meta = {
platforms = lib.platforms.all;
};
})

View File

@ -0,0 +1,52 @@
{
lib,
mkMesonDerivation,
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 = [
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
'';
meta = {
platforms = lib.platforms.all;
};
})

View File

@ -0,0 +1,84 @@
{
lib,
stdenv,
mkMesonLibrary,
nix-util,
nix-store,
nix-fetchers,
nix-expr,
nix-flake,
nix-main,
editline,
readline,
lowdown,
nlohmann_json,
# Configuration Options
version,
# Whether to enable Markdown rendering in the Nix binary.
enableMarkdown ? !stdenv.hostPlatform.isWindows,
# Which interactive line editor library to use for Nix's repl.
#
# Currently supported choices are:
#
# - editline (default)
# - readline
readlineFlavor ? if stdenv.hostPlatform.isWindows then "readline" else "editline",
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-cmd";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
buildInputs = [
({ inherit editline readline; }.${readlineFlavor})
] ++ lib.optional enableMarkdown lowdown;
propagatedBuildInputs = [
nix-util
nix-store
nix-fetchers
nix-expr
nix-flake
nix-main
nlohmann_json
];
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 = [
(lib.mesonEnable "markdown" enableMarkdown)
(lib.mesonOption "readline-flavor" readlineFlavor)
];
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,54 @@
{
lib,
mkMesonLibrary,
nix-store-c,
nix-expr,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-expr-c";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
(fileset.fileFilter (file: file.hasExt "h") ./.)
];
propagatedBuildInputs = [
nix-store-c
nix-expr
];
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 = [
];
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,58 @@
{
lib,
mkMesonLibrary,
nix-store-test-support,
nix-expr,
nix-expr-c,
rapidcheck,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-util-test-support";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
propagatedBuildInputs = [
nix-store-test-support
nix-expr
nix-expr-c
rapidcheck
];
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 = [
];
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,86 @@
{
lib,
buildPackages,
stdenv,
mkMesonExecutable,
nix-expr,
nix-expr-c,
nix-expr-test-support,
rapidcheck,
gtest,
runCommand,
# Configuration Options
version,
resolvePath,
}:
let
inherit (lib) fileset;
in
mkMesonExecutable (finalAttrs: {
pname = "nix-expr-tests";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
buildInputs = [
nix-expr
nix-expr-c
nix-expr-test-support
rapidcheck
gtest
];
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 = [
];
passthru = {
tests = {
run =
runCommand "${finalAttrs.pname}-run"
{
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
}
(
lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
);
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
};
})

View File

@ -0,0 +1,103 @@
{
lib,
stdenv,
mkMesonLibrary,
bison,
flex,
cmake, # for resolving toml11 dep
nix-util,
nix-store,
nix-fetchers,
boost,
boehmgc,
nlohmann_json,
toml11,
# Configuration Options
version,
# Whether to use garbage collection for the Nix language evaluator.
#
# If it is disabled, we just leak memory, but this is not as bad as it
# sounds so long as evaluation just takes places within short-lived
# processes. (When the process exits, the memory is reclaimed; it is
# only leaked *within* the process.)
#
# Temporarily disabled on Windows because the `GC_throw_bad_alloc`
# symbol is missing during linking.
enableGC ? !stdenv.hostPlatform.isWindows,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-expr";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
./meson.options
./primops/meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
./lexer.l
./parser.y
(fileset.difference (fileset.fileFilter (file: file.hasExt "nix") ./.) ./package.nix)
];
nativeBuildInputs = [
bison
flex
cmake
];
buildInputs = [
toml11
];
propagatedBuildInputs = [
nix-util
nix-store
nix-fetchers
] ++ finalAttrs.passthru.externalPropagatedBuildInputs;
# Hack for sake of the dev shell
passthru.externalPropagatedBuildInputs = [
boost
nlohmann_json
] ++ lib.optional enableGC boehmgc;
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 = [
(lib.mesonEnable "gc" enableGC)
];
env = {
# Needed for Meson to find Boost.
# https://github.com/NixOS/nixpkgs/issues/86131.
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,84 @@
{
lib,
buildPackages,
stdenv,
mkMesonExecutable,
nix-fetchers,
nix-store-test-support,
rapidcheck,
gtest,
runCommand,
# Configuration Options
version,
resolvePath,
}:
let
inherit (lib) fileset;
in
mkMesonExecutable (finalAttrs: {
pname = "nix-fetchers-tests";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
buildInputs = [
nix-fetchers
nix-store-test-support
rapidcheck
gtest
];
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 = [
];
passthru = {
tests = {
run =
runCommand "${finalAttrs.pname}-run"
{
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
}
(
lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
);
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
};
})

View File

@ -0,0 +1,56 @@
{
lib,
mkMesonLibrary,
nix-util,
nix-store,
nlohmann_json,
libgit2,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-fetchers";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
buildInputs = [
libgit2
];
propagatedBuildInputs = [
nix-store
nix-util
nlohmann_json
];
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
'';
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,56 @@
{
lib,
mkMesonLibrary,
nix-store-c,
nix-expr-c,
nix-flake,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-flake-c";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
(fileset.fileFilter (file: file.hasExt "h") ./.)
];
propagatedBuildInputs = [
nix-expr-c
nix-store-c
nix-flake
];
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 = [
];
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,87 @@
{
lib,
buildPackages,
stdenv,
mkMesonExecutable,
nix-flake,
nix-flake-c,
nix-expr-test-support,
rapidcheck,
gtest,
runCommand,
# Configuration Options
version,
resolvePath,
}:
let
inherit (lib) fileset;
in
mkMesonExecutable (finalAttrs: {
pname = "nix-flake-tests";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
buildInputs = [
nix-flake
nix-flake-c
nix-expr-test-support
rapidcheck
gtest
];
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 = [
];
passthru = {
tests = {
run =
runCommand "${finalAttrs.pname}-run"
{
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
}
(
lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
export NIX_CONFIG="extra-experimental-features = flakes"
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
);
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
};
})

View File

@ -0,0 +1,55 @@
{
lib,
mkMesonLibrary,
nix-util,
nix-store,
nix-fetchers,
nix-expr,
nlohmann_json,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-flake";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
propagatedBuildInputs = [
nix-store
nix-util
nix-fetchers
nix-expr
nlohmann_json
];
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
'';
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,58 @@
{
lib,
mkMesonLibrary,
nix-util-c,
nix-store,
nix-store-c,
nix-main,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-main-c";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
(fileset.fileFilter (file: file.hasExt "h") ./.)
];
propagatedBuildInputs = [
nix-util-c
nix-store
nix-store-c
nix-main
];
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 = [
];
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,52 @@
{
lib,
mkMesonLibrary,
openssl,
nix-util,
nix-store,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-main";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
propagatedBuildInputs = [
nix-util
nix-store
openssl
];
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
'';
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,54 @@
{
lib,
mkMesonLibrary,
nix-util-c,
nix-store,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-store-c";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
(fileset.fileFilter (file: file.hasExt "h") ./.)
];
propagatedBuildInputs = [
nix-util-c
nix-store
];
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 = [
];
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,58 @@
{
lib,
mkMesonLibrary,
nix-util-test-support,
nix-store,
nix-store-c,
rapidcheck,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-store-test-support";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
propagatedBuildInputs = [
nix-util-test-support
nix-store
nix-store-c
rapidcheck
];
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 = [
];
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,103 @@
{
lib,
buildPackages,
stdenv,
mkMesonExecutable,
nix-store,
nix-store-c,
nix-store-test-support,
sqlite,
rapidcheck,
gtest,
runCommand,
# Configuration Options
version,
filesetToSource,
}:
let
inherit (lib) fileset;
in
mkMesonExecutable (finalAttrs: {
pname = "nix-store-tests";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
# Hack for sake of the dev shell
passthru.externalBuildInputs = [
sqlite
rapidcheck
gtest
];
buildInputs = finalAttrs.passthru.externalBuildInputs ++ [
nix-store
nix-store-c
nix-store-test-support
];
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 = [
];
passthru = {
tests = {
run =
let
# Some data is shared with the functional tests: they create it,
# we consume it.
data = filesetToSource {
root = ../..;
fileset = lib.fileset.unions [
./data
../../tests/functional/derivation
];
};
in
runCommand "${finalAttrs.pname}-run"
{
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
}
(
lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"}
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
);
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
};
})

View File

@ -0,0 +1,100 @@
{
lib,
stdenv,
mkMesonLibrary,
unixtools,
darwin,
nix-util,
boost,
curl,
aws-sdk-cpp,
libseccomp,
nlohmann_json,
sqlite,
busybox-sandbox-shell ? null,
# Configuration Options
version,
embeddedSandboxShell ? stdenv.hostPlatform.isStatic,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-store";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
./meson.options
./linux/meson.build
./unix/meson.build
./windows/meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
(fileset.fileFilter (file: file.hasExt "sb") ./.)
(fileset.fileFilter (file: file.hasExt "md") ./.)
(fileset.fileFilter (file: file.hasExt "sql") ./.)
];
nativeBuildInputs = lib.optional embeddedSandboxShell unixtools.hexdump;
buildInputs =
[
boost
curl
sqlite
]
++ lib.optional stdenv.hostPlatform.isLinux libseccomp
# There have been issues building these dependencies
++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.libs.sandbox
++ lib.optional (
stdenv.hostPlatform == stdenv.buildPlatform && (stdenv.isLinux || stdenv.isDarwin)
) aws-sdk-cpp;
propagatedBuildInputs = [
nix-util
nlohmann_json
];
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 =
[
(lib.mesonEnable "seccomp-sandboxing" stdenv.hostPlatform.isLinux)
(lib.mesonBool "embedded-sandbox-shell" embeddedSandboxShell)
]
++ lib.optionals stdenv.hostPlatform.isLinux [
(lib.mesonOption "sandbox-shell" "${busybox-sandbox-shell}/bin/busybox")
];
env = {
# Needed for Meson to find Boost.
# https://github.com/NixOS/nixpkgs/issues/86131.
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,52 @@
{
lib,
mkMesonLibrary,
nix-util,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-util-c";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
(fileset.fileFilter (file: file.hasExt "h") ./.)
];
propagatedBuildInputs = [
nix-util
];
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 = [
];
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,56 @@
{
lib,
mkMesonLibrary,
nix-util,
nix-util-c,
rapidcheck,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-util-test-support";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
propagatedBuildInputs = [
nix-util
nix-util-c
rapidcheck
];
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 = [
];
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,86 @@
{
lib,
buildPackages,
stdenv,
mkMesonExecutable,
nix-util,
nix-util-c,
nix-util-test-support,
rapidcheck,
gtest,
runCommand,
# Configuration Options
version,
resolvePath,
}:
let
inherit (lib) fileset;
in
mkMesonExecutable (finalAttrs: {
pname = "nix-util-tests";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
# ./meson.options
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
buildInputs = [
nix-util
nix-util-c
nix-util-test-support
rapidcheck
gtest
];
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 = [
];
passthru = {
tests = {
run =
runCommand "${finalAttrs.pname}-run"
{
meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
}
(
lib.optionalString stdenv.hostPlatform.isWindows ''
export HOME="$PWD/home-dir"
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
);
};
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
};
})

View File

@ -0,0 +1,81 @@
{
lib,
stdenv,
mkMesonLibrary,
boost,
brotli,
libarchive,
libcpuid,
libsodium,
nlohmann_json,
openssl,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonLibrary (finalAttrs: {
pname = "nix-util";
inherit version;
workDir = ./.;
fileset = fileset.unions [
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./widecharwidth
./meson.build
./meson.options
./linux/meson.build
./unix/meson.build
./windows/meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.)
];
buildInputs = [
brotli
libsodium
openssl
] ++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid;
propagatedBuildInputs = [
boost
libarchive
nlohmann_json
];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
#
# TODO: change release process to add `pre` in `.version`, remove it
# before tagging, and restore after.
''
chmod u+w ./.version
echo ${version} > ../../.version
'';
mesonFlags = [
(lib.mesonEnable "cpuid" stdenv.hostPlatform.isx86_64)
];
env = {
# Needed for Meson to find Boost.
# https://github.com/NixOS/nixpkgs/issues/86131.
BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
};
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,109 @@
{
lib,
mkMesonExecutable,
nix-store,
nix-expr,
nix-main,
nix-cmd,
# Configuration Options
version,
}:
let
inherit (lib) fileset;
in
mkMesonExecutable (finalAttrs: {
pname = "nix";
inherit version;
workDir = ./.;
fileset = fileset.unions (
[
../../nix-meson-build-support
./nix-meson-build-support
../../.version
./.version
./meson.build
./meson.options
# Symbolic links to other dirs
## exes
./build-remote
./doc
./nix-build
./nix-channel
./nix-collect-garbage
./nix-copy-closure
./nix-env
./nix-instantiate
./nix-store
## dirs
./scripts
../../scripts
./misc
../../misc
# 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/source/store/types/index.md.in
./profiles.md
../../doc/manual/source/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
]
);
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 = [
];
meta = {
platforms = lib.platforms.unix ++ lib.platforms.windows;
};
})

View File

@ -0,0 +1,82 @@
{
lib,
stdenv,
mkMesonDerivation,
pkg-config,
perl,
perlPackages,
nix-store,
version,
curl,
bzip2,
libsodium,
}:
let
inherit (lib) fileset;
in
perl.pkgs.toPerlModule (
mkMesonDerivation (finalAttrs: {
pname = "nix-perl";
inherit version;
workDir = ./.;
fileset = fileset.unions (
[
./.version
../../.version
./MANIFEST
./lib
./meson.build
./meson.options
]
++ lib.optionals finalAttrs.doCheck [
./.yath.rc.in
./t
]
);
nativeBuildInputs = [
pkg-config
perl
curl
];
buildInputs = [
nix-store
] ++ finalAttrs.passthru.externalBuildInputs;
# Hack for sake of the dev shell
passthru.externalBuildInputs = [
bzip2
libsodium
];
# `perlPackages.Test2Harness` is marked broken for Darwin
doCheck = !stdenv.isDarwin;
nativeCheckInputs = [
perlPackages.Test2Harness
];
preConfigure =
# "Inline" .version so its not a symlink, and includes the suffix
''
chmod u+w .version
echo ${finalAttrs.version} > .version
'';
mesonFlags = [
(lib.mesonOption "dbi_path" "${perlPackages.DBI}/${perl.libPrefix}")
(lib.mesonOption "dbd_sqlite_path" "${perlPackages.DBDSQLite}/${perl.libPrefix}")
(lib.mesonEnable "tests" finalAttrs.doCheck)
];
mesonCheckFlags = [
"--print-errorlogs"
];
strictDeps = false;
})
)

View File

@ -0,0 +1,110 @@
{
lib,
stdenv,
mkMesonDerivation,
meson,
ninja,
pkg-config,
jq,
git,
mercurial,
util-linux,
nix-store,
nix-expr,
nix-cli,
busybox-sandbox-shell ? null,
# Configuration Options
pname ? "nix-functional-tests",
version,
# For running the functional tests against a different pre-built Nix.
test-daemon ? null,
}:
let
inherit (lib) fileset;
in
mkMesonDerivation (
finalAttrs:
{
inherit pname version;
workDir = ./.;
fileset = fileset.unions [
../../scripts/nix-profile.sh.in
../../.version
../../tests/functional
./.
];
# Hack for sake of the dev shell
passthru.externalNativeBuildInputs =
[
meson
ninja
pkg-config
jq
git
mercurial
]
++ lib.optionals stdenv.hostPlatform.isLinux [
# For various sandboxing tests that needs a statically-linked shell,
# etc.
busybox-sandbox-shell
# For Overlay FS tests need `mount`, `umount`, and `unshare`.
# For `script` command (ensuring a TTY)
# TODO use `unixtools` to be precise over which executables instead?
util-linux
];
nativeBuildInputs = finalAttrs.passthru.externalNativeBuildInputs ++ [
nix-cli
];
buildInputs = [
nix-store
nix-expr
];
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
''
# TEMP hack for Meson before make is gone, where
# `src/nix-functional-tests` is during the transition a symlink and
# not the actual directory directory.
+ ''
cd $(readlink -e $PWD)
echo $PWD | grep tests/functional
'';
mesonCheckFlags = [
"--print-errorlogs"
];
doCheck = true;
installPhase = ''
mkdir $out
'';
meta = {
platforms = lib.platforms.unix;
};
}
// lib.optionalAttrs (test-daemon != null) {
NIX_DAEMON_PACKAGE = test-daemon;
}
)

View File

@ -250,37 +250,9 @@ self = stdenv.mkDerivation {
perl-bindings = perl.pkgs.toPerlModule (callPackage ./nix-perl.nix { nix = self; inherit Security; });
tests = {
srcVersion = runCommand "nix-src-version" {
inherit version;
} ''
# This file is an implementation detail, but it's a good sanity check
# If upstream changes that, we'll have to adapt.
srcVersion=$(cat ${src}/.version)
echo "Version in nix nix expression: $version"
echo "Version in nix.src: $srcVersion"
if [ "$version" != "$srcVersion" ]; then
echo "Version mismatch!"
exit 1
fi
touch $out
'';
/** Intended to test `lib`, but also a good smoke test for Nix */
nixpkgs-lib = import ../../../../lib/tests/test-with-nix.nix {
inherit lib pkgs;
nix = self;
};
} // lib.optionalAttrs stdenv.hostPlatform.isLinux {
nixStatic = pkgsStatic.nixVersions.${self_attribute_name};
# Basic smoke tests that needs to pass when upgrading nix.
# Note that this test does only test the nixVersions.stable attribute.
misc = nixosTests.nix-misc.default;
upgrade = nixosTests.nix-upgrade;
simpleUefiSystemdBoot = nixosTests.installer.simpleUefiSystemdBoot;
} // lib.optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") {
nixi686 = pkgsi686Linux.nixVersions.${self_attribute_name};
tests = import ./tests.nix {
inherit runCommand version src lib stdenv pkgs pkgsi686Linux pkgsStatic nixosTests self_attribute_name;
nix = self;
};
};

View File

@ -9,6 +9,10 @@
, fetchpatch2
, runCommand
, Security
, pkgs
, pkgsi686Linux
, pkgsStatic
, nixosTests
, storeDir ? "/nix/store"
, stateDir ? "/nix/var"
@ -160,6 +164,19 @@ in lib.makeExtensible (self: ({
self_attribute_name = "nix_2_25";
};
nix_2_26 = (callPackage ./2_26/componentized.nix { }).overrideAttrs (this: old: {
passthru = old.passthru or {} // {
tests =
old.passthru.tests or {}
// import ./tests.nix {
inherit runCommand lib stdenv pkgs pkgsi686Linux pkgsStatic nixosTests;
inherit (old) version src;
nix = this.finalPackage;
self_attribute_name = "nix_2_26";
};
};
});
git = common rec {
version = "2.25.0";
suffix = "pre20241101_${lib.substring 0 8 src.rev}";

View File

@ -0,0 +1,52 @@
{
runCommand,
version,
src,
nix,
lib,
stdenv,
pkgs,
pkgsi686Linux,
pkgsStatic,
nixosTests,
self_attribute_name,
}:
{
srcVersion =
runCommand "nix-src-version"
{
inherit version;
}
''
# This file is an implementation detail, but it's a good sanity check
# If upstream changes that, we'll have to adapt.
srcVersion=$(cat ${src}/.version)
echo "Version in nix nix expression: $version"
echo "Version in nix.src: $srcVersion"
if [ "$version" != "$srcVersion" ]; then
echo "Version mismatch!"
exit 1
fi
touch $out
'';
/**
Intended to test `lib`, but also a good smoke test for Nix
*/
nixpkgs-lib = import ../../../../lib/tests/test-with-nix.nix {
inherit lib pkgs;
inherit nix;
};
}
// lib.optionalAttrs stdenv.hostPlatform.isLinux {
nixStatic = pkgsStatic.nixVersions.${self_attribute_name};
# Basic smoke tests that needs to pass when upgrading nix.
# Note that this test does only test the nixVersions.stable attribute.
misc = nixosTests.nix-misc.default;
upgrade = nixosTests.nix-upgrade;
simpleUefiSystemdBoot = nixosTests.installer.simpleUefiSystemdBoot;
}
// lib.optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") {
nixi686 = pkgsi686Linux.nixVersions.${self_attribute_name};
}