cleanup
This commit is contained in:
parent
ee790d39c2
commit
e76d0d571f
@ -10,7 +10,7 @@ with config.deviceSpecific; {
|
||||
fd
|
||||
ffmpeg.bin
|
||||
git-filter-repo
|
||||
# glib.bin # gio
|
||||
glib
|
||||
# gptfdisk
|
||||
libqalculate
|
||||
lm_sensors
|
||||
@ -24,11 +24,10 @@ with config.deviceSpecific; {
|
||||
samba
|
||||
sd
|
||||
tealdeer
|
||||
tidal-dl
|
||||
# tidal-dl
|
||||
unzip
|
||||
usbutils
|
||||
wget
|
||||
xclip
|
||||
youtube-dl
|
||||
zip
|
||||
|
||||
|
@ -1,128 +0,0 @@
|
||||
{ stdenv, lib, runtimeShell
|
||||
, name ? "android-emulator", sdk ? null, deviceType ? ""
|
||||
, platformVersion ? "30", systemImageType ? "default", abiVersion ? "x86_64"
|
||||
, enableGPU ? false, extraAVDFiles ? []
|
||||
, app ? null, package ? null, activity ? null
|
||||
, avdHomeDir ? null
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
inherit name;
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
cat > $out/bin/${name}-run << "EOF"
|
||||
#!${runtimeShell} -e
|
||||
|
||||
# We need a TMPDIR
|
||||
if [ "$TMPDIR" = "" ]
|
||||
then
|
||||
export TMPDIR=/tmp
|
||||
fi
|
||||
|
||||
${if avdHomeDir == null then ''
|
||||
# Store the virtual devices somewhere else, instead of polluting a user's HOME directory
|
||||
export ANDROID_SDK_HOME=$(mktemp -d $TMPDIR/nix-android-vm-XXXX)
|
||||
'' else ''
|
||||
mkdir -p "${avdHomeDir}"
|
||||
export ANDROID_SDK_HOME="${avdHomeDir}"
|
||||
''}
|
||||
|
||||
# We need to specify the location of the Android SDK root folder
|
||||
export ANDROID_SDK_ROOT=${sdk}
|
||||
|
||||
# We have to look for a free TCP port
|
||||
|
||||
echo "Looking for a free TCP port in range 5554-5584" >&2
|
||||
|
||||
for i in $(seq 5554 2 5584)
|
||||
do
|
||||
if [ -z "$(${sdk}/platform-tools/adb devices | grep emulator-$i)" ]
|
||||
then
|
||||
port=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$port" ]
|
||||
then
|
||||
echo "Unfortunately, the emulator port space is exhausted!" >&2
|
||||
exit 1
|
||||
else
|
||||
echo "We have a free TCP port: $port" >&2
|
||||
fi
|
||||
|
||||
export ANDROID_SERIAL="emulator-$port"
|
||||
|
||||
# Create a virtual android device for testing if it does not exist
|
||||
# ${sdk}/cmdline-tools/latest/bin/avdmanager list target
|
||||
|
||||
if [ "$(${sdk}/cmdline-tools/latest/bin/avdmanager list avd | grep 'Name: ${name}')" = "" ]
|
||||
then
|
||||
# Create a virtual android device
|
||||
yes "" | ${sdk}/cmdline-tools/latest/bin/avdmanager create avd -n "${name}" -k "system-images;android-${platformVersion};${systemImageType};${abiVersion}" -d "${deviceType}" $NIX_ANDROID_AVD_FLAGS
|
||||
|
||||
# fix wrong sdk path
|
||||
sed -i "s|image.sysdir.1.\+|image.sysdir.1=${sdk}/system-images/android-${platformVersion}/${systemImageType}/${abiVersion}|" "$ANDROID_SDK_HOME/.android/avd/${name}.avd/config.ini"
|
||||
|
||||
${lib.optionalString enableGPU ''
|
||||
# Enable GPU acceleration
|
||||
echo "hw.gpu.enabled=yes" >> "$ANDROID_SDK_HOME/.android/avd/${name}.avd/config.ini"
|
||||
''}
|
||||
|
||||
${lib.concatMapStrings (extraAVDFile: ''
|
||||
ln -sf ${extraAVDFile} "$ANDROID_SDK_HOME/.android/avd/${name}.avd"
|
||||
'') extraAVDFiles}
|
||||
fi
|
||||
|
||||
# Launch the emulator
|
||||
${sdk}/emulator/emulator -avd "${name}" -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
|
||||
|
||||
# Wait until the device has completely booted
|
||||
echo "Waiting until the emulator has booted the device and the package manager is ready..." >&2
|
||||
|
||||
${sdk}/platform-tools/adb -s emulator-$port wait-for-device
|
||||
|
||||
echo "Device state has been reached" >&2
|
||||
|
||||
while [ -z "$(${sdk}/platform-tools/adb -s emulator-$port shell getprop dev.bootcomplete | grep 1)" ]
|
||||
do
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo "dev.bootcomplete property is 1" >&2
|
||||
|
||||
#while [ -z "$(${sdk}/platform-tools/adb -s emulator-$port shell getprop sys.boot_completed | grep 1)" ]
|
||||
#do
|
||||
#sleep 5
|
||||
#done
|
||||
|
||||
#echo "sys.boot_completed property is 1" >&2
|
||||
|
||||
echo "ready" >&2
|
||||
|
||||
${lib.optionalString (app != null) ''
|
||||
# Install the App through the debugger, if it has not been installed yet
|
||||
|
||||
if [ -z "${package}" ] || [ "$(${sdk}/platform-tools/adb -s emulator-$port shell pm list packages | grep package:${package})" = "" ]
|
||||
then
|
||||
if [ -d "${app}" ]
|
||||
then
|
||||
appPath="$(echo ${app}/*.apk)"
|
||||
else
|
||||
appPath="${app}"
|
||||
fi
|
||||
|
||||
${sdk}/platform-tools/adb -s emulator-$port install "$appPath"
|
||||
fi
|
||||
|
||||
# Start the application
|
||||
${lib.optionalString (package != null && activity != null) ''
|
||||
${sdk}/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/${activity}
|
||||
''}
|
||||
''}
|
||||
EOF
|
||||
chmod +x $out/bin/${name}-run
|
||||
'';
|
||||
}
|
@ -31,6 +31,7 @@ in {
|
||||
};
|
||||
})
|
||||
];
|
||||
gtk.iconCache.enable = true;
|
||||
programs.dconf.enable = true;
|
||||
services.dbus.packages = with pkgs; [ gnome3.dconf gcr ];
|
||||
home-manager.users.alukard = {
|
||||
@ -49,10 +50,6 @@ in {
|
||||
size = thm.fontSizes.normal.int;
|
||||
};
|
||||
};
|
||||
home.sessionVariables.XDG_DATA_DIRS = [
|
||||
"${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}"
|
||||
"${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}"
|
||||
];
|
||||
home.sessionVariables.GTK_THEME = "Generated";
|
||||
};
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
kitty
|
||||
mangohud
|
||||
mpv
|
||||
ncmpcpp
|
||||
# ncmpcpp
|
||||
packages
|
||||
piper
|
||||
rofi
|
||||
|
Loading…
x
Reference in New Issue
Block a user