From 14491e42011baa2bea5e8bcd954b0a86648d99da Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 17 Jun 2015 14:50:27 +0200 Subject: file rename --- custom/run-opossum_bragi.nix | 65 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 custom/run-opossum_bragi.nix (limited to 'custom/run-opossum_bragi.nix') diff --git a/custom/run-opossum_bragi.nix b/custom/run-opossum_bragi.nix new file mode 100644 index 00000000..bc8e4bb0 --- /dev/null +++ b/custom/run-opossum_bragi.nix @@ -0,0 +1,65 @@ +{ stdenv +, zsh +, findutils +, coreutils +, makeWrapper +, wombat +, opossum +}: + +stdenv.mkDerivation { + name = "run-opossum-${version}"; + version = "0.0.0"; + buildInputs = [ makeWrapper ]; + src = builtins.toFile name '' + #!${zsh}/bin/zsh + + oversized() { + l=$(du -BG -s -t 75 $BEUTEL | wc -l) + [[ $l -ge 1 ]] + } + + echo "Started $(date)" > $LOGFILE + opossum &>> $LOGFILE + + wombat search "(not (seen or hidden)) and (not forced)" | \ + xargs -r -n 1 -d '\n' -- wombat force \ + &>> $LOGFILE + + find $BEUTEL -type f -iname '*.tgz.bak' -delete + + if oversized; then + wombat search "(seen or hidden) and forced" | \ + while (read file && oversized); do + wombat reset $file + find $BEUTEL -type f -iname '*.tgz.bak' -delete + done + + wombat search "seen or hidden" | \ + while (read file && oversized); do + wombat delete $file + size=$(du -BG $BEUTEL) + done + fi + + echo "Ended $(date)" >> $LOGFILE + ''; + phases = [ "buildPhase" + "installPhase" + ]; + buildPhase = '' + cp -prd --no-preserve=timestamps $src run-opossum + ''; + installPhase = '' + mkdir -p $out/bin + cp run-opossum.sh $out/bin + chmod +x $out/bin/run-opossum + wrapProgram $out/bin/run-opossum \ + --prefix PATH : ${wombat}/bin \ + --prefix PATH : ${opossum}/bin \ + --prefix PATH : ${findutils}/bin \ + --prefix PATH : ${coreutils}/bin \ + --set BEUTEL $HOME/.beutel \ + --set LOGFILE $HOME/.last_opossum.log + ''; +} -- cgit v1.2.3