summaryrefslogtreecommitdiff
path: root/custom/run-opossum_bragi.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-06-17 14:50:27 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2015-06-17 14:50:27 +0200
commit14491e42011baa2bea5e8bcd954b0a86648d99da (patch)
tree26b630ce6d599b97dd197d595a90f33193fa185f /custom/run-opossum_bragi.nix
parentf4892b12439b245b6a4ef330b12a8282377e9425 (diff)
downloadnixos-14491e42011baa2bea5e8bcd954b0a86648d99da.tar
nixos-14491e42011baa2bea5e8bcd954b0a86648d99da.tar.gz
nixos-14491e42011baa2bea5e8bcd954b0a86648d99da.tar.bz2
nixos-14491e42011baa2bea5e8bcd954b0a86648d99da.tar.xz
nixos-14491e42011baa2bea5e8bcd954b0a86648d99da.zip
file rename
Diffstat (limited to 'custom/run-opossum_bragi.nix')
-rw-r--r--custom/run-opossum_bragi.nix65
1 files changed, 65 insertions, 0 deletions
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 @@
1{ stdenv
2, zsh
3, findutils
4, coreutils
5, makeWrapper
6, wombat
7, opossum
8}:
9
10stdenv.mkDerivation {
11 name = "run-opossum-${version}";
12 version = "0.0.0";
13 buildInputs = [ makeWrapper ];
14 src = builtins.toFile name ''
15 #!${zsh}/bin/zsh
16
17 oversized() {
18 l=$(du -BG -s -t 75 $BEUTEL | wc -l)
19 [[ $l -ge 1 ]]
20 }
21
22 echo "Started $(date)" > $LOGFILE
23 opossum &>> $LOGFILE
24
25 wombat search "(not (seen or hidden)) and (not forced)" | \
26 xargs -r -n 1 -d '\n' -- wombat force \
27 &>> $LOGFILE
28
29 find $BEUTEL -type f -iname '*.tgz.bak' -delete
30
31 if oversized; then
32 wombat search "(seen or hidden) and forced" | \
33 while (read file && oversized); do
34 wombat reset $file
35 find $BEUTEL -type f -iname '*.tgz.bak' -delete
36 done
37
38 wombat search "seen or hidden" | \
39 while (read file && oversized); do
40 wombat delete $file
41 size=$(du -BG $BEUTEL)
42 done
43 fi
44
45 echo "Ended $(date)" >> $LOGFILE
46 '';
47 phases = [ "buildPhase"
48 "installPhase"
49 ];
50 buildPhase = ''
51 cp -prd --no-preserve=timestamps $src run-opossum
52 '';
53 installPhase = ''
54 mkdir -p $out/bin
55 cp run-opossum.sh $out/bin
56 chmod +x $out/bin/run-opossum
57 wrapProgram $out/bin/run-opossum \
58 --prefix PATH : ${wombat}/bin \
59 --prefix PATH : ${opossum}/bin \
60 --prefix PATH : ${findutils}/bin \
61 --prefix PATH : ${coreutils}/bin \
62 --set BEUTEL $HOME/.beutel \
63 --set LOGFILE $HOME/.last_opossum.log
64 '';
65}