Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nix/modules/launcher): add wrapGAppsHook #1976

Merged
merged 8 commits into from
Mar 25, 2023
24 changes: 24 additions & 0 deletions containers/ubuntu-podman/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:22.10

ARG USERNAME=user
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo git \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# ********************************************************
# * Anything else you want to do like clean up goes here *
# ********************************************************

# [Optional] Set the default user. Omit if you want to keep the default as root.
USER $USERNAME

WORKDIR /home/$USERNAME
26 changes: 26 additions & 0 deletions containers/ubuntu-podman/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

set -xeu

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

podman build --build-arg USERNAME="$USER" --tag ubuntu-nix "${SCRIPT_DIR}"
xhost +si:localuser:"$USER"
podman run -it --rm \
--userns keep-id \
--security-opt label=type:container_runtime_t \
-v "$XAUTHORITY":"$XAUTHORITY":ro \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
--env XAUTHORITY \
--env DISPLAY \
--env NIX_REMOTE="daemon" \
--env NIX_CONFIG="experimental-features = nix-command flakes" \
-v /nix/store:/nix/store:ro \
-v /nix/var/nix/db:/nix/var/nix/db:ro \
-v /nix/var/nix/daemon-socket:/nix/var/nix/daemon-socket:ro \
-v "$(readlink "$(which nix)")":/usr/bin/nix:ro \
-v "${SCRIPT_DIR}"/../..:/home/"$USER"/project \
--workdir /home/"$USER"/project \
localhost/ubuntu-nix \
bash

17 changes: 13 additions & 4 deletions nix/modules/launcher.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
perl
pkg-config
])
++ (lib.optionals pkgs.stdenv.isLinux
(with pkgs; [
wrapGAppsHook
]))
++ lib.optionals pkgs.stdenv.isDarwin (with pkgs; [
xcbuild
libiconv
Expand All @@ -66,10 +70,14 @@
];

preFixup = ''
wrapProgram $out/bin/hc-launch \
--set WEBKIT_DISABLE_COMPOSITING_MODE 1 \
--set GIO_MODULE_DIR ${pkgs.glib-networking}/lib/gio/modules \
--prefix GIO_EXTRA_MODULES : ${pkgs.glib-networking}/lib/gio/modules
gappsWrapperArgs+=(
--set WEBKIT_DISABLE_COMPOSITING_MODE 1
)

# without this the DevTools will just display an unparsed HTML file (see https://github.com/tauri-apps/tauri/issues/5711#issuecomment-1336409601)
gappsWrapperArgs+=(
--prefix XDG_DATA_DIRS : "${pkgs.shared-mime-info}/share"
)
'';
});

Expand All @@ -81,3 +89,4 @@
};
};
}

4 changes: 4 additions & 0 deletions scripts/test-hc-launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

# TODO: build the hc-launch-test.webhapp file from source
echo pass | nix develop .#holonix --command hc-launch --piped -n1 ./hc-launch-test.webhapp network mdns