From 7e61a4b4f1184657289555d8112226c77ffcf1b7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 18 Apr 2018 14:36:35 +0200 Subject: Nicer utils --- bragi.nix | 3 ++- hel.nix | 3 ++- odin.nix | 3 ++- odin/strm.nix | 6 +++++- odin/strm/cleanup_youtube | 14 +------------- utils | 2 +- ymir.nix | 2 ++ 7 files changed, 15 insertions(+), 18 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 { ./users.nix ./custom/unit-status-mail.nix ./custom/trivmix-service.nix + ./utils/nix/module.nix ]; boot.loader.grub.enable = true; @@ -118,7 +119,7 @@ in rec { zsh tprint samba - (callPackage ./utils/nix/rebuild-system.nix {}) + rebuild-system ]; # 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 @@ ./custom/tinc/yggdrasil.nix ./custom/uucp.nix ./custom/borgbackup.nix + ./utils/nix/module.nix ]; system.stateVersion = "16.09"; @@ -71,11 +72,11 @@ git slock shadow - (callPackage ./utils/nix/rebuild-system.nix {}) rewacom autorandr ntfs3g exfat + rebuild-system ]; 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 @@ ./custom/borgbackup.nix ./custom/motion.nix ./custom/unit-status-mail.nix + ./utils/nix/module.nix ]; # Use the GRUB 2 boot loader. @@ -39,9 +40,9 @@ mosh quota git - (callPackage ./utils/nix/rebuild-system.nix {}) samba ntfs3g + rebuild-system ]; 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 @@ -{ stdenv, zsh, ffmpeg-full, youtube-dl, pv, notmuch, rss2email, buildPerlPackage, perlPackages }: +{ stdenv +, zsh, ffmpeg-full, youtube-dl, pv, notmuch, rss2email, rolling-directory +, buildPerlPackage, perlPackages +}: let manual-youtube = buildPerlPackage { @@ -46,6 +49,7 @@ in stdenv.mkDerivation { inherit zsh pv notmuch rss2email; ffmpeg = ffmpeg-full; youtubedl = youtube-dl; + rollingdirectory = rolling-directory; buildPhase = '' 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 { urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } -dir=/srv/media/youtube -maxsize=$((1024 * 1024 * 1024 * 50)) - -while [[ $(du -bs $dir | awk '{ print $1; }') -gt $maxsize ]]; do - find $dir -type f -not -path $dir/CACHEDIR.TAG -print0 | \ - xargs -0 -- stat --printf '%W %Y %Z %X %n\0' | \ - sort -t '\0' -z | \ - awk -F '\0' '{ gsub("^\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+", "", $1); printf "%s\0", $1; }' | \ - xargs -0 -- rm -v -done - -find $dir -xtype l -delete -find $dir -type d -empty -delete +@rollingdirectory@/bin/rolling-directory /srv/media/youtube 50Gi notmuch search --output=messages --format=text 'is:cached' | \ while read id; do diff --git a/utils b/utils index f2f6e52a..1959a351 160000 --- a/utils +++ b/utils @@ -1 +1 @@ -Subproject commit f2f6e52a21cf2f90c0549df106d08cb2f79767c4 +Subproject commit 1959a35163a0d48a3c147396265c056922a731c1 diff --git a/ymir.nix b/ymir.nix index 77246698..3f89ff4f 100644 --- a/ymir.nix +++ b/ymir.nix @@ -43,6 +43,7 @@ in rec { ./custom/ymir-nginx.nix ./custom/uucp.nix ./custom/unit-status-mail.nix + ./utils/nix/module.nix ]; boot.loader.grub = { @@ -154,6 +155,7 @@ in rec { tmux zsh mlmmj + rebuild-system ]; networking = { -- cgit v1.2.3