Open PedroRegisPOAR opened 3 years ago
Broken, hello
is not beeing added to $PATH, why?
nix \
shell \
--impure \
--expr \
'(
with builtins.getFlake "nixpkgs";
with legacyPackages.${builtins.currentSystem};
(
let fhs = pkgs.buildFHSUserEnv {
name = "fenv";
targetPkgs = pkgs: with (builtins.getFlake "nixpkgs");
[
# bashInteractive
# coreutils
hello
];
multiPkgs = pkgs: with (builtins.getFlake "nixpkgs");
[
zlib
];
runScript = "bash";
};
in pkgs.stdenv.mkDerivation {
name = "android-env-shell";
nativeBuildInputs = [ fhs ];
unpackPhase = ":";
installPhase = "mkdir $out";
phases = [ "unpackPhase" "installPhase" ];
shellHook = "exec fenv";
}
)
)'
TODO:
{ buildFHSUserEnv
, writeShellScriptBin
, ... }:
let
fhs = buildFHSUserEnv {
name = "appimage-env";
# Most of the packages were taken from the Steam chroot
targetPkgs = pkgs: with pkgs; [
gtk3
bashInteractive
gnome.zenity
python2
xorg.xrandr
which
perl
xdg-utils
iana-etc
krb5
gsettings-desktop-schemas
hicolor-icon-theme # dont show a gtk warning about hicolor not being installed
];
# list of libraries expected in an appimage environment:
# https://github.com/AppImage/pkg2appimage/blob/master/excludelist
multiPkgs = pkgs: with pkgs; [
# extra
fuse
fuse3
(writeShellScriptBin "sudo" "true") # suid wrappers messing with suff
pulseaudio
desktop-file-utils
xorg.libXcomposite
xorg.libXtst
xorg.libXrandr
xorg.libXext
xorg.libX11
xorg.libXfixes
libGL
gst_all_1.gstreamer
gst_all_1.gst-plugins-ugly
gst_all_1.gst-plugins-base
libdrm
xorg.xkeyboardconfig
xorg.libpciaccess
glib
gtk2
bzip2
zlib
gdk-pixbuf
xorg.libXinerama
xorg.libXdamage
xorg.libXcursor
xorg.libXrender
xorg.libXScrnSaver
xorg.libXxf86vm
xorg.libXi
xorg.libSM
xorg.libICE
gnome2.GConf
freetype
(curl.override { gnutlsSupport = true; opensslSupport = false; })
nspr
nss
fontconfig
cairo
pango
expat
dbus
cups
libcap
SDL2
libusb1
udev
dbus-glib
atk
at-spi2-atk
libudev0-shim
xorg.libXt
xorg.libXmu
xorg.libxcb
xorg.xcbutil
xorg.xcbutilwm
xorg.xcbutilimage
xorg.xcbutilkeysyms
xorg.xcbutilrenderutil
libGLU
libuuid
libogg
libvorbis
SDL
SDL2_image
glew110
openssl
libidn
tbb
wayland
mesa
libxkbcommon
flac
freeglut
libjpeg
libpng12
libsamplerate
libmikmod
libtheora
libtiff
pixman
speex
SDL_image
SDL_ttf
SDL_mixer
SDL2_ttf
SDL2_mixer
libappindicator-gtk2
libcaca
libcanberra
libgcrypt
libvpx
librsvg
xorg.libXft
libvdpau
alsa-lib
harfbuzz
e2fsprogs
libgpg-error
keyutils.lib
libjack2
fribidi
p11-kit
gmp
# libraries not on the upstream include list, but nevertheless expected
# by at least one appimage
libtool.lib # for Synfigstudio
xorg.libxshmfence # for apple-music-electron
at-spi2-core
];
runScript = ''
PATH=$(echo "$PATH" | sed 's;/run/wrappers/bin:;;g')
"$@"
'';
};
in writeShellScriptBin "appimage-wrap" ''
PATH=$PATH:${fhs}/bin
APPIMAGE="$1";shift
ENV_NAME="$(basename "$APPIMAGE")"
ENVDIR="/tmp/appimage-wrap/$ENV_NAME"
mkdir -p "$ENVDIR"
if [ -z "$(ls -A $ENVDIR)" ]; then
echo "Mounting appimage"
sudo mount "$APPIMAGE" "$ENVDIR" -o "offset=$(appimage-env "$APPIMAGE" --appimage-offset | head -n 1)"
fi
appimage-env "$ENVDIR/AppRun" "$@"
''
Some notes
Here I am summarizing some stuff that I found about
buildFHSUserEnv
and related stuff.TODOs:
https://github.com/NixOS/nix/issues/1569
Cool:
Refs. :
TODO:
https://unix.stackexchange.com/questions/522822/different-methods-to-run-a-non-nixos-executable-on-nixos
Many insteresting results found in https://gist.github.com/search?p=8&q=buildFHSUserEnv, a lot of things to study:
Really cool: fhs-nix-study
https://github.com/NixOS/nixpkgs/blob/87b215d5f72cd51ea2b649e452c107c9e14f4abf/pkgs/applications/editors/android-studio/common.nix#L104-L106
TODO: make a minimal example of this:
TODOs:
TODO:
/tmp
TODO: