aboutsummaryrefslogtreecommitdiff
path: root/perl/lib/Nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-09-30 22:36:50 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-09-30 22:41:53 +0000
commitf4f3203aa7c2fc9225a8ae220db25593066fb397 (patch)
tree9063673af148e34069dd894a2fd6a2981b13ff26 /perl/lib/Nix
parent1b6cf0d5f56e166a1cbbf38142375b7a92fc88f2 (diff)
parent6a8d6246f603a372d557ab026670ae42bad558b0 (diff)
Merge remote-tracking branch 'upstream/master' into path-info
Diffstat (limited to 'perl/lib/Nix')
-rw-r--r--perl/lib/Nix/Store.pm1
-rw-r--r--perl/lib/Nix/Store.xs13
2 files changed, 14 insertions, 0 deletions
diff --git a/perl/lib/Nix/Store.pm b/perl/lib/Nix/Store.pm
index 179f1dc90..3e4bbee0a 100644
--- a/perl/lib/Nix/Store.pm
+++ b/perl/lib/Nix/Store.pm
@@ -22,6 +22,7 @@ our @EXPORT = qw(
derivationFromPath
addTempRoot
getBinDir getStoreDir
+ queryRawRealisation
);
our $VERSION = '0.15';
diff --git a/perl/lib/Nix/Store.xs b/perl/lib/Nix/Store.xs
index 4a9df2ae2..28f62dc57 100644
--- a/perl/lib/Nix/Store.xs
+++ b/perl/lib/Nix/Store.xs
@@ -15,6 +15,7 @@
#include "crypto.hh"
#include <sodium.h>
+#include <nlohmann/json.hpp>
using namespace nix;
@@ -120,6 +121,18 @@ SV * queryPathInfo(char * path, int base32)
croak("%s", e.what());
}
+SV * queryRawRealisation(char * outputId)
+ PPCODE:
+ try {
+ auto realisation = store()->queryRealisation(DrvOutput::parse(outputId));
+ if (realisation)
+ XPUSHs(sv_2mortal(newSVpv(realisation->toJSON().dump().c_str(), 0)));
+ else
+ XPUSHs(sv_2mortal(newSVpv("", 0)));
+ } catch (Error & e) {
+ croak("%s", e.what());
+ }
+
SV * queryPathFromHashPart(char * hashPart)
PPCODE: