From 46bd0da51b3dc8469098c370d8c6816ef70410bb Mon Sep 17 00:00:00 2001 From: Mazunki Hoksaas Date: Wed, 29 Oct 2025 11:22:06 +0100 Subject: [PATCH 1/2] consistent let..in as a preemptive measure --- deps/botan/default.nix | 25 +++++--- deps/http-parser/default.nix | 8 ++- deps/lest/default.nix | 45 +++++++------ deps/libfmt/default.nix | 11 ++-- deps/musl-unpatched/default.nix | 55 +++++++++------- deps/musl/default.nix | 69 +++++++++++--------- deps/s2n/default.nix | 89 ++++++++++++++------------ deps/uzlib/default.nix | 108 +++++++++++++++++--------------- 8 files changed, 229 insertions(+), 181 deletions(-) diff --git a/deps/botan/default.nix b/deps/botan/default.nix index 2b5cae02e..decf5c7a7 100644 --- a/deps/botan/default.nix +++ b/deps/botan/default.nix @@ -3,18 +3,23 @@ }: let cpuFlag = if pkgs.stdenv.system == "i686-linux" then "x86_32" else "x86_64"; + + self = pkgs.botan2; + + dev = pkgs.libs.getDev self; + lib = pkgs.libs.getLib self; in -pkgs.botan2.overrideAttrs (oldAttrs: { + self.overrideAttrs (oldAttrs: { - postInstall = (oldAttrs.postInstall or "") + '' - ln -sr "$out/include/botan-2/botan" "$out/include" - ''; + postInstall = (oldAttrs.postInstall or "") + '' + ln -sr "$out/include/botan-2/botan" "$out/include" + ''; - buildPhase = '' - runHook preBuild + buildPhase = '' + runHook preBuild - make -j $NIX_BUILD_CORES + make -j $NIX_BUILD_CORES - runHook postBuild - ''; -}) + runHook postBuild + ''; + }) diff --git a/deps/http-parser/default.nix b/deps/http-parser/default.nix index 45e3e7aa7..49118e163 100644 --- a/deps/http-parser/default.nix +++ b/deps/http-parser/default.nix @@ -13,8 +13,14 @@ let sha256 = "15bdlccjg14qa7lwkcc7pikvi386ig108ca62hbxfas5wyw1fr62"; }; pkgsHttpfix = import nixpkgsHttpfix { crossSystem = { config = stdenv.targetPlatform.config; }; }; + pkgs = pkgsHttpfix.pkgsStatic; + + self = pkgs.http-parser; + + dev = pkgs.lib.getDev self; + lib = pkgs.lib.getLib self; in - pkgsHttpfix.pkgsStatic.http-parser.overrideAttrs (oldAttrs: { + self.overrideAttrs (oldAttrs: { inherit stdenv; postInstall = (oldAttrs.postInstall or "") + '' mkdir "$out/include/http-parser" diff --git a/deps/lest/default.nix b/deps/lest/default.nix index 37ad42d8d..86f2dfd6d 100644 --- a/deps/lest/default.nix +++ b/deps/lest/default.nix @@ -2,27 +2,34 @@ pkgs, stdenv }: -stdenv.mkDerivation rec { - pname = "lest"; - version = "1.36.0"; +let + self = stdenv.mkDerivation rec { + pname = "lest"; + version = "1.36.0"; - meta = { - description = "A tiny C++11 test framework – lest errors escape testing."; - homepage = "https://github.com/martinmoene/lest"; - license = pkgs.lib.licenses.boost; - }; + meta = { + description = "A tiny C++11 test framework – lest errors escape testing."; + homepage = "https://github.com/martinmoene/lest"; + license = pkgs.lib.licenses.boost; + }; - src = fetchGit { - url = "https://github.com/martinmoene/lest.git"; - ref = "refs/tags/v${version}"; - rev = "57197f32f2c7d3f3d3664a9010d3ff181a40f6ca"; - }; + src = fetchGit { + url = "https://github.com/martinmoene/lest.git"; + ref = "refs/tags/v${version}"; + rev = "57197f32f2c7d3f3d3664a9010d3ff181a40f6ca"; + }; - cmakeBuildType = "Debug"; + cmakeBuildType = "Debug"; + + postBuild = '' + mkdir -p "$out/include" + cp -r include "$out/" + ''; + }; - postBuild = '' - mkdir -p "$out/include" - cp -r include "$out/" - ''; + dev = pkgs.lib.getDev self; + lib = pkgs.lib.getLib self; +in + self.overrideAttrs (oldAttrs: { + }) -} diff --git a/deps/libfmt/default.nix b/deps/libfmt/default.nix index 2bf00f857..f186fcb55 100644 --- a/deps/libfmt/default.nix +++ b/deps/libfmt/default.nix @@ -6,7 +6,7 @@ cmake ? pkgs.cmake }: let - libfmt = stdenv.mkDerivation rec { + self = stdenv.mkDerivation rec { pname = "fmt"; version = "12.0.0"; @@ -28,8 +28,11 @@ let "-DFMT_INSTALL=ON" ]; }; + + dev = pkgs.lib.getDev self; + lib = pkgs.lib.getLib self; in - libfmt // { - include = "${libfmt}/include"; - lib = "${libfmt}/lib"; + self // { + include = "${self}/include"; + lib = "${self}/lib"; } diff --git a/deps/musl-unpatched/default.nix b/deps/musl-unpatched/default.nix index 9fbb4e2de..cc8ca7092 100644 --- a/deps/musl-unpatched/default.nix +++ b/deps/musl-unpatched/default.nix @@ -3,35 +3,42 @@ stdenv , pkgs , linuxHeaders ? null }: -stdenv.mkDerivation rec { - pname = "musl-unpatched"; - version = "1.2.5"; +let + self = stdenv.mkDerivation rec { + pname = "musl-unpatched"; + version = "1.2.5"; - src = fetchGit { - url = "git://git.musl-libc.org/musl"; - rev = "0784374d561435f7c787a555aeab8ede699ed298"; - }; + src = fetchGit { + url = "git://git.musl-libc.org/musl"; + rev = "0784374d561435f7c787a555aeab8ede699ed298"; + }; - enableParallelBuilding = true; + enableParallelBuilding = true; - configurePhase = '' - echo "Configuring with musl's configure script" - echo "Target platform is ${stdenv.targetPlatform.config}" - ./configure --prefix=$out --with-malloc=oldmalloc --disable-shared --enable-debug CROSS_COMPILE=${stdenv.targetPlatform.config}- - ''; + configurePhase = '' + echo "Configuring with musl's configure script" + echo "Target platform is ${stdenv.targetPlatform.config}" + ./configure --prefix=$out --with-malloc=oldmalloc --disable-shared --enable-debug CROSS_COMPILE=${stdenv.targetPlatform.config}- + ''; - # Copy linux headers - taken from upstream nixpkgs musl, needed for libcxx to build - postInstall = '' - (cd $out/include && ln -s $(ls -d ${linuxHeaders}/include/* | grep -v "scsi$") .) - ''; + # Copy linux headers - taken from upstream nixpkgs musl, needed for libcxx to build + postInstall = '' + (cd $out/include && ln -s $(ls -d ${linuxHeaders}/include/* | grep -v "scsi$") .) + ''; - CFLAGS = "-Wno-error=int-conversion -nostdinc"; + CFLAGS = "-Wno-error=int-conversion -nostdinc"; - passthru.linuxHeaders = linuxHeaders; + passthru.linuxHeaders = linuxHeaders; - meta = { - description = "musl - Linux based libc (unpatched)"; - homepage = "https://www.musl-libc.org/"; - license = pkgs.lib.licenses.mit; + meta = { + description = "musl - Linux based libc (unpatched)"; + homepage = "https://www.musl-libc.org/"; + license = pkgs.lib.licenses.mit; + }; }; -} + + dev = pkgs.lib.getDev self; + lib = pkgs.lib.getLib self; +in + self.overrideAttrs (oldAttrs: { + }) diff --git a/deps/musl/default.nix b/deps/musl/default.nix index c3070d334..a2ea8adad 100644 --- a/deps/musl/default.nix +++ b/deps/musl/default.nix @@ -3,45 +3,52 @@ stdenv , pkgs , linuxHeaders ? null }: -stdenv.mkDerivation rec { - pname = "musl-includeos"; - version = "1.2.5"; +let + self = stdenv.mkDerivation rec { + pname = "musl-includeos"; + version = "1.2.5"; - src = fetchGit { - url = "git://git.musl-libc.org/musl"; - rev = "0784374d561435f7c787a555aeab8ede699ed298"; - }; + src = fetchGit { + url = "git://git.musl-libc.org/musl"; + rev = "0784374d561435f7c787a555aeab8ede699ed298"; + }; - enableParallelBuilding = true; + enableParallelBuilding = true; - patches = [ - ./patches/musl.patch - ./patches/endian.patch - ]; + patches = [ + ./patches/musl.patch + ./patches/endian.patch + ]; - passthru.linuxHeaders = linuxHeaders; + passthru.linuxHeaders = linuxHeaders; - postUnpack = '' - echo "Replacing musl's syscall headers with IncludeOS syscalls" + postUnpack = '' + echo "Replacing musl's syscall headers with IncludeOS syscalls" - cp ${./patches/includeos_syscalls.h} $sourceRoot/src/internal/includeos_syscalls.h - cp ${./patches/syscall.h} $sourceRoot/src/internal/syscall.h + cp ${./patches/includeos_syscalls.h} $sourceRoot/src/internal/includeos_syscalls.h + cp ${./patches/syscall.h} $sourceRoot/src/internal/syscall.h - rm $sourceRoot/arch/x86_64/syscall_arch.h - rm $sourceRoot/arch/i386/syscall_arch.h - ''; + rm $sourceRoot/arch/x86_64/syscall_arch.h + rm $sourceRoot/arch/i386/syscall_arch.h + ''; - configurePhase = '' - echo "Configuring with musl's configure script" - echo "Target platform is ${stdenv.targetPlatform.config}" - ./configure --prefix=$out --disable-shared --enable-debug --with-malloc=oldmalloc CROSS_COMPILE=${stdenv.targetPlatform.config}- - ''; + configurePhase = '' + echo "Configuring with musl's configure script" + echo "Target platform is ${stdenv.targetPlatform.config}" + ./configure --prefix=$out --disable-shared --enable-debug --with-malloc=oldmalloc CROSS_COMPILE=${stdenv.targetPlatform.config}- + ''; - CFLAGS = "-Wno-error=int-conversion -nostdinc"; + CFLAGS = "-Wno-error=int-conversion -nostdinc"; - meta = { - description = "musl - Linux based libc, built with IncludeOS linux-like syscalls"; - homepage = "https://www.musl-libc.org/"; - license = pkgs.lib.licenses.mit; + meta = { + description = "musl - Linux based libc, built with IncludeOS linux-like syscalls"; + homepage = "https://www.musl-libc.org/"; + license = pkgs.lib.licenses.mit; + }; }; -} + + dev = pkgs.lib.getDev self; + lib = pkgs.lib.getLib self; +in + self.overrideAttrs (oldAttrs: { + }) diff --git a/deps/s2n/default.nix b/deps/s2n/default.nix index a4ea517b5..4de013e91 100644 --- a/deps/s2n/default.nix +++ b/deps/s2n/default.nix @@ -3,55 +3,62 @@ pkgs, stdenv }: -stdenv.mkDerivation rec { - pname = "s2n-tls"; - # ./conanfile.py lists 0.8, but there are not tags in the repo with version < 0.9.0 - version = "0.9.0"; - - src = pkgs.fetchzip { - url = "https://github.com/aws/s2n-tls/archive/v${version}.tar.gz"; - sha256 = "18qjqc2jrpiwdpzqxl6hl1cq0nfmqk8qas0ijpwr0g606av0aqm9"; - }; +let + self = stdenv.mkDerivation rec { + pname = "s2n-tls"; + # ./conanfile.py lists 0.8, but there are not tags in the repo with version < 0.9.0 + version = "0.9.0"; + + src = pkgs.fetchzip { + url = "https://github.com/aws/s2n-tls/archive/v${version}.tar.gz"; + sha256 = "18qjqc2jrpiwdpzqxl6hl1cq0nfmqk8qas0ijpwr0g606av0aqm9"; + }; - buildInputs = [ - pkgs.pkgsStatic.openssl - ]; + buildInputs = [ + pkgs.pkgsStatic.openssl + ]; - # the default 'all' target depends on tests which are broken (see below) - buildPhase = '' - runHook preBuild + # the default 'all' target depends on tests which are broken (see below) + buildPhase = '' + runHook preBuild - make bin + make bin - runHook postBuild - ''; + runHook postBuild + ''; - # TODO: tests fail: - # make -C unit - # make[2]: Entering directory '/build/source/tests/unit' - # Running s2n_3des_test.c ... FAILED test 1 - # !((conn = s2n_connection_new(S2N_SERVER)) == (((void *)0))) is not true (s2n_3des_test.c line 44) - # Error Message: 'error calling mlock (Did you run prlimit?)' - # Debug String: 'Error encountered in s2n_mem.c line 103' - # make[2]: *** [Makefile:44: s2n_3des_test] Error 1 - doCheck = false; + # TODO: tests fail: + # make -C unit + # make[2]: Entering directory '/build/source/tests/unit' + # Running s2n_3des_test.c ... FAILED test 1 + # !((conn = s2n_connection_new(S2N_SERVER)) == (((void *)0))) is not true (s2n_3des_test.c line 44) + # Error Message: 'error calling mlock (Did you run prlimit?)' + # Debug String: 'Error encountered in s2n_mem.c line 103' + # make[2]: *** [Makefile:44: s2n_3des_test] Error 1 + doCheck = false; - # Upstream Makefile has no install target - installPhase = '' - runHook preInstall + # Upstream Makefile has no install target + installPhase = '' + runHook preInstall - mkdir -p "$out/include" - cp api/s2n.h "$out/include" + mkdir -p "$out/include" + cp api/s2n.h "$out/include" - mkdir -p "$out/lib" - cp lib/libs2n.a lib/libs2n.so "$out/lib" + mkdir -p "$out/lib" + cp lib/libs2n.a lib/libs2n.so "$out/lib" - runHook postInstall - ''; + runHook postInstall + ''; - meta = { - description = "An implementation of the TLS/SSL protocols"; - homepage = "https://github.com/aws/s2n-tls"; - license = pkgs.lib.licenses.asl20; + meta = { + description = "An implementation of the TLS/SSL protocols"; + homepage = "https://github.com/aws/s2n-tls"; + license = pkgs.lib.licenses.asl20; + }; }; -} + + dev = pkgs.lib.getDev self; + lib = pkgs.lib.getLib self; +in + self.overrideAttrs (oldAttrs: { + }) diff --git a/deps/uzlib/default.nix b/deps/uzlib/default.nix index d1c39e88f..23e0207e9 100644 --- a/deps/uzlib/default.nix +++ b/deps/uzlib/default.nix @@ -2,60 +2,66 @@ pkgs, stdenv }: +let + self = stdenv.mkDerivation rec { + pname = "uzlib"; -stdenv.mkDerivation rec { - pname = "uzlib"; + # Latest version, seems incompatible with IncludeOS. + #version = "2.9.5"; + # + #src = fetchzip { + # url = "https://github.com/pfalcon/uzlib/archive/v${version}.tar.gz"; + # sha256 = "01l5y3rwa9935bqlrgww71zr83mbdinq69xzk2gfk96adgjvrl7k"; + #}; - # Latest version, seems incompatible with IncludeOS. - #version = "2.9.5"; - # - #src = fetchzip { - # url = "https://github.com/pfalcon/uzlib/archive/v${version}.tar.gz"; - # sha256 = "01l5y3rwa9935bqlrgww71zr83mbdinq69xzk2gfk96adgjvrl7k"; - #}; + # same version as listed in ./conanfile.py + version = "2.1.1"; - # same version as listed in ./conanfile.py - version = "2.1.1"; + src = pkgs.fetchzip { + url = "https://github.com/pfalcon/uzlib/archive/v${version}.tar.gz"; + sha256 = "1bdbfkxq648blh6v7lvvy1dhrykmib1kzpgjh1fb5zhzq5xib9b2"; + }; - src = pkgs.fetchzip { - url = "https://github.com/pfalcon/uzlib/archive/v${version}.tar.gz"; - sha256 = "1bdbfkxq648blh6v7lvvy1dhrykmib1kzpgjh1fb5zhzq5xib9b2"; - }; + # v2.1.1 has no top-level Makefile + buildPhase = '' + make -C src -f makefile.elf + ''; + + postPatch = '' + echo 'Replacing gcc with $(CC) in makefile.elf' + sed 's/gcc/$(CC)/g' -i ./src/makefile.elf + sed 's/ar /$(AR) /g' -i ./src/makefile.elf + sed 's/ranlib /$(RANLIB) /g' -i ./src/makefile.elf + ''; + + # Upstream doesn't have an install target (not even in the latest version) + installPhase = '' + runHook preInstall + + #ls -lR - # v2.1.1 has no top-level Makefile - buildPhase = '' - make -C src -f makefile.elf - ''; - - postPatch = '' - echo 'Replacing gcc with $(CC) in makefile.elf' - sed 's/gcc/$(CC)/g' -i ./src/makefile.elf - sed 's/ar /$(AR) /g' -i ./src/makefile.elf - sed 's/ranlib /$(RANLIB) /g' -i ./src/makefile.elf - ''; - - # Upstream doesn't have an install target (not even in the latest version) - installPhase = '' - runHook preInstall - - #ls -lR - - mkdir -p "$out/include" - cp src/tinf.h "$out/include" - #cp src/tinf_compat.h "$out/include" # doesn't exist in v2.1.1 - #cp src/uzlib.h "$out/include" # doesn't exist in v2.1.1 - cp src/defl_static.h "$out/include" - #cp src/uzlib_conf.h "$out/include" # doesn't exist in v2.1.1 - - mkdir -p "$out/lib" - cp lib/libtinf.a "$out/lib" - - runHook postInstall - ''; - - meta = { - description = "Radically unbloated DEFLATE/zlib/gzip compression/decompression library"; - homepage = "https://github.com/pfalcon/uzlib"; - license = pkgs.lib.licenses.zlib; + mkdir -p "$out/include" + cp src/tinf.h "$out/include" + #cp src/tinf_compat.h "$out/include" # doesn't exist in v2.1.1 + #cp src/uzlib.h "$out/include" # doesn't exist in v2.1.1 + cp src/defl_static.h "$out/include" + #cp src/uzlib_conf.h "$out/include" # doesn't exist in v2.1.1 + + mkdir -p "$out/lib" + cp lib/libtinf.a "$out/lib" + + runHook postInstall + ''; + + meta = { + description = "Radically unbloated DEFLATE/zlib/gzip compression/decompression library"; + homepage = "https://github.com/pfalcon/uzlib"; + license = pkgs.lib.licenses.zlib; + }; }; -} + + dev = pkgs.lib.getDev self; + lib = pkgs.lib.getLib self; +in + self.overrideAttrs (oldAttrs: { + }) From 985b02b18c0365c23392d3ef383406a59cb0d50d Mon Sep 17 00:00:00 2001 From: Mazunki Hoksaas Date: Wed, 29 Oct 2025 11:23:28 +0100 Subject: [PATCH 2/2] sort deps alphabetically --- overlay.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/overlay.nix b/overlay.nix index 94b2d34ba..86b30a118 100644 --- a/overlay.nix +++ b/overlay.nix @@ -159,12 +159,12 @@ final: prev: { ++ prev.lib.optionals withCcache [self.ccacheWrapper ccacheNoticeHook]; buildInputs = [ - self.libfmt - self.botan2 - self.http-parser prev.pkgsStatic.openssl prev.pkgsStatic.rapidjson - #self.s2n-tls 👈 This is postponed until we can fix the s2n build. + self.botan2 + self.http-parser + self.libfmt + # self.s2n-tls 👈 This is postponed until we can fix the s2n build. self.uzlib self.vmbuild ]; @@ -205,12 +205,12 @@ final: prev: { passthru.pkgs = prev.pkgs; # this is for convenience for other packages that depend on includeos passthru = { - inherit (self) uzlib; - inherit (self) http-parser; inherit (self) botan2; - inherit (self) libfmt; - #inherit (self) s2n-tls; inherit (self) cmake; + inherit (self) http-parser; + inherit (self) libfmt; + # inherit (self) s2n-tls; + inherit (self) uzlib; inherit (self) vmbuild; };