Created
October 26, 2015 23:50
-
-
Save cleverca22/1ef1abdfdea1a2ac8d38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/lib/Hydra/Plugin/NixPush.pm b/src/lib/Hydra/Plugin/NixPush.pm | |
new file mode 100644 | |
index 0000000..2b4e29f | |
--- /dev/null | |
+++ b/src/lib/Hydra/Plugin/NixPush.pm | |
@@ -0,0 +1,22 @@ | |
+package Hydra::Plugin::NixPush; | |
+ | |
+use strict; | |
+use parent 'Hydra::Plugin'; | |
+use Nix::Config; | |
+ | |
+sub buildFinished { | |
+ my ($self, $build, $dependents) = @_; | |
+ | |
+ return unless $build->buildstatus == 0 or $build->buildstatus == 6; | |
+ my @needed_paths = (); | |
+ foreach my $output ($build->buildoutputs) { | |
+ push @needed_paths, $output->path; | |
+ } | |
+ | |
+ while (@needed_paths) { | |
+ my $path = shift @needed_paths; | |
+ system("$Nix::Config::binDir/nix-push --dest /media/videos/4tb/nix-cache/ --key-file /etc/nix/signing-key.sec $path") == 0 or die; | |
+ } | |
+} | |
+ | |
+1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment