summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-04-18 14:36:35 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-04-18 14:36:35 +0200
commit7e61a4b4f1184657289555d8112226c77ffcf1b7 (patch)
treedd4f0c53b343cf4428cb35e474b37cd696d96f4b
parent12ee11496fbb107abda7c40e7bb4b1cbcb8c942c (diff)
downloadnixos-7e61a4b4f1184657289555d8112226c77ffcf1b7.tar
nixos-7e61a4b4f1184657289555d8112226c77ffcf1b7.tar.gz
nixos-7e61a4b4f1184657289555d8112226c77ffcf1b7.tar.bz2
nixos-7e61a4b4f1184657289555d8112226c77ffcf1b7.tar.xz
nixos-7e61a4b4f1184657289555d8112226c77ffcf1b7.zip
Nicer utils
-rw-r--r--bragi.nix3
-rw-r--r--hel.nix3
-rw-r--r--odin.nix3
-rw-r--r--odin/strm.nix6
-rw-r--r--odin/strm/cleanup_youtube14
m---------utils0
-rw-r--r--ymir.nix2
7 files changed, 14 insertions, 17 deletions
diff --git a/bragi.nix b/bragi.nix
index d48afc9e..f2c9d5aa 100644
--- a/bragi.nix
+++ b/bragi.nix
@@ -10,6 +10,7 @@ in rec {
10 ./users.nix 10 ./users.nix
11 ./custom/unit-status-mail.nix 11 ./custom/unit-status-mail.nix
12 ./custom/trivmix-service.nix 12 ./custom/trivmix-service.nix
13 ./utils/nix/module.nix
13 ]; 14 ];
14 15
15 boot.loader.grub.enable = true; 16 boot.loader.grub.enable = true;
@@ -118,7 +119,7 @@ in rec {
118 zsh 119 zsh
119 tprint 120 tprint
120 samba 121 samba
121 (callPackage ./utils/nix/rebuild-system.nix {}) 122 rebuild-system
122 ]; 123 ];
123 124
124 # List services that you want to enable: 125 # List services that you want to enable:
diff --git a/hel.nix b/hel.nix
index 684f505d..475e0046 100644
--- a/hel.nix
+++ b/hel.nix
@@ -15,6 +15,7 @@
15 ./custom/tinc/yggdrasil.nix 15 ./custom/tinc/yggdrasil.nix
16 ./custom/uucp.nix 16 ./custom/uucp.nix
17 ./custom/borgbackup.nix 17 ./custom/borgbackup.nix
18 ./utils/nix/module.nix
18 ]; 19 ];
19 20
20 system.stateVersion = "16.09"; 21 system.stateVersion = "16.09";
@@ -71,11 +72,11 @@
71 git 72 git
72 slock 73 slock
73 shadow 74 shadow
74 (callPackage ./utils/nix/rebuild-system.nix {})
75 rewacom 75 rewacom
76 autorandr 76 autorandr
77 ntfs3g 77 ntfs3g
78 exfat 78 exfat
79 rebuild-system
79 ]; 80 ];
80 81
81 nixpkgs.config.packageOverrides = pkgs: rec { 82 nixpkgs.config.packageOverrides = pkgs: rec {
diff --git a/odin.nix b/odin.nix
index de672310..c3c37b58 100644
--- a/odin.nix
+++ b/odin.nix
@@ -14,6 +14,7 @@
14 ./custom/borgbackup.nix 14 ./custom/borgbackup.nix
15 ./custom/motion.nix 15 ./custom/motion.nix
16 ./custom/unit-status-mail.nix 16 ./custom/unit-status-mail.nix
17 ./utils/nix/module.nix
17 ]; 18 ];
18 19
19 # Use the GRUB 2 boot loader. 20 # Use the GRUB 2 boot loader.
@@ -39,9 +40,9 @@
39 mosh 40 mosh
40 quota 41 quota
41 git 42 git
42 (callPackage ./utils/nix/rebuild-system.nix {})
43 samba 43 samba
44 ntfs3g 44 ntfs3g
45 rebuild-system
45 ]; 46 ];
46 47
47 programs.zsh.enable = true; 48 programs.zsh.enable = true;
diff --git a/odin/strm.nix b/odin/strm.nix
index 094da07c..487fd170 100644
--- a/odin/strm.nix
+++ b/odin/strm.nix
@@ -1,4 +1,7 @@
1{ stdenv, zsh, ffmpeg-full, youtube-dl, pv, notmuch, rss2email, buildPerlPackage, perlPackages }: 1{ stdenv
2, zsh, ffmpeg-full, youtube-dl, pv, notmuch, rss2email, rolling-directory
3, buildPerlPackage, perlPackages
4}:
2 5
3let 6let
4 manual-youtube = buildPerlPackage { 7 manual-youtube = buildPerlPackage {
@@ -46,6 +49,7 @@ in stdenv.mkDerivation {
46 inherit zsh pv notmuch rss2email; 49 inherit zsh pv notmuch rss2email;
47 ffmpeg = ffmpeg-full; 50 ffmpeg = ffmpeg-full;
48 youtubedl = youtube-dl; 51 youtubedl = youtube-dl;
52 rollingdirectory = rolling-directory;
49 53
50 buildPhase = '' 54 buildPhase = ''
51 substituteAllInPlace download_youtube 55 substituteAllInPlace download_youtube
diff --git a/odin/strm/cleanup_youtube b/odin/strm/cleanup_youtube
index 2d91fe1f..76c3f0bb 100644
--- a/odin/strm/cleanup_youtube
+++ b/odin/strm/cleanup_youtube
@@ -19,19 +19,7 @@ function cleanup {
19 19
20urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } 20urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
21 21
22dir=/srv/media/youtube 22@rollingdirectory@/bin/rolling-directory /srv/media/youtube 50Gi
23maxsize=$((1024 * 1024 * 1024 * 50))
24
25while [[ $(du -bs $dir | awk '{ print $1; }') -gt $maxsize ]]; do
26 find $dir -type f -not -path $dir/CACHEDIR.TAG -print0 | \
27 xargs -0 -- stat --printf '%W %Y %Z %X %n\0' | \
28 sort -t '\0' -z | \
29 awk -F '\0' '{ gsub("^\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+", "", $1); printf "%s\0", $1; }' | \
30 xargs -0 -- rm -v
31done
32
33find $dir -xtype l -delete
34find $dir -type d -empty -delete
35 23
36notmuch search --output=messages --format=text 'is:cached' | \ 24notmuch search --output=messages --format=text 'is:cached' | \
37 while read id; do 25 while read id; do
diff --git a/utils b/utils
Subproject f2f6e52a21cf2f90c0549df106d08cb2f79767c Subproject 1959a35163a0d48a3c147396265c056922a731c
diff --git a/ymir.nix b/ymir.nix
index 77246698..3f89ff4f 100644
--- a/ymir.nix
+++ b/ymir.nix
@@ -43,6 +43,7 @@ in rec {
43 ./custom/ymir-nginx.nix 43 ./custom/ymir-nginx.nix
44 ./custom/uucp.nix 44 ./custom/uucp.nix
45 ./custom/unit-status-mail.nix 45 ./custom/unit-status-mail.nix
46 ./utils/nix/module.nix
46 ]; 47 ];
47 48
48 boot.loader.grub = { 49 boot.loader.grub = {
@@ -154,6 +155,7 @@ in rec {
154 tmux 155 tmux
155 zsh 156 zsh
156 mlmmj 157 mlmmj
158 rebuild-system
157 ]; 159 ];
158 160
159 networking = { 161 networking = {