tiiuae / sbomnix

A suite of utilities to help with software supply chain challenges on nix targets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

improve the way sbomnix reads pacakge metadata

henrirosten opened this issue · comments

sbomnix reads the nix package meta info from the json file given via the command-line --meta option.

This needs to be re-done properly, ultimately aiming to get rid of the need for --meta command line argument completely.

How about:

diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index 51c78c55d599..f4ad35af2c1a 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -299,6 +299,7 @@ else let
        "__impureHostDeps" "__propagatedImpureHostDeps"
        "sandboxProfile" "propagatedSandboxProfile"]
        ++ lib.optional (__structuredAttrs || envIsExportable) "env"))
+    // { meta =  builtins.toJSON (attrs.meta or {}); }
     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
       name =
         let

@domenkozar : thanks for providing input to this issue!

What you are proposing requires a change in nixpkgs, right?

Resolved with #100