Created
November 14, 2017 15:46
-
-
Save cleverca22/9d6a1e1c8a849c13e78d499c0dfc5eb8 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
[root@router:~/hydra]# cat src/lib/Hydra/Plugin/NixPush.pm | |
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