feat(gui): preflight NSH downloads and install Nix runtimes

This commit is contained in:
Kevin Yue committed 2026-11-02 11:42:55 +08:00
1 parent dcc74d805b
commit d825e2b9c8
11 files changed
+369 -22

No files matched your search

Generated
+12 -1
View File
@@ -2131,6 +2131,7 @@ dependencies = [
"getrandom 0.4.3",
"gtk",
"humantime",
"libloading 0.9.0",
"log",
"log-reload",
"md5",
@@ -3093,7 +3094,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf"
dependencies = [
"gtk-sys",
"libloading",
"libloading 0.7.4",
"once_cell",
]
@@ -3122,6 +3123,16 @@ dependencies = [
"winapi",
]
[[package]]
name = "libloading"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
dependencies = [
"cfg-if",
"windows-link",
]
[[package]]
name = "libm"
version = "0.2.16"
+10
View File
@@ -127,6 +127,8 @@ GP Connect provides a desktop interface for managing VPN connections. On macOS,
gpclient launch-gui
```
On Linux, switching to Native Shell checks for GTK 4.14 or later, GnuTLS 3, and D-Bus before offering a download. If a required runtime is missing or too old, the current interface stays open. Nix packages with the GUI installer supply these dependencies during installation instead.
> [!Note]
>
> The GUI version is partially open source. The background service ([gpservice](./apps/gpservice/)) is open source, while the GUI wrapper is proprietary.
@@ -352,6 +354,14 @@ nix build "git+file://$PWD?submodules=1#fromSource"
Local source builds require initialized Git submodules and a flake URL with `submodules=1`, as shown above. For a remote source flake, use a Git URL with submodules enabled, such as `git+https://github.com/yuezk/GlobalProtect-openconnect?submodules=1#fromSource`. The `prebuilt` package and NixOS module do not require Git submodules. Build output (`target`, `.build`, and `node_modules`) is excluded from the source input. Updating release asset hashes changes the prebuilt package, independently of source builds.
Source builds also support downloading either desktop interface on NixOS. The
downloader packages the verified Tauri or Native Shell archive with Nix, including
its runtime libraries. Each installed interface has a garbage-collection root
under `/var/lib/gpclient/nix-gui`, so its dependencies remain available after
system upgrades. No Rust compilation or NixOS rebuild is needed for GUI downloads.
Prebuilt packages gain this support when their release includes the updated
service; adding the flake installer alone does not change older service binaries.
### Official Docker Image
The [official Docker image](https://hub.docker.com/r/yuezk/globalprotect-openconnect) provides the CLI tools on Alpine Linux:
+26 -7
View File
@@ -18,7 +18,8 @@ use tokio_util::sync::CancellationToken;
use crate::session_registry::SessionRegistry;
use gpapi::service::transport::{
DESKTOP_GUI_EXITED, DESKTOP_RENDERING_RETRY, DESKTOP_SWITCH_BEGIN, DESKTOP_SWITCH_CANCEL, DESKTOP_SWITCH_COMMIT,
DESKTOP_GUI_EXITED, DESKTOP_GUI_INSTALLER, DESKTOP_RENDERING_RETRY, DESKTOP_SWITCH_BEGIN, DESKTOP_SWITCH_CANCEL,
DESKTOP_SWITCH_COMMIT,
};
/// Private parent/service pipes; credentials never pass through argv, environment or files.
@@ -69,14 +70,17 @@ impl DesktopClient {
let result = tokio::select! {
_ = cancel.cancelled() => Ok(None),
result = async {
self.write_frame(&credential.encode_frame()?).await?;
self.write_all(&credential.encode_frame()?).await?;
loop {
match self.gui_exited().await? {
match self.read_control().await? {
Some(DESKTOP_GUI_INSTALLER) => {
self.write_all(&[u8::from(crate::request_dispatcher::gui_installer().is_some())]).await?;
}
Some(DESKTOP_SWITCH_BEGIN) => {
ensure!(pending.is_none(), "A GUI switch is already pending");
let credential = registry.issue(env!("CARGO_PKG_VERSION"), Some(uid))?;
pending = Some(credential.session_id());
self.write_frame(&credential.encode_frame()?).await?;
self.write_all(&credential.encode_frame()?).await?;
}
Some(DESKTOP_SWITCH_COMMIT) => {
let replacement = pending.take().context("No GUI switch is pending")?;
@@ -110,7 +114,7 @@ impl DesktopClient {
}
}
async fn write_frame(&self, mut bytes: &[u8]) -> anyhow::Result<()> {
async fn write_all(&self, mut bytes: &[u8]) -> anyhow::Result<()> {
while !bytes.is_empty() {
let mut ready = self.output.writable().await?;
match ready.try_io(|fd| write(fd.get_ref(), bytes).map_err(io::Error::from)) {
@@ -125,7 +129,7 @@ impl DesktopClient {
Ok(())
}
async fn gui_exited(&self) -> anyhow::Result<Option<u8>> {
async fn read_control(&self) -> anyhow::Result<Option<u8>> {
loop {
let mut ready = self.input.readable().await?;
let mut byte = [0];
@@ -170,7 +174,7 @@ mod tests {
.unwrap()
.success()
);
channel.write_frame(b"PRIVATE_FRAME").await.unwrap();
channel.write_all(b"PRIVATE_FRAME").await.unwrap();
}
use gpapi::service::transport::SessionCredential;
use nix::unistd::pipe;
@@ -289,6 +293,21 @@ mod tests {
CancellationToken::new(),
));
let (reader, first) = credential(reader).await;
write(&control, &[DESKTOP_GUI_INSTALLER]).unwrap();
let reader = tokio::task::spawn_blocking(move || {
let mut reader = reader;
let mut capability = [0];
reader.read_exact(&mut capability).unwrap();
assert_eq!(
capability[0],
u8::from(crate::request_dispatcher::gui_installer().is_some())
);
reader
})
.await
.unwrap();
// A capability query leaves the current session intact and the next frame readable.
assert!(registry.last_successful_hip_report(first.session_id()).is_ok());
write(&control, &[DESKTOP_SWITCH_BEGIN]).unwrap();
let (reader, cancelled) = credential(reader).await;
assert_ne!(first.session_id(), cancelled.session_id());
+77
View File
@@ -333,7 +333,29 @@ enum GuiInstallError {
Install(anyhow::Error),
}
pub(crate) fn gui_installer() -> Option<std::path::PathBuf> {
std::env::current_exe()
.ok()
.and_then(|executable| {
executable
.parent()?
.parent()
.map(|prefix| prefix.join("libexec/gpclient/gp-gui-installer"))
})
.filter(|path| path.is_file())
}
fn install_gui_at(src: &Path, checksum: &str, target: &Path) -> Result<(), GuiInstallError> {
let installer = gui_installer();
install_gui_with_installer(src, checksum, target, installer.as_deref())
}
fn install_gui_with_installer(
src: &Path,
checksum: &str,
target: &Path,
installer: Option<&Path>,
) -> Result<(), GuiInstallError> {
let Some(dir) = target.parent() else {
return Err(GuiInstallError::Install(anyhow::anyhow!(
"Failed to get parent directory of GUI binary"
@@ -345,6 +367,26 @@ fn install_gui_at(src: &Path, checksum: &str, target: &Path) -> Result<(), GuiIn
let archive_path = staged_archive.path().to_string_lossy();
verify_checksum(&archive_path, checksum).map_err(GuiInstallError::Checksum)?;
// A package may need to prepare downloaded executables for its runtime.
// Resolve this helper beside the running service, never from the request or PATH.
if let Some(installer) = installer {
let status = std::process::Command::new(installer)
.arg(staged_archive.path())
.arg(checksum)
.arg(target)
.stdin(std::process::Stdio::null())
.stdout(std::process::Stdio::null())
.status()
.map_err(|err| GuiInstallError::Install(err.into()))?;
return if status.success() {
Ok(())
} else {
Err(GuiInstallError::Install(anyhow::anyhow!(
"GUI package installation failed: {status}"
)))
};
}
let tar = XzDecoder::new(BufReader::new(
staged_archive
.reopen()
@@ -577,6 +619,41 @@ mod tests {
assert_eq!(std::fs::read(target).unwrap(), b"existing");
}
#[test]
fn package_installer_receives_a_verified_staged_archive() {
let archive = compressed_gui_archive(b"gui binary");
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
let output = tempfile::tempdir().unwrap();
let target = output.path().join("gpgui-nsh");
let installer = output.path().join("installer");
std::fs::write(
&installer,
"#!/bin/sh\nset -eu\ntest -f \"$1\"\nprintf '%s' \"$2\" > \"$3\"\n",
)
.unwrap();
std::fs::set_permissions(&installer, Permissions::from_mode(0o755)).unwrap();
assert!(install_gui_with_installer(archive.path(), "invalid", &target, Some(&installer)).is_err());
assert!(!target.exists());
install_gui_with_installer(archive.path(), &checksum, &target, Some(&installer)).unwrap();
assert_eq!(std::fs::read_to_string(target).unwrap(), checksum);
}
#[test]
fn package_installation_failure_preserves_the_existing_gui() {
let archive = compressed_gui_archive(b"replacement");
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
let output = tempfile::tempdir().unwrap();
let target = output.path().join("gpgui");
std::fs::write(&target, b"existing").unwrap();
let installer = output.path().join("installer");
std::fs::write(&installer, "#!/bin/sh\nexit 1\n").unwrap();
std::fs::set_permissions(&installer, Permissions::from_mode(0o755)).unwrap();
assert!(install_gui_with_installer(archive.path(), &checksum, &target, Some(&installer)).is_err());
assert_eq!(std::fs::read(target).unwrap(), b"existing");
}
#[tokio::test]
async fn brokered_mode_rejects_gui_management_and_root_readable_identity_paths() {
let dispatcher = RequestDispatcher::new(
+5 -1
View File
@@ -63,18 +63,22 @@ oslog = { version = "0.2", default-features = false, optional = true }
[target.'cfg(not(any(target_os="macos", target_os="windows")))'.dependencies]
gtk = { version = "0.18", optional = true }
[target.'cfg(target_os="linux")'.dependencies]
libloading = { version = "0.9", optional = true }
[build-dependencies]
cc = "1"
pkg-config = "0.3"
[dev-dependencies]
openssl.workspace = true
libloading = "0.9"
proptest.workspace = true
tokio = { workspace = true, features = ["test-util"] }
[features]
default = ["desktop"]
desktop = ["tokio/process", "tokio/signal", "dep:directories", "dep:nix", "dep:uzers", "dep:netdev", "dep:os_info", "dep:whoami", "dep:dns-lookup", "dep:socket2"]
desktop = ["tokio/process", "tokio/signal", "dep:directories", "dep:nix", "dep:uzers", "dep:netdev", "dep:os_info", "dep:whoami", "dep:dns-lookup", "dep:socket2", "dep:libloading"]
tauri = ["desktop", "dep:tauri", "dep:gtk"]
clap = ["desktop", "dep:clap", "dep:clap-verbosity-flag"]
webview-auth = []
+50 -13
View File
@@ -181,6 +181,18 @@ impl<'a> GuiLauncher<'a> {
let variant = selection.variant;
let candidate = Self::new(self.version, self.credential.clone(), variant).envs(self.envs.clone());
let program = candidate.find_compatible_program(cancellation).await?;
if program.is_none() && variant == crate::gui::GuiVariant::Nsh {
use crate::service::transport::DESKTOP_GUI_INSTALLER;
service_input.write_all(&[DESKTOP_GUI_INSTALLER]).await?;
let supplies_runtime = match service_output.read_u8().await? {
0 => false,
1 => true,
_ => anyhow::bail!("Invalid GUI installer capability response"),
};
if !supplies_runtime {
super::nsh_runtime::check()?;
}
}
if program.is_none() && !selection.allow_download {
gui_switch::reply(&mut socket, Ok(GuiSwitchOutcome::DownloadRequired)).await?;
return Ok(None);
@@ -486,11 +498,21 @@ mod tests {
#[test]
#[cfg(target_os = "linux")]
fn supervisor_switch_success_and_failure_preserve_child_ownership() {
for scenario in ["success", "failure", "missing", "incompatible"] {
for scenario in [
"success",
"failure",
"missing",
"incompatible",
"runtime-too-old",
"runtime-too-old-confirmed",
] {
let directory = TempDir::new().unwrap();
let executable = std::env::current_exe().unwrap();
// An old host GTK must block generic downloads, but not package-managed downloads.
let gtk = super::super::nsh_runtime::tests::gtk_fixture(directory.path(), 12);
fs::rename(gtk, directory.path().join("libgtk-4.so.1")).unwrap();
for name in ["gpgui", "gpgui-nsh"] {
if scenario == "missing" && name == "gpgui-nsh" {
if (scenario == "missing" || scenario.starts_with("runtime-too-old")) && name == "gpgui-nsh" {
continue;
}
let version = if scenario == "incompatible" && name == "gpgui-nsh" {
@@ -515,6 +537,7 @@ mod tests {
.env("GP_SWITCH_SCENARIO", scenario)
.env("GP_SWITCH_DIRECTORY", directory.path())
.env("GP_GUI_BINARY", directory.path().join("gpgui"))
.env("LD_LIBRARY_PATH", directory.path())
.env("XDG_CONFIG_HOME", directory.path().join("config"))
.output()
.unwrap();
@@ -629,12 +652,15 @@ mod tests {
#[ignore = "subprocess supervisor fixture with isolated GUI paths and preferences"]
#[cfg(target_os = "linux")]
async fn supervisor_fixture() {
use crate::service::transport::{DESKTOP_SWITCH_BEGIN, DESKTOP_SWITCH_CANCEL, DESKTOP_SWITCH_COMMIT};
use crate::service::transport::{
DESKTOP_GUI_INSTALLER, DESKTOP_SWITCH_BEGIN, DESKTOP_SWITCH_CANCEL, DESKTOP_SWITCH_COMMIT,
};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
let directory = PathBuf::from(std::env::var_os("GP_SWITCH_DIRECTORY").unwrap());
let scenario = std::env::var("GP_SWITCH_SCENARIO").unwrap();
let success = scenario == "success";
let download_required = matches!(scenario.as_str(), "missing" | "incompatible");
let runtime_too_old = scenario.starts_with("runtime-too-old");
let listener = super::super::gui_switch::SwitchListener::new().unwrap();
let (mut service_input, mut control) = tokio::io::duplex(64);
let (mut service_output, mut credentials) = tokio::io::duplex(2048);
@@ -643,6 +669,9 @@ mod tests {
loop {
let message = control.read_u8().await.unwrap();
match message {
DESKTOP_GUI_INSTALLER => {
credentials.write_all(&[u8::from(!runtime_too_old)]).await.unwrap();
}
DESKTOP_SWITCH_BEGIN => {
fs::write(&service_marker, "").unwrap();
let credential = SessionCredential::generate(Uuid::new_v4(), VERSION).unwrap();
@@ -676,23 +705,21 @@ mod tests {
&listener.path(),
crate::gui::GuiSwitchRequest {
variant: crate::gui::GuiVariant::Nsh,
allow_download: false,
allow_download: scenario == "runtime-too-old-confirmed",
},
)
.await;
if download_required {
if runtime_too_old {
let error = result.unwrap_err().to_string();
anyhow::ensure!(
error.contains("4.14") && error.contains("4.12.1"),
"Unexpected runtime error: {error}"
);
} else if download_required {
anyhow::ensure!(
result? == crate::gui::GuiSwitchOutcome::DownloadRequired,
"Missing download confirmation"
);
anyhow::ensure!(
!directory.join("service-switch-started").exists(),
"Download check changed the service session"
);
anyhow::ensure!(
!directory.join("gpgui-nsh-started").exists(),
"Download check launched the replacement"
);
} else {
anyhow::ensure!(result.is_ok() == success, "Unexpected switch result: {result:?}");
if success {
@@ -702,6 +729,16 @@ mod tests {
);
}
}
if download_required || runtime_too_old {
anyhow::ensure!(
!directory.join("service-switch-started").exists(),
"Download check changed the service session"
);
anyhow::ensure!(
!directory.join("gpgui-nsh-started").exists(),
"Download check launched the replacement"
);
}
anyhow::ensure!(
!directory.join("gpgui-exited").exists(),
"Current GUI exited before acknowledgement"
+2
View File
@@ -11,6 +11,8 @@ pub mod desktop_launcher;
pub mod gui_launcher;
#[cfg(target_os = "linux")]
pub mod gui_switch;
#[cfg(any(target_os = "linux", test))]
mod nsh_runtime;
pub mod users;
pub mod collection;
+105
View File
@@ -0,0 +1,105 @@
//! Checks the generic Linux NSH runtime before offering a download.
//! Runs in the desktop supervisor, which does not load either GUI's GTK runtime.
use std::{ffi::OsStr, os::raw::c_uint};
use anyhow::{Context, ensure};
use libloading::{
Library,
os::unix::{RTLD_LOCAL, RTLD_NOW},
};
// Match nsh-platform-linux's gtk4/v4_14 feature when changing the NSH build.
const MIN_GTK_MINOR: u32 = 14;
#[cfg(target_os = "linux")]
pub(super) fn check() -> anyhow::Result<()> {
check_gtk(OsStr::new("libgtk-4.so.1"))?;
load_library(OsStr::new("libgnutls.so.30"), "GnuTLS 3")?;
load_library(OsStr::new("libdbus-1.so.3"), "D-Bus")?;
Ok(())
}
fn load_library(path: &OsStr, name: &str) -> anyhow::Result<Library> {
// Resolve symbols now as well as transitive dependencies, without initializing GTK.
let library = unsafe { libloading::os::unix::Library::open(Some(path), RTLD_LOCAL | RTLD_NOW) };
library.map(Into::into).map_err(|error| {
log::warn!("Native Shell runtime check failed for {name}: {error}");
anyhow::anyhow!("Native Shell could not load {name}. Install its runtime libraries and try again.")
})
}
fn check_gtk(path: &OsStr) -> anyhow::Result<()> {
let library = load_library(path, "GTK 4.14 or later")?;
type Version = unsafe extern "C" fn() -> c_uint;
// These public GTK getters take no arguments and do not initialize a display.
let (major, minor, micro) = unsafe {
let major = library.get::<Version>(b"gtk_get_major_version\0");
let minor = library.get::<Version>(b"gtk_get_minor_version\0");
let micro = library.get::<Version>(b"gtk_get_micro_version\0");
let message = "Native Shell requires GTK 4.14 or later. Update GTK 4 and try again.";
(
major.context(message)?(),
minor.context(message)?(),
micro.context(message)?(),
)
};
ensure!(
major == 4 && minor >= MIN_GTK_MINOR,
"Native Shell requires GTK 4.14 or later. This system has GTK {major}.{minor}.{micro}."
);
Ok(())
}
#[cfg(test)]
pub(super) mod tests {
use super::*;
use std::{fs, process::Command};
pub(in crate::process) fn gtk_fixture(directory: &std::path::Path, minor: u32) -> std::path::PathBuf {
let source = directory.join(format!("gtk-{minor}.c"));
let library = directory.join(format!("gtk-{minor}.so"));
fs::write(
&source,
format!(
"unsigned gtk_get_major_version(void) {{ return 4; }}\n\
unsigned gtk_get_minor_version(void) {{ return {minor}; }}\n\
unsigned gtk_get_micro_version(void) {{ return 1; }}\n"
),
)
.unwrap();
assert!(
Command::new("cc")
.args(["-shared", "-fPIC"])
.arg(source)
.arg("-o")
.arg(&library)
.status()
.unwrap()
.success()
);
library
}
#[test]
fn loads_runtime_version_without_development_metadata_or_a_display() {
let directory = tempfile::tempdir().unwrap();
let old = gtk_fixture(directory.path(), 12);
let supported = gtk_fixture(directory.path(), 14);
let newer = gtk_fixture(directory.path(), 20);
let error = check_gtk(old.as_os_str()).unwrap_err().to_string();
assert!(error.contains("4.14"), "{error}");
assert!(error.contains("4.12.1"), "{error}");
check_gtk(supported.as_os_str()).unwrap();
check_gtk(newer.as_os_str()).unwrap();
}
#[test]
fn missing_runtime_reports_an_actionable_error() {
let directory = tempfile::tempdir().unwrap();
let error = check_gtk(directory.path().join("missing.so").as_os_str())
.unwrap_err()
.to_string();
assert!(error.contains("GTK 4.14 or later"), "{error}");
assert!(error.contains("Install"), "{error}");
}
}
@@ -24,3 +24,5 @@ pub const DESKTOP_RENDERING_RETRY: u8 = 1;
pub const DESKTOP_SWITCH_BEGIN: u8 = 2;
pub const DESKTOP_SWITCH_COMMIT: u8 = 3;
pub const DESKTOP_SWITCH_CANCEL: u8 = 4;
/// Query whether the service package can install GUI runtime dependencies; replies with 0 or 1.
pub const DESKTOP_GUI_INSTALLER: u8 = 5;
+46
View File
@@ -92,6 +92,49 @@
runtimeTools = with pkgs; [ coreutils iproute2 systemd procps util-linux nettools xdg-utils ];
guiRecipe = pkgs.writeText "gp-downloaded-gui.nix" ''
{ archive, checksum, binaryName }:
import ${./nix/gui-package.nix} {
pkgs = import ${pkgs.path} {
system = "${pkgs.stdenv.hostPlatform.system}";
config = {};
overlays = [];
};
inherit archive checksum binaryName;
version = "${version}";
}
'';
guiInstaller = pkgs.writeShellApplication {
name = "gp-gui-installer";
runtimeInputs = [ pkgs.nix pkgs.coreutils ];
text = ''
archive=$1
checksum=$2
target=$3
binary_name=$(basename "$target")
case "$binary_name" in
gpgui|gpgui-nsh) ;;
*) echo "Unsupported GUI executable" >&2; exit 1 ;;
esac
directory=$(dirname "$target")
root="$directory/nix-gui/$binary_name"
mkdir -p "$directory/nix-gui"
nix-build ${guiRecipe} --out-link "$root" --no-build-output \
--argstr archive "$archive" --argstr checksum "$checksum" \
--argstr binaryName "$binary_name"
temporary=$(mktemp -d "$directory/.gui-link.XXXXXX")
trap 'rm -rf "$temporary"' EXIT
ln -s "$root/bin/$binary_name" "$temporary/$binary_name"
mv -Tf "$temporary/$binary_name" "$target"
'';
};
installGuiInstaller = lib.optionalString pkgs.stdenv.isLinux ''
install -Dm755 ${guiInstaller}/bin/gp-gui-installer \
"$out/libexec/gpclient/gp-gui-installer"
'';
nativeRuntimeWrapping = lib.optionalString pkgs.stdenv.isLinux ''
gappsWrapperArgs+=(
--prefix PATH : "/run/wrappers/bin:${lib.makeBinPath runtimeTools}"
@@ -152,6 +195,7 @@
fromSource = lib.makeOverridable ({ gui ? gpgui }: naersk'.buildPackage {
inherit pname version;
SNAPSHOT = lib.boolToString (releaseTag == "snapshot");
src = assert lib.assertMsg
(builtins.pathExists (src + "/crates/openconnect/deps/openconnect/configure.ac")
&& builtins.pathExists (src + "/crates/openconnect/deps/libxml2/configure.ac"))
@@ -202,6 +246,7 @@
''
+ lib.optionalString pkgs.stdenv.isLinux ''
${installNixosPolkitRule}
${installGuiInstaller}
''
+ ''
${rewriteVpncScriptToolPaths}
@@ -244,6 +289,7 @@
${rewriteVpncScriptToolPaths}
sh ${./scripts/relocate-install-paths.sh} "$out" /usr "$out"
${installNixosPolkitRule}
${installGuiInstaller}
runHook postInstall
'';
+34
View File
@@ -0,0 +1,34 @@
{ pkgs, archive, checksum, binaryName, version }:
let
nativeShell = binaryName == "gpgui-nsh";
in
assert builtins.elem binaryName [ "gpgui" "gpgui-nsh" ];
pkgs.stdenv.mkDerivation {
pname = binaryName;
inherit version;
src = builtins.path {
path = builtins.toPath archive;
name = "${binaryName}.tar.xz";
recursive = false;
sha256 = checksum;
};
dontBuild = true;
nativeBuildInputs = [ pkgs.autoPatchelfHook ] ++ (
if nativeShell then [ pkgs.wrapGAppsHook4 ] else [ pkgs.wrapGAppsHook3 ]
);
buildInputs = with pkgs;
[ gnutls ] ++ (if nativeShell then [ gtk4 ] else [
gtk3 webkitgtk_4_1 libsoup_3 glib-networking libsecret libayatana-appindicator
]);
runtimeDependencies = [ pkgs.libglvnd ] ++ pkgs.lib.optionals (!nativeShell) [
pkgs.glib-networking pkgs.libayatana-appindicator
];
installPhase = ''
runHook preInstall
install -Dm755 ${binaryName} "$out/bin/${binaryName}"
if [ -f ICU4X-LICENSE.txt ]; then
install -Dm644 ICU4X-LICENSE.txt "$out/share/licenses/${binaryName}/ICU4X-LICENSE.txt"
fi
runHook postInstall
'';
}