diff options
author | Emery Hemingway <ehmry@posteo.net> | 2024-08-27T21·33+0300 |
---|---|---|
committer | Emery Hemingway <ehmry@posteo.net> | 2024-08-27T21·52+0300 |
commit | 280f52da984755ce6bd1b883d8afa4445c3334cc (patch) | |
tree | 6febb3d6b154cc653685e0f84f457bdbbd33d445 | |
parent | 4fb2792830dabc786b00524c9e0106017c663758 (diff) |
Make build-nim-sbom.nix compatible with nixos-24.05
-rw-r--r-- | build-nim-sbom.nix | 29 | ||||
-rw-r--r-- | sbom.json | 2 |
2 files changed, 15 insertions, 16 deletions
diff --git a/build-nim-sbom.nix b/build-nim-sbom.nix index f1db25be7072..8edf4f98d60f 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 { }; @@ -177,20 +170,26 @@ let prevAttrs: { name, ... }@component: if (builtins.hasAttr name nimOverrides) then - prevAttrs // (nimOverrides.${name} component prevAttrs) + let + result = nimOverrides.${name} component prevAttrs; + in + prevAttrs // (if builtins.isAttrs result then result else result { }) else 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 eecbfd5ac73e..567babc1e87d 100644 --- a/sbom.json +++ b/sbom.json @@ -7,7 +7,7 @@ "bom-ref": "pkg:nim/nix_actor", "name": "nix_actor", "description": "Syndicated Nix Actor", - "version": "20240827", + "version": "20240828", "authors": [ { "name": "Emery Hemingway" |