First commit
This commit is contained in:
38
devenv.nix
Normal file
38
devenv.nix
Normal 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
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user