ytdlp and improvment to mounting engi

This commit is contained in:
Tyler Starr 2024-10-14 16:40:55 -07:00
parent 2477a97767
commit 0b60793ae7
3 changed files with 46 additions and 2 deletions

View File

@ -1,3 +1,17 @@
#!/usr/bin/env bash
sudo mount -t cifs -o rw,uid=$(id -u $(whoami)),gid=$(id -g $(whoami)),vers=3.0,credentials=/home/tstarr/.smb //192.168.1.175/private /home/tstarr/mnt/engi
engi_path="$HOME/mnt/engi"
if mountpoint -q "$engi_path"; then
echo "engi already mounted"
exit 0
else
sudo mount -t cifs -o rw,uid=$(id -u $(whoami)),gid=$(id -g $(whoami)),vers=3.0,credentials=/home/tstarr/.smb //torus/private ~/mnt/engi 2>/dev/null
fi
# Check drive mounted correctly
if mountpoint -q "$engi_path"; then
echo "engi successfully mounted"
else
echo "engi failed to mount"
fi

View File

@ -1,4 +1,9 @@
{ ... }:
{
imports = [ ./git.nix ./chezmoi.nix ./kitty.nix ];
imports = [
./git.nix
./chezmoi.nix
./kitty.nix
./yt-dlp.nix
];
}

View File

@ -0,0 +1,25 @@
{ config, lib, pkgs, user, ... }:
let cfg = config.modules.programs.yt-dlp;
in {
options.modules.programs.yt-dlp = with lib; {
enable = lib.mkOption {
type = with types; bool;
default = true;
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
yt-dlp
(pkgs.writeScriptBin "ytd_audio" ''
#!/usr/bin/env bash
linux-mount-engi
yt-dlp -f "bestaudio/best" \
--embed-metadata --embed-thumbnail \
-ciw -o "%(title)s.%(ext)s" \
-v --extract-audio "$1"
'')
];
};
}