Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify flake.nix by creating generic callPackage-able package.nix #9535

Merged
merged 32 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c982198
First step
tfc Nov 30, 2023
c64190e
Run statix
tfc Nov 30, 2023
f55ee7c
little refactoring
tfc Nov 30, 2023
eff9b12
Further changes
tfc Dec 1, 2023
2c3749a
Fix cross builds
tfc Dec 2, 2023
ca59832
Fix coverage.nix
tfc Dec 2, 2023
118fa96
Create internal-api-docs.nix
tfc Dec 2, 2023
19d41fb
Fix stuff
tfc Dec 2, 2023
0ca49b0
Add installing unit test flags
Ericson2314 Dec 3, 2023
ce598ba
WIP
Ericson2314 Dec 3, 2023
3d47e02
WIP
Ericson2314 Dec 3, 2023
c9838bb
Merge remote-tracking branch 'upstream/master' into package-nix
Ericson2314 Dec 3, 2023
c71d987
Fix incorrect flag name
Ericson2314 Dec 3, 2023
7b51086
More fixes
Ericson2314 Dec 3, 2023
c160c62
Fix underlying build system so `--disable-build` works better
Ericson2314 Dec 3, 2023
7a7ad7c
Remove uneeded file
Ericson2314 Dec 3, 2023
e275f0a
Move `binary-tarball.nix` to scripts dir
Ericson2314 Dec 3, 2023
60fe4dd
Expose `boehmgc-nix` in overlay
Ericson2314 Dec 3, 2023
77003a4
Factor out the installer script
Ericson2314 Dec 3, 2023
f586155
Add documenting comments to `package.nix`
Ericson2314 Dec 3, 2023
a5a45e6
Don't expose file sets anymore
Ericson2314 Dec 3, 2023
7e2b1cc
Slap on `perl-bindings` in the caller
Ericson2314 Dec 3, 2023
6e0656c
Add another configure flag assertion
Ericson2314 Dec 3, 2023
14c26d6
Clean up two comments
Ericson2314 Dec 3, 2023
2220a4a
Merge remote-tracking branch 'upstream/master' into package-nix
Ericson2314 Dec 11, 2023
ff992f8
Merge remote-tracking branch 'upstream/master' into package-nix
Ericson2314 Dec 11, 2023
d904f64
Merge remote-tracking branch 'upstream/master' into package-nix
Ericson2314 Dec 13, 2023
19573f1
Restore comment
Ericson2314 Dec 13, 2023
f10f0f1
Move `lowdown.nix` to `misc/`
Ericson2314 Dec 13, 2023
bf5804d
flake.nix: Delete uneeded `attrs0` binding
Ericson2314 Dec 13, 2023
28f2f31
Delete stray `install_name_tool` call
Ericson2314 Dec 13, 2023
2d24875
package.nix: Avoid `${..}` for conditional strings
Ericson2314 Dec 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ include mk/lib.mk
# by the library. Rules are not "lazy" like variables, unfortunately.
ifeq ($(ENABLE_BUILD), yes)
$(eval $(call include-sub-makefile, doc/manual/local.mk))
$(eval $(call include-sub-makefile, doc/internal-api/local.mk))
endif
$(eval $(call include-sub-makefile, doc/internal-api/local.mk))

GLOBAL_CXXFLAGS += -g -Wall -include config.h -std=c++2a -I src
50 changes: 28 additions & 22 deletions configure.ac
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to include non-Nix changes? If it's only Nix changes, you should be able to verify correctness by making sure you get the same derivations. It's probably also cleaner that way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configure script changes are because the configure script wrongly still checks for a bunch of would-be mandatory stuff when passing --disable-build.

I could PR that separately before the rest, but note that due to switching to things like lib.enableFeature I wasn't going for 100% preserved hashes.

Copy link
Member

@roberth roberth Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nix-diff is your friend in that case. (EDIT: on derivation paths)

Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ AC_PATH_PROG(flex, flex, false)
AC_PATH_PROG(bison, bison, false)
AC_PATH_PROG(dot, dot)
AC_PATH_PROG(lsof, lsof, lsof)
NEED_PROG(jq, jq)


AC_SUBST(coreutils, [$(dirname $(type -p cat))])
Expand All @@ -133,6 +132,30 @@ AC_ARG_WITH(store-dir, AS_HELP_STRING([--with-store-dir=PATH],[path of the Nix s
AC_SUBST(storedir)


# Running the functional tests without building Nix is useful for testing
# different pre-built versions of Nix against each other.
AC_ARG_ENABLE(build, AS_HELP_STRING([--disable-build],[Do not build nix]),
ENABLE_BUILD=$enableval, ENABLE_BUILD=yes)
AC_SUBST(ENABLE_BUILD)

# Building without tests is useful for bootstrapping with a smaller footprint
# or running the tests in a separate derivation. Otherwise, we do compile and
# run them.
AC_ARG_ENABLE(tests, AS_HELP_STRING([--disable-tests],[Do not build the tests]),
ENABLE_TESTS=$enableval, ENABLE_TESTS=yes)
AC_SUBST(ENABLE_TESTS)

# Building without API docs is the default as Nix' C++ interfaces are internal and unstable.
AC_ARG_ENABLE(internal_api_docs, AS_HELP_STRING([--enable-internal-api-docs],[Build API docs for Nix's internal unstable C++ interfaces]),
internal_api_docs=$enableval, internal_api_docs=no)
AC_SUBST(internal_api_docs)

AS_IF(
[test "$ENABLE_BUILD" == "yes" || test "$ENABLE_TEST" == "yes"],
[NEED_PROG(jq, jq)])

AS_IF([test "$ENABLE_BUILD" == "yes"],[

# Look for boost, a required dependency.
# Note that AX_BOOST_BASE only exports *CPP* BOOST_CPPFLAGS, no CXX flags,
# and CPPFLAGS are not passed to the C++ compiler automatically.
Expand All @@ -155,18 +178,6 @@ if test "x$GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC" = xyes; then
LDFLAGS="-latomic $LDFLAGS"
fi

# Running the functional tests without building Nix is useful for testing
# different pre-built versions of Nix against each other.
AC_ARG_ENABLE(build, AS_HELP_STRING([--disable-build],[Do not build nix]),
ENABLE_BUILD=$enableval, ENABLE_BUILD=yes)
AC_SUBST(ENABLE_BUILD)
# Building without tests is useful for bootstrapping with a smaller footprint
# or running the tests in a separate derivation. Otherwise, we do compile and
# run them.
AC_ARG_ENABLE(tests, AS_HELP_STRING([--disable-tests],[Do not build the tests]),
ENABLE_TESTS=$enableval, ENABLE_TESTS=yes)
AC_SUBST(ENABLE_TESTS)

AC_ARG_ENABLE(install-unit-tests, AS_HELP_STRING([--enable-install-unit-tests],[Install the unit tests for running later (default no)]),
INSTALL_UNIT_TESTS=$enableval, INSTALL_UNIT_TESTS=no)
AC_SUBST(INSTALL_UNIT_TESTS)
Expand All @@ -179,11 +190,6 @@ AC_ARG_WITH(check-lib-dir, AS_HELP_STRING([--with-check-lib-dir=PATH],[path to i
checklibdir=$withval, checklibdir=$libdir)
AC_SUBST(checklibdir)

# Building without API docs is the default as Nix' C++ interfaces are internal and unstable.
AC_ARG_ENABLE(internal_api_docs, AS_HELP_STRING([--enable-internal-api-docs],[Build API docs for Nix's internal unstable C++ interfaces]),
internal_api_docs=$enableval, internal_api_docs=no)
AC_SUBST(internal_api_docs)

# LTO is currently broken with clang for unknown reasons; ld segfaults in the llvm plugin
AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto],[Enable LTO (only supported with GCC) [default=no]]),
lto=$enableval, lto=no)
Expand Down Expand Up @@ -310,8 +316,7 @@ if test "$gc" = yes; then
AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
fi


if test "$ENABLE_TESTS" = yes; then
AS_IF([test "$ENABLE_TESTS" == "yes"],[

# Look for gtest.
PKG_CHECK_MODULES([GTEST], [gtest_main])
Expand All @@ -338,12 +343,11 @@ AC_LINK_IFELSE([
[AC_MSG_ERROR([librapidcheck is not found.])])
AC_LANG_POP(C++)

fi
])

# Look for nlohmann/json.
PKG_CHECK_MODULES([NLOHMANN_JSON], [nlohmann_json >= 3.9])


# documentation generation switch
AC_ARG_ENABLE(doc-gen, AS_HELP_STRING([--disable-doc-gen],[disable documentation generation]),
doc_generate=$enableval, doc_generate=yes)
Expand Down Expand Up @@ -388,6 +392,8 @@ if test "$embedded_sandbox_shell" = yes; then
AC_DEFINE(HAVE_EMBEDDED_SANDBOX_SHELL, 1, [Include the sandbox shell in the Nix binary.])
fi

])


# Expand all variables in config.status.
test "$prefix" = NONE && prefix=$ac_default_prefix
Expand Down
Loading
Loading