Bridge DMS rendering through NixGL
This commit is contained in:
+49
-21
@@ -143,11 +143,16 @@ install_dms_runtime() {
|
||||
local profile="$state_home/$PROJECT/nix-profile"
|
||||
local dms_flake="github:AvengeMedia/DankMaterialShell/$DMS_REV"
|
||||
local nixpkgs="github:NixOS/nixpkgs/$NIXPKGS_REV"
|
||||
local nixgl_flake="$source_dir/config/nixgl"
|
||||
local core_ready=0
|
||||
|
||||
if [[ -x "$profile/bin/dms" && -x "$profile/bin/quickshell" &&
|
||||
-x "$profile/bin/matugen" && -x "$profile/bin/dgop" &&
|
||||
-x "$profile/bin/dsearch" ]]; then
|
||||
log "DMS 运行层已经安装,跳过"
|
||||
core_ready=1
|
||||
fi
|
||||
if (( core_ready )) && [[ -x "$profile/bin/nixGL" ]]; then
|
||||
log "DMS 图形运行层已经安装,跳过"
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -163,25 +168,46 @@ install_dms_runtime() {
|
||||
fi
|
||||
|
||||
local attempt
|
||||
for attempt in 1 2 3 4 5; do
|
||||
if sudo -u "$USER" -g nix-users env \
|
||||
HOME="$HOME" USER="$USER" \
|
||||
NIX_CONFIG="experimental-features = nix-command flakes" \
|
||||
nix profile install --profile "$profile" \
|
||||
"$dms_flake#dms-shell" \
|
||||
"$nixpkgs#quickshell" \
|
||||
"$nixpkgs#matugen" \
|
||||
"$nixpkgs#dgop" \
|
||||
"$nixpkgs#dsearch"; then
|
||||
break
|
||||
fi
|
||||
(( attempt < 5 )) || die "DMS 运行层安装失败,请检查网络后重新运行脚本。"
|
||||
log "下载中断,正在重试($attempt/5)"
|
||||
sleep 3
|
||||
done
|
||||
if (( ! core_ready )); then
|
||||
for attempt in 1 2 3 4 5; do
|
||||
if sudo -u "$USER" -g nix-users env \
|
||||
HOME="$HOME" USER="$USER" \
|
||||
NIX_CONFIG="experimental-features = nix-command flakes" \
|
||||
nix profile install --profile "$profile" \
|
||||
"$dms_flake#dms-shell" \
|
||||
"$nixpkgs#quickshell" \
|
||||
"$nixpkgs#matugen" \
|
||||
"$nixpkgs#dgop" \
|
||||
"$nixpkgs#dsearch"; then
|
||||
break
|
||||
fi
|
||||
(( attempt < 5 )) ||
|
||||
die "DMS 运行层安装失败,请检查网络后重新运行脚本。"
|
||||
log "下载中断,正在重试($attempt/5)"
|
||||
sleep 3
|
||||
done
|
||||
fi
|
||||
|
||||
[[ -x "$profile/bin/dms" && -x "$profile/bin/quickshell" ]] ||
|
||||
die "DMS 或 Quickshell 安装不完整。"
|
||||
if [[ ! -x "$profile/bin/nixGL" ]]; then
|
||||
log "安装与 Quickshell 匹配的 NixGL 驱动桥接"
|
||||
for attempt in 1 2 3; do
|
||||
if sudo -u "$USER" -g nix-users env \
|
||||
HOME="$HOME" USER="$USER" \
|
||||
NIX_CONFIG="experimental-features = nix-command flakes" \
|
||||
nix profile install --profile "$profile" --impure \
|
||||
"$nixgl_flake#default"; then
|
||||
break
|
||||
fi
|
||||
(( attempt < 3 )) ||
|
||||
die "NixGL 安装失败,请检查网络后重新运行脚本。"
|
||||
log "NixGL 下载中断,正在重试($attempt/3)"
|
||||
sleep 3
|
||||
done
|
||||
fi
|
||||
|
||||
[[ -x "$profile/bin/dms" && -x "$profile/bin/quickshell" &&
|
||||
-x "$profile/bin/nixGL" ]] ||
|
||||
die "DMS、Quickshell 或 NixGL 安装不完整。"
|
||||
}
|
||||
|
||||
install_rust() {
|
||||
@@ -381,7 +407,7 @@ backup_and_install_config() {
|
||||
|
||||
local profile="$state_home/$PROJECT/nix-profile"
|
||||
local binary
|
||||
for binary in dms quickshell qs matugen dgop dsearch; do
|
||||
for binary in dms quickshell qs matugen dgop dsearch nixGL; do
|
||||
if [[ -x "$profile/bin/$binary" ]]; then
|
||||
ln -sfn "$profile/bin/$binary" "$HOME/.local/bin/$binary"
|
||||
fi
|
||||
@@ -470,6 +496,7 @@ activate_dms() {
|
||||
log "当前没有可用的 systemd 用户会话;DMS 将在下次 Niri 登录时启动"
|
||||
return
|
||||
fi
|
||||
systemctl --user unset-environment QT_QUICK_BACKEND 2>/dev/null || true
|
||||
systemctl --user enable dms.service
|
||||
|
||||
"$profile/bin/dms" auth resolve-lock --quiet >/dev/null 2>&1 || true
|
||||
@@ -500,7 +527,8 @@ main() {
|
||||
install_dms_runtime
|
||||
else
|
||||
local profile="${XDG_STATE_HOME:-$HOME/.local/state}/$PROJECT/nix-profile"
|
||||
[[ -x "$profile/bin/dms" && -x "$profile/bin/quickshell" ]] ||
|
||||
[[ -x "$profile/bin/dms" && -x "$profile/bin/quickshell" &&
|
||||
-x "$profile/bin/nixGL" ]] ||
|
||||
die "--config-only 需要先完成一次完整安装。"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user