Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Created November 14, 2017 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cleverca22/9d6a1e1c8a849c13e78d499c0dfc5eb8 to your computer and use it in GitHub Desktop.
Save cleverca22/9d6a1e1c8a849c13e78d499c0dfc5eb8 to your computer and use it in GitHub Desktop.
[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