From b6e36b7e1ccfb524b8eae7694b7ff895f9ffca25 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Mon, 24 Jun 2024 16:49:18 +0300 Subject: [PATCH] Cross-compilation fixes --- build-nim-sbom.nix | 24 ++++++++++-------------- sbom.json | 16 ++++++++-------- src/http_client.nim | 2 +- src/sqlite_actor.nim | 4 ++-- src/xslt_actor.nim | 4 ++-- 5 files changed, 23 insertions(+), 27 deletions(-) diff --git a/build-nim-sbom.nix b/build-nim-sbom.nix index f1db25b..3b1d17f 100644 --- a/build-nim-sbom.nix +++ b/build-nim-sbom.nix @@ -96,21 +96,14 @@ let install -Dt $out/bin ${output} '' ); -in -callerArg: sbomArg: - -let applySbom = + sbom: { passthru ? { }, ... }@prevAttrs: let - sbom = lib.attrsets.recursiveUpdate ( - if builtins.isAttrs sbomArg then sbomArg else builtins.fromJSON (builtins.readFile sbomArg) - ) passthru.sbom or { }; - properties = # SBOM metadata.component.properties as an attrset. lib.attrsets.recursiveUpdate (builtins.listToAttrs sbom.metadata.component.properties) passthru.properties or { }; @@ -182,15 +175,18 @@ let prevAttrs ) prevAttrs prevAttrs.passthru.sbom.components; - composition = - finalAttrs: + compose = + callerArg: sbom: finalAttrs: let callerAttrs = if builtins.isAttrs callerArg then callerArg else callerArg finalAttrs; - sbomAttrs = callerAttrs // (applySbom callerAttrs); + sbomAttrs = callerAttrs // (applySbom sbom callerAttrs); overrideAttrs = sbomAttrs // (applyOverrides sbomAttrs); in overrideAttrs; in -stdenv.mkDerivation composition - -# TODO: Add an overrideSbom function into the result.. +callerArg: sbomArg: +let + sbom = if builtins.isAttrs sbomArg then sbomArg else builtins.fromJSON (builtins.readFile sbomArg); + overrideSbom = f: stdenv.mkDerivation (compose callerArg (sbom // (f sbom))); +in +(stdenv.mkDerivation (compose callerArg sbom)) // { inherit overrideSbom; } diff --git a/sbom.json b/sbom.json index e32b02e..b136425 100644 --- a/sbom.json +++ b/sbom.json @@ -7,7 +7,7 @@ "bom-ref": "pkg:nim/syndicate_utils", "name": "syndicate_utils", "description": "Utilites for Syndicated Actors and Synit", - "version": "20240622", + "version": "20240624", "authors": [ { "name": "Emery Hemingway" @@ -491,10 +491,10 @@ "type": "library", "bom-ref": "pkg:nim/getdns", "name": "getdns", - "version": "20230806", + "version": "trunk", "externalReferences": [ { - "url": "https://git.sr.ht/~ehmry/getdns-nim/archive/e4ae0992ed7c5540e6d498f3074d06c8f454a0b6.tar.gz", + "url": "https://git.sr.ht/~ehmry/getdns-nim/archive/e925d2f6d2bf31384969568e97917af8ef77b7a2.tar.gz", "type": "source-distribution" }, { @@ -509,23 +509,23 @@ }, { "name": "nix:fod:path", - "value": "/nix/store/j8i20k9aarzppg4p234449140nnnaycq-source" + "value": "/nix/store/hq145zgfjldsj7fh026ikfwkhs2cz9nv-source" }, { "name": "nix:fod:rev", - "value": "e4ae0992ed7c5540e6d498f3074d06c8f454a0b6" + "value": "e925d2f6d2bf31384969568e97917af8ef77b7a2" }, { "name": "nix:fod:sha256", - "value": "1dp53gndr6d9s9601dd5ipkiq94j53hlx46mxv8gpr8nd98bqysg" + "value": "0gflawpkwk8nghwvs69yb5mj3s6fzrmybys5466m2650xr26hs4p" }, { "name": "nix:fod:url", - "value": "https://git.sr.ht/~ehmry/getdns-nim/archive/e4ae0992ed7c5540e6d498f3074d06c8f454a0b6.tar.gz" + "value": "https://git.sr.ht/~ehmry/getdns-nim/archive/e925d2f6d2bf31384969568e97917af8ef77b7a2.tar.gz" }, { "name": "nix:fod:ref", - "value": "20230806" + "value": "trunk" }, { "name": "nix:fod:srcDir", diff --git a/src/http_client.nim b/src/http_client.nim index ca207db..5ac70e1 100644 --- a/src/http_client.nim +++ b/src/http_client.nim @@ -76,7 +76,7 @@ proc spawnHttpClient*(turn: Turn; relay: Cap): Actor {.discardable.} = ) var resp = HttpResponse(orKind: HttpResponseKind.status) resp.status.code = stdRes.status[0 .. 2].parseInt - resp.status.message = stdRes.status[3 .. ^1] + resp.status.message = stdRes.status[4 .. ^1] message(turn, peer, resp) resp = HttpResponse(orKind: HttpResponseKind.header) for key, vals in stdRes.headers.table: diff --git a/src/sqlite_actor.nim b/src/sqlite_actor.nim index e5644b3..297b933 100644 --- a/src/sqlite_actor.nim +++ b/src/sqlite_actor.nim @@ -9,8 +9,8 @@ import # Avoid Sqlite3 from the standard library because it is # only held together by wishful thinking and dlload. -{.passC: staticExec("pkg-config --cflags sqlite3").} -{.passL: staticExec("pkg-config --libs sqlite3").} +{.passC: staticExec"$PKG_CONFIG --cflags sqlite3".} +{.passL: staticExec"$PKG_CONFIG --libs sqlite3".} {.pragma: sqlite3h, header: "sqlite3.h".} diff --git a/src/xslt_actor.nim b/src/xslt_actor.nim index 6e0b0f2..8cfc329 100644 --- a/src/xslt_actor.nim +++ b/src/xslt_actor.nim @@ -5,8 +5,8 @@ import std/[os, strutils] import preserves, preserves/sugar, syndicate import ./schema/[assertions, config] -{.passC: staticExec("pkg-config --cflags libxslt").} -{.passL: staticExec("pkg-config --libs libxslt").} +{.passC: staticExec"$PKG_CONFIG --cflags libxslt".} +{.passL: staticExec"$PKG_CONFIG --libs libxslt".} {.pragma: libxslt, header: "libxslt/xslt.h", importc.}