From 3d6d49fae43dd40f58aa14e8bc1a9cd952cae4c5 Mon Sep 17 00:00:00 2001 From: Guillaume Fournier <> Date: Sun, 14 Jan 2024 10:38:32 +0100 Subject: [PATCH] Add nix recipes --- .../libeditline/libeditline_1.17.1.bb | 8 +++ recipes-core/nix/nix/configure.ac.patch | 29 +++++++++ recipes-core/nix/nix/markdown.cc.patch | 32 ++++++++++ recipes-core/nix/nix_2.19.2.bb | 64 +++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 recipes-core/libeditline/libeditline_1.17.1.bb create mode 100644 recipes-core/nix/nix/configure.ac.patch create mode 100644 recipes-core/nix/nix/markdown.cc.patch create mode 100644 recipes-core/nix/nix_2.19.2.bb diff --git a/recipes-core/libeditline/libeditline_1.17.1.bb b/recipes-core/libeditline/libeditline_1.17.1.bb new file mode 100644 index 0000000..9439a2d --- /dev/null +++ b/recipes-core/libeditline/libeditline_1.17.1.bb @@ -0,0 +1,8 @@ +SUMMARY = "A small replacement for GNU readline() for UNIX" +LICENSE = "CLOSED" + +SRC_URI = "git://github.com/troglobit/editline.git;branch=master;protocol=https" +SRCREV = "ecabef273ebf4193c5d6aff196de1c204169bc52" +S = "${WORKDIR}/git" + +inherit autotools pkgconfig diff --git a/recipes-core/nix/nix/configure.ac.patch b/recipes-core/nix/nix/configure.ac.patch new file mode 100644 index 0000000..c567d30 --- /dev/null +++ b/recipes-core/nix/nix/configure.ac.patch @@ -0,0 +1,29 @@ +diff --git a/configure.ac b/configure.ac +index 281ba2c32..c58e0f2fd 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -347,8 +347,23 @@ AC_ARG_ENABLE(doc-gen, AS_HELP_STRING([--disable-doc-gen],[disable documentation + doc_generate=$enableval, doc_generate=yes) + AC_SUBST(doc_generate) + ++ + # Look for lowdown library. +-PKG_CHECK_MODULES([LOWDOWN], [lowdown >= 0.9.0], [CXXFLAGS="$LOWDOWN_CFLAGS $CXXFLAGS"]) ++AC_ARG_ENABLE([markdown], AS_HELP_STRING([--enable-markdown], [Enable Markdown rendering in the Nix binary (requires lowdown) [default=auto]]), ++ enable_markdown=$enableval, enable_markdown=auto) ++AS_CASE(["$enable_markdown"], ++ [yes | auto], [ ++ PKG_CHECK_MODULES([LOWDOWN], [lowdown >= 0.9.0], [ ++ CXXFLAGS="$LOWDOWN_CFLAGS $CXXFLAGS" ++ have_lowdown=1 ++ AC_DEFINE(HAVE_LOWDOWN, 1, [Whether lowdown is available and should be used for Markdown rendering.]) ++ ], [ ++ AS_IF([test "x$enable_markdown" == "xyes"], [AC_MSG_ERROR([--enable-markdown was specified, but lowdown was not found.])]) ++ ]) ++ ], ++ [no], [have_lowdown=], ++ [AC_MSG_ERROR([bad value "$enable_markdown" for --enable-markdown, must be one of: yes, no, auto])]) ++ + + # Setuid installations. + AC_CHECK_FUNCS([setresuid setreuid lchown]) diff --git a/recipes-core/nix/nix/markdown.cc.patch b/recipes-core/nix/nix/markdown.cc.patch new file mode 100644 index 0000000..c70f851 --- /dev/null +++ b/recipes-core/nix/nix/markdown.cc.patch @@ -0,0 +1,32 @@ +diff --git a/src/libcmd/markdown.cc b/src/libcmd/markdown.cc +index 8b3bbc1b5..e0d5ba0fc 100644 +--- a/src/libcmd/markdown.cc ++++ b/src/libcmd/markdown.cc +@@ -4,14 +4,15 @@ + #include "terminal.hh" + + #include ++#if HAVE_LOWDOWN + #include +- ++#endif + namespace nix { + + std::string renderMarkdownToTerminal(std::string_view markdown) + { + int windowWidth = getWindowSize().second; +- ++#if HAVE_LOWDOWN + struct lowdown_opts opts { + .type = LOWDOWN_TERM, + .maxdepth = 20, +@@ -48,6 +49,9 @@ std::string renderMarkdownToTerminal(std::string_view markdown) + throw Error("allocation error while rendering Markdown"); + + return filterANSIEscapes(std::string(buf->data, buf->size), !shouldANSI()); ++#else ++ return std::string(markdown); ++#endif + } + + } diff --git a/recipes-core/nix/nix_2.19.2.bb b/recipes-core/nix/nix_2.19.2.bb new file mode 100644 index 0000000..23a7cb9 --- /dev/null +++ b/recipes-core/nix/nix_2.19.2.bb @@ -0,0 +1,64 @@ +SUMMARY = "Nix package manager" +LICENSE = "LGPL-2.1" +LIC_FILES_CHKSUM = "file://${WORKDIR}/git/COPYING;md5=fbc093901857fcd118f065f900982c24" + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI += "git://github.com/NixOS/nix.git;branch=latest-release;protocol=https \ + file://configure.ac.patch \ + file://markdown.cc.patch \ + " + +SRCREV = "50f8f1c8bc019a4c0fd098b9ac674b94cfc6af0d" +S = "${WORKDIR}/git" + +inherit autotools-brokensep pkgconfig systemd + +DEPENDS += " \ + bison-native \ + clang-native \ + autoconf-archive \ + jq-native \ + boost \ + openssl \ + libarchive \ + curl \ + libsodium \ + brotli \ + libeditline \ + libseccomp \ + bdwgc \ + nlohmann-json \ + libgit2 \ + " +RDEPENDS:${PN} += " \ + boost \ + openssl \ + libarchive \ + curl \ + libsodium \ + brotli \ + libeditline \ + libseccomp \ + bdwgc \ + nlohmann-json \ + libgit2 \ + " + +FILES:${PN} += "${libdir}/tmpfiles.d/* " + +do_install:append(){ + # Remove unneeded things that we don't want on the nao. + rm -r "${D}/usr/share/" + + # Move service and socket to destination where systemd.bbclass can work with it. + install -d "${D}${systemd_unitdir}/system/" + mv "${D}/usr/lib/systemd/system/nix-daemon.service" "${D}/usr/lib/systemd/system/nix-daemon.socket" "${D}${systemd_unitdir}/system/" + rm -r "${D}/usr/lib/systemd" +} + + +SYSTEMD_SERVICE:${PN} = "nix-daemon.service nix-daemon.socket" + +EXTRA_OECONF += "--disable-cpuid --disable-tests --disable-doc-gen" +PARALLEL_MAKE = "-j 16"