diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2024-10-06 00:31:40 +0200 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2024-10-06 00:31:40 +0200 |
commit | 6534d89caf4ab249e0331c0082124e2dbb56600e (patch) | |
tree | 33d6bc70e105623ee9ebbda3cffca6a785ea2499 /modules | |
parent | 39ebafe4abb271884e180fbd1b35c0705bae9b88 (diff) | |
download | dots-6534d89caf4ab249e0331c0082124e2dbb56600e.tar.gz dots-6534d89caf4ab249e0331c0082124e2dbb56600e.zip |
t14: 70 current 2024-10-06 00:31:35 24.05.20241004.6e6b3dd 6.6.54 *
Diffstat (limited to 'modules')
-rw-r--r-- | modules/media-drive.nix | 13 | ||||
-rwxr-xr-x | modules/mediasync | 24 |
2 files changed, 37 insertions, 0 deletions
diff --git a/modules/media-drive.nix b/modules/media-drive.nix new file mode 100644 index 0000000..9a1e62d --- /dev/null +++ b/modules/media-drive.nix @@ -0,0 +1,13 @@ +# Configuration for my "Media" usb hard drive +{ pkgs, ... }: +let + mediasync = pkgs.writeShellScriptBin "mediasync" (builtins.readFile ./mediasync); +in +{ + fileSystems."/media" = { + device = "/dev/disk/by-id/wwn-0x50014ee25fca2cb8-part1"; + options = [ "nosuid" "nodev" "nofail" "noauto" "x-gvfs-show" "x-gvfs-name=Media" ]; + }; + + environment.systemPackages = [ mediasync ]; +} diff --git a/modules/mediasync b/modules/mediasync new file mode 100755 index 0000000..074a8b8 --- /dev/null +++ b/modules/mediasync @@ -0,0 +1,24 @@ +#!/bin/sh + +## Sync media files with my external drive at `/media` +## Only cp from home: vids, music, pics, books +## If you delete file from home it won't be deleted from `/media` + +tosync=`ls -d $HOME/{vids,music,pics}` #,books}` +dest="/media" + +#if [ -L "/dev/disk/by-label/media" ]; then +# sudo mount /dev/disk/by-label/media $dest +#else +# echo "Could not mount media drive" +# exit 1 +#fi + +if [ -z "$(ls -A /media)" ]; then + echo "Is disk on?" + exit 1 +fi + +for folder in $tosync; do + rsync -aP $folder $dest +done |