feat(console): attempt to make Android work

This commit is contained in:
Pavel Korytov 2021-07-31 16:28:25 +03:00
parent 48fd28b543
commit 9ac94c3967
3 changed files with 58 additions and 29 deletions

View file

@ -1,5 +1,6 @@
(specifications->manifest (specifications->manifest
'( '(
"jmtpfs"
"unzip" "unzip"
"password-store" "password-store"
"p7zip" "p7zip"

View file

@ -6,6 +6,12 @@ export QT_AUTO_SCREEN_SCALE_FACTOR=0
# export GTK2_RC_FILES="$HOME/.gtkrc-2.0" # export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
# Environment:1 ends here # Environment:1 ends here
# [[file:Console.org::*Android][Android:1]]
if [ "$HOME" != "${HOME%"com.termux"*}" ]; then
export IS_ANDROID=true
fi
# Android:1 ends here
# [[file:Console.org::*My paths][My paths:1]] # [[file:Console.org::*My paths][My paths:1]]
if [ -d "$HOME/bin" ] ; then if [ -d "$HOME/bin" ] ; then
export PATH="$HOME/bin:$PATH" export PATH="$HOME/bin:$PATH"
@ -14,16 +20,18 @@ fi
# My paths:1 ends here # My paths:1 ends here
# [[file:Console.org::*Guix settings][Guix settings:1]] # [[file:Console.org::*Guix settings][Guix settings:1]]
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles if [ -z "$IS_ANDROID" ]; then
for i in $GUIX_EXTRA_PROFILES/*; do GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
profile=$i/$(basename "$i") for i in $GUIX_EXTRA_PROFILES/*; do
if [ -f "$profile"/etc/profile ]; then profile=$i/$(basename "$i")
GUIX_PROFILE="$profile" if [ -f "$profile"/etc/profile ]; then
. "$GUIX_PROFILE"/etc/profile GUIX_PROFILE="$profile"
fi . "$GUIX_PROFILE"/etc/profile
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$profile/share" fi
unset profile export XDG_DATA_DIRS="$XDG_DATA_DIRS:$profile/share"
done unset profile
done
fi
# Guix settings:1 ends here # Guix settings:1 ends here
# [[file:Console.org::*Guix settings][Guix settings:2]] # [[file:Console.org::*Guix settings][Guix settings:2]]
@ -35,7 +43,9 @@ export GUIX_PACKAGE_PATH=~/guix-packages
# Guix settings:3 ends here # Guix settings:3 ends here
# [[file:Console.org::*Other package managers][Other package managers:1]] # [[file:Console.org::*Other package managers][Other package managers:1]]
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share" if [ -d "$HOME/.local/share/flatpak" ]; then
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"
fi
# Other package managers:1 ends here # Other package managers:1 ends here
# [[file:Console.org::*Other package managers][Other package managers:2]] # [[file:Console.org::*Other package managers][Other package managers:2]]
@ -51,7 +61,9 @@ fi
# Other package managers:3 ends here # Other package managers:3 ends here
# [[file:Console.org::*Other package managers][Other package managers:4]] # [[file:Console.org::*Other package managers][Other package managers:4]]
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.nix-profile/share/applications" if [ -d "$HOME/.nix-profile" ]; then
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.nix-profile/share/applications"
fi
# Other package managers:4 ends here # Other package managers:4 ends here
# [[file:Console.org::*npm][npm:2]] # [[file:Console.org::*npm][npm:2]]
@ -66,5 +78,7 @@ export MANPATH="${MANPATH-$(manpath)}:$NPM_PACKAGES/share/man"
# npm:3 ends here # npm:3 ends here
# [[file:Console.org::*XResources][XResources:1]] # [[file:Console.org::*XResources][XResources:1]]
xrdb ~/.Xresources if [ -z "$IS_ANDROID" ]; then
xrdb ~/.Xresources
fi
# XResources:1 ends here # XResources:1 ends here

View file

@ -56,6 +56,14 @@ export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_AUTO_SCREEN_SCALE_FACTOR=0 export QT_AUTO_SCREEN_SCALE_FACTOR=0
# export GTK2_RC_FILES="$HOME/.gtkrc-2.0" # export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
#+end_src #+end_src
** Android
Check if =.profile= is being run from Android. If so, set a variable.
#+begin_src sh
if [ "$HOME" != "${HOME%"com.termux"*}" ]; then
export IS_ANDROID=true
fi
#+end_src
** My paths ** My paths
My script folders My script folders
#+begin_src sh #+begin_src sh
@ -69,16 +77,18 @@ fi
Enable extra profiles Enable extra profiles
#+begin_src sh #+begin_src sh
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles if [ -z "$IS_ANDROID" ]; then
for i in $GUIX_EXTRA_PROFILES/*; do GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
profile=$i/$(basename "$i") for i in $GUIX_EXTRA_PROFILES/*; do
if [ -f "$profile"/etc/profile ]; then profile=$i/$(basename "$i")
GUIX_PROFILE="$profile" if [ -f "$profile"/etc/profile ]; then
. "$GUIX_PROFILE"/etc/profile GUIX_PROFILE="$profile"
fi . "$GUIX_PROFILE"/etc/profile
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$profile/share" fi
unset profile export XDG_DATA_DIRS="$XDG_DATA_DIRS:$profile/share"
done unset profile
done
fi
#+end_src #+end_src
Set Jupyter config PATH. It defaults to readonly directory somewhere in Guix profile. Set Jupyter config PATH. It defaults to readonly directory somewhere in Guix profile.
@ -95,7 +105,9 @@ Using other package managers with Guix requires some extra work.
Make flatpak apps visible to launchers: Make flatpak apps visible to launchers:
#+begin_src sh #+begin_src sh
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share" if [ -d "$HOME/.local/share/flatpak" ]; then
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"
fi
#+end_src #+end_src
Enable Nix Enable Nix
@ -114,7 +126,9 @@ fi
Make nix apps visible to launchers: Make nix apps visible to launchers:
#+begin_src sh #+begin_src sh
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.nix-profile/share/applications" if [ -d "$HOME/.nix-profile" ]; then
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.nix-profile/share/applications"
fi
#+end_src #+end_src
*** npm *** npm
@ -146,7 +160,9 @@ export MANPATH="${MANPATH-$(manpath)}:$NPM_PACKAGES/share/man"
| xrdb | | xrdb |
#+begin_src sh #+begin_src sh
xrdb ~/.Xresources if [ -z "$IS_ANDROID" ]; then
xrdb ~/.Xresources
fi
#+end_src #+end_src
** OFF (OFF) Package manager paths ** OFF (OFF) Package manager paths
Turned off for now, because probably it won't be necessary in Guix. Turned off for now, because probably it won't be necessary in Guix.
@ -791,10 +807,8 @@ key_bindings:
| p7zip | archiver | | p7zip | archiver |
| password-store | CLI password manager | | password-store | CLI password manager |
| unzip | | | unzip | |
| jmtpfs | A tool to mount MTP devices (e.g. Android) |
| Note | Description |
|------+-----------------|
| TODO | package fselect |
* Misc scripts * Misc scripts
** =nt= - exec command with a finished notification ** =nt= - exec command with a finished notification
Usage: Usage: