First commit

This commit is contained in:
2025-12-07 14:35:40 +02:00
commit 35c54263a9
15 changed files with 1026 additions and 0 deletions

38
devenv.nix Normal file
View File

@@ -0,0 +1,38 @@
{ pkgs, lib, config, inputs, ... }: {
env.GREET = "SpotDL devenv";
packages = [pkgs.spotdl pkgs.python313Packages.spotipy pkgs.python313Packages.flask pkgs.openssl pkgs.ngrok ];
scripts.hello.exec = ''echo hello from $GREET ! '';
scripts.craftcerts.exec = ''
mkdir -p ssl # Use -p to avoid error if the directory exists
cd ssl
if [ ! -f ./openssl.cnf ]; then
echo "Creating openssl..."
openssl req -x509 -newkey rsa:2048 -keyout server.key -out server.cert -days 365 -nodes -config ../openssl.cnf 1&2 > /dev/null
exit 1
fi
'';
scripts.download.exec = ''
ngrok http 8888 > /dev/null &
python ./geturl.py > geturl_logfile
url=$(cat -p geturl_logfile) # Capture the output of geturl.py
echo "STATEMENT AFTER GETURL"
while true; do
if [ $? -eq 0 ]; then
echo "SPOTDL ATTEMPT:"
spotdl "$url"
break
fi
echo "Error downloading, retrying..."
sleep 2
done
'';
enterShell = ''
hello
craftcerts
download
'';
}