diff --git a/apps/timelapse/.projectile b/apps/timelapse/.projectile new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/timelapse/default.nix b/apps/timelapse/default.nix new file mode 100644 index 00000000000..8adc4ef0620 --- /dev/null +++ b/apps/timelapse/default.nix @@ -0,0 +1,18 @@ +with import {}; + +stdenv.mkDerivation { + name = "timelapse"; + src = ./.; + + buildInputs = with pkgs; [ ruby gphoto2 ]; + + installPhase = '' + mkdir -p $out/bin + cp timelapse.rb $out/bin/timelapse + ''; + + meta = with lib; { + description = "A small tool to capture timelapse series with gphoto"; + }; +} + diff --git a/apps/timelapse/timelapse.rb b/apps/timelapse/timelapse.rb new file mode 100755 index 00000000000..aa6b6b3106a --- /dev/null +++ b/apps/timelapse/timelapse.rb @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby + +# A function to capture a picture with gphoto2, retrying 3-times in +# case of errors. +def capture_picture + 3.times do + break if `gphoto2 --capture-image` == 0 + puts "Retrying gphoto2 capture..." + end +end + + +capture_picture