Skip to content

Commit

Permalink
Support arbitrary stores in Perl bindings
Browse files Browse the repository at this point in the history
Fix #9859

It's a breaking change but that's fine; we can just update Hydra to use
the new bindings.
  • Loading branch information
Ericson2314 committed Feb 8, 2024
1 parent a31f2cb commit bc08502
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 76 deletions.
2 changes: 2 additions & 0 deletions perl/.yath.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[test]
-I=rel(lib/Nix)
18 changes: 14 additions & 4 deletions perl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
, nix, curl, bzip2, xz, boost, libsodium, darwin
}:

perl.pkgs.toPerlModule (stdenv.mkDerivation {
perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: {
name = "nix-perl-${nix.version}";

src = fileset.toSource {
root = ../.;
fileset = fileset.unions [
fileset = fileset.unions ([
../.version
../m4
../mk
Expand All @@ -20,7 +20,10 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation {
./configure.ac
./lib
./local.mk
];
] ++ lib.optionals finalAttrs.doCheck [
./.yath.rc
./t
]);
};

nativeBuildInputs =
Expand All @@ -40,6 +43,13 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation {
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;

# `perlPackages.Test2Harness` is marked broken for Darwin
doCheck = !stdenv.isDarwin;

nativeCheckInputs = [
perlPackages.Test2Harness
];

configureFlags = [
"--with-dbi=${perlPackages.DBI}/${perl.libPrefix}"
"--with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}"
Expand All @@ -48,4 +58,4 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation {
enableParallelBuilding = true;

postUnpack = "sourceRoot=$sourceRoot/perl";
})
}))
19 changes: 11 additions & 8 deletions perl/lib/Nix/Store.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

our @EXPORT = qw(
setVerbosity
isValidPath queryReferences queryPathInfo queryDeriver queryPathHash
queryPathFromHashPart
topoSortPaths computeFSClosure followLinksToStorePath exportPaths importPaths
StoreWrapper
StoreWrapper::new
StoreWrapper::isValidPath StoreWrapper::queryReferences StoreWrapper::queryPathInfo StoreWrapper::queryDeriver StoreWrapper::queryPathHash
StoreWrapper::queryPathFromHashPart
StoreWrapper::topoSortPaths StoreWrapper::computeFSClosure followLinksToStorePath StoreWrapper::exportPaths StoreWrapper::importPaths
StoreWrapper::addToStore StoreWrapper::makeFixedOutputPath
StoreWrapper::derivationFromPath
StoreWrapper::addTempRoot
StoreWrapper::queryRawRealisation
hashPath hashFile hashString convertHash
signString checkSignature
addToStore makeFixedOutputPath
derivationFromPath
addTempRoot
getBinDir getStoreDir
queryRawRealisation
setVerbosity
);

our $VERSION = '0.15';
Expand Down
Loading

1 comment on commit bc08502

@nixos-discourse
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-09-16-nix-team-meeting-minutes-178-177/52270/4

Please sign in to comment.