Issue with inability to launch script via Konsole installed as a flatpak

Hi! I’ve written a script to manage my flatpak packages in Nushell:

#!/usr/bin/env nu

export-env {
    $env.GUM_CHOOSE_SELECTED_FOREGROUND = '#64d633'
}

while true {
    try {
    let response = (gum choose --no-show-help
        --header='What would you like to do?'
        uninstall exit)

    match $response {
        uninstall => {
            try {
                let applications_to_uninstall = (flatpak list --app --columns=application |
                    gum choose --no-limit |
                    str join |
                    split row "\n")
                flatpak uninstall ...$applications_to_uninstall -y
            }
        },
        exit => {
            exit
        }
    }
    } catch {
        exit
    }
}

While no matter how I tried to launch it:

flatpak run org.kde.konsole -e /home/emilygraceseville7cf/Documents/programming/mine/nu/application-manager.nu

it failed to be executed properly - the window with it got closed almost instantly after it’s lauch. It worth mentioning that when my script is attempted to be lauched via konsole installed via apt everything works as expected.

Current Konsole flatpak permissions are:

[Context]
shared=network;ipc;
sockets=x11;wayland;session-bus;system-bus;fallback-x11;
devices=dri;all;
features=devel;bluetooth;canbus;per-app-dev-shm;
filesystems=home;host-etc;host-os;xdg-config/kdeglobals:ro;host;

[Session Bus Policy]
com.canonical.AppMenu.Registrar=talk
org.kde.kconfig.notify=talk
org.kde.KGlobalSettings=talk
org.freedesktop.Flatpak=talk
org.kde.kdeconnect=talk

Konsole version: 25.04.1

The original post is here.

This is likely because there is no nu interpreter inside the sandbox. Does it work with a normal bash/sh script?

AFAIR it didn’t work with bash/sh translated script. I’m confused as nu is inside /home/emilygraceseville7cf/.cargo/bin/ which is inside my $HOME directory. While filesystems contains home value, it still doesn’t work.

Should I put path /home/emilygraceseville7cf/.cargo/bin/ directly to filesystems or not?

Using host binaries like that inside the sandbox won’t work. Your best bet is to create a flatpak-spawn wrapper that launches nu on host.