Bridge DMS rendering through NixGL
This commit is contained in:
@@ -26,8 +26,8 @@ Engine 创意工坊图片,不修改显示器分辨率、缩放和排列。
|
|||||||
curl -fsSL https://git.k1412.top/wuyang/niri-beyond-glass/raw/branch/main/install.sh | bash
|
curl -fsSL https://git.k1412.top/wuyang/niri-beyond-glass/raw/branch/main/install.sh | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
首次安装需要编译 Niri,并下载约 700 MB 的隔离 DMS 运行环境,最终约占用
|
首次安装需要编译 Niri,并下载隔离的 DMS 运行环境与 NixGL 图形驱动桥接,
|
||||||
2.2 GB。脚本会调用 `sudo` 安装依赖,但必须以普通用户运行。完成后注销,在
|
最终约占用 3.3 GB。脚本会调用 `sudo` 安装依赖,但必须以普通用户运行。完成后注销,在
|
||||||
GDM 会话菜单选择 **Niri**。
|
GDM 会话菜单选择 **Niri**。
|
||||||
|
|
||||||
已经运行过旧版安装器但顶栏风格不一致时,直接再次运行同一命令。脚本会跳过
|
已经运行过旧版安装器但顶栏风格不一致时,直接再次运行同一命令。脚本会跳过
|
||||||
@@ -105,6 +105,8 @@ curl -fsSL https://git.k1412.top/wuyang/niri-beyond-glass/raw/branch/main/uninst
|
|||||||
`/usr/local` 编译安装 0.3.0。
|
`/usr/local` 编译安装 0.3.0。
|
||||||
- Ubuntu 24.04 的 PPA 没有 DMS/Quickshell 软件包,因此使用 Ubuntu 自带 Nix
|
- Ubuntu 24.04 的 PPA 没有 DMS/Quickshell 软件包,因此使用 Ubuntu 自带 Nix
|
||||||
作为隔离兼容层;这不把 Ubuntu 转换为 NixOS。
|
作为隔离兼容层;这不把 Ubuntu 转换为 NixOS。
|
||||||
|
- Quickshell 通过 64 位 NixGL 桥接 Ubuntu 的 OpenGL/Vulkan 驱动;不安装
|
||||||
|
DMS 不需要的 32 位图形库。
|
||||||
- 不安装 DMS Greeter,登录界面仍由 GDM 管理;DMS 锁屏属于 Niri 会话内部。
|
- 不安装 DMS Greeter,登录界面仍由 GDM 管理;DMS 锁屏属于 Niri 会话内部。
|
||||||
- 壁纸和显示器布局不会从作者机器迁移。
|
- 壁纸和显示器布局不会从作者机器迁移。
|
||||||
- NVIDIA 用户应先确保 Ubuntu 官方驱动在 GNOME Wayland 下工作正常。
|
- NVIDIA 用户应先确保 Ubuntu 官方驱动在 GNOME Wayland 下工作正常。
|
||||||
@@ -114,6 +116,7 @@ curl -fsSL https://git.k1412.top/wuyang/niri-beyond-glass/raw/branch/main/uninst
|
|||||||
- [Niri](https://github.com/niri-wm/niri)
|
- [Niri](https://github.com/niri-wm/niri)
|
||||||
- [DankMaterialShell](https://github.com/AvengeMedia/DankMaterialShell)
|
- [DankMaterialShell](https://github.com/AvengeMedia/DankMaterialShell)
|
||||||
- [Quickshell](https://quickshell.org/)
|
- [Quickshell](https://quickshell.org/)
|
||||||
|
- [NixGL](https://github.com/nix-community/nixGL)
|
||||||
- [Xwayland Satellite](https://github.com/Supreeeme/xwayland-satellite)
|
- [Xwayland Satellite](https://github.com/Supreeeme/xwayland-satellite)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
spawn-at-startup "xwayland-satellite"
|
spawn-at-startup "xwayland-satellite"
|
||||||
spawn-at-startup "/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1"
|
|
||||||
spawn-sh-at-startup "systemctl --user start dms.service"
|
spawn-sh-at-startup "systemctl --user start dms.service"
|
||||||
|
|
||||||
hotkey-overlay {
|
hotkey-overlay {
|
||||||
|
|||||||
Generated
+45
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixgl": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1762090880,
|
||||||
|
"narHash": "sha256-fbRQzIGPkjZa83MowjbD2ALaJf9y6KMDdJBQMKFeY/8=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixGL",
|
||||||
|
"rev": "b6105297e6f0cd041670c3e8628394d4ee247ed5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixGL",
|
||||||
|
"rev": "b6105297e6f0cd041670c3e8628394d4ee247ed5",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1783224372,
|
||||||
|
"narHash": "sha256-8i/87eeoqiGE4yOTjwSA3Eh/ziJRQEmd/unYU+K27sk=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d407951447dcd00442e97087bf374aad70c04cea",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d407951447dcd00442e97087bf374aad70c04cea",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixgl": "nixgl",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
description = "64-bit nixGL wrapper for Niri Beyond Glass";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/d407951447dcd00442e97087bf374aad70c04cea";
|
||||||
|
nixgl = {
|
||||||
|
url = "github:nix-community/nixGL/b6105297e6f0cd041670c3e8628394d4ee247ed5";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { nixpkgs, nixgl, ... }:
|
||||||
|
let
|
||||||
|
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
|
||||||
|
in {
|
||||||
|
packages = forAllSystems (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
wrappers = import "${nixgl}/default.nix" {
|
||||||
|
inherit pkgs;
|
||||||
|
enable32bits = false;
|
||||||
|
enableIntelX86Extensions = system == "x86_64-linux";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
default = wrappers.auto.nixGLDefault;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ After=graphical-session.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
Environment=PATH=%h/.local/bin:%h/.local/state/niri-beyond-glass/nix-profile/bin:/usr/local/bin:/usr/bin:/bin
|
Environment=PATH=%h/.local/bin:%h/.local/state/niri-beyond-glass/nix-profile/bin:/usr/local/bin:/usr/bin:/bin
|
||||||
ExecStart=%h/.local/state/niri-beyond-glass/nix-profile/bin/dms run --session
|
ExecStart=%h/.local/state/niri-beyond-glass/nix-profile/bin/nixGL %h/.local/state/niri-beyond-glass/nix-profile/bin/dms run --session
|
||||||
ExecReload=/usr/bin/pkill -USR1 -x dms
|
ExecReload=/usr/bin/pkill -USR1 -x dms
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=1.23
|
RestartSec=1.23
|
||||||
|
|||||||
+34
-6
@@ -143,11 +143,16 @@ install_dms_runtime() {
|
|||||||
local profile="$state_home/$PROJECT/nix-profile"
|
local profile="$state_home/$PROJECT/nix-profile"
|
||||||
local dms_flake="github:AvengeMedia/DankMaterialShell/$DMS_REV"
|
local dms_flake="github:AvengeMedia/DankMaterialShell/$DMS_REV"
|
||||||
local nixpkgs="github:NixOS/nixpkgs/$NIXPKGS_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" &&
|
if [[ -x "$profile/bin/dms" && -x "$profile/bin/quickshell" &&
|
||||||
-x "$profile/bin/matugen" && -x "$profile/bin/dgop" &&
|
-x "$profile/bin/matugen" && -x "$profile/bin/dgop" &&
|
||||||
-x "$profile/bin/dsearch" ]]; then
|
-x "$profile/bin/dsearch" ]]; then
|
||||||
log "DMS 运行层已经安装,跳过"
|
core_ready=1
|
||||||
|
fi
|
||||||
|
if (( core_ready )) && [[ -x "$profile/bin/nixGL" ]]; then
|
||||||
|
log "DMS 图形运行层已经安装,跳过"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -163,6 +168,7 @@ install_dms_runtime() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local attempt
|
local attempt
|
||||||
|
if (( ! core_ready )); then
|
||||||
for attempt in 1 2 3 4 5; do
|
for attempt in 1 2 3 4 5; do
|
||||||
if sudo -u "$USER" -g nix-users env \
|
if sudo -u "$USER" -g nix-users env \
|
||||||
HOME="$HOME" USER="$USER" \
|
HOME="$HOME" USER="$USER" \
|
||||||
@@ -175,13 +181,33 @@ install_dms_runtime() {
|
|||||||
"$nixpkgs#dsearch"; then
|
"$nixpkgs#dsearch"; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
(( attempt < 5 )) || die "DMS 运行层安装失败,请检查网络后重新运行脚本。"
|
(( attempt < 5 )) ||
|
||||||
|
die "DMS 运行层安装失败,请检查网络后重新运行脚本。"
|
||||||
log "下载中断,正在重试($attempt/5)"
|
log "下载中断,正在重试($attempt/5)"
|
||||||
sleep 3
|
sleep 3
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
[[ -x "$profile/bin/dms" && -x "$profile/bin/quickshell" ]] ||
|
if [[ ! -x "$profile/bin/nixGL" ]]; then
|
||||||
die "DMS 或 Quickshell 安装不完整。"
|
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() {
|
install_rust() {
|
||||||
@@ -381,7 +407,7 @@ backup_and_install_config() {
|
|||||||
|
|
||||||
local profile="$state_home/$PROJECT/nix-profile"
|
local profile="$state_home/$PROJECT/nix-profile"
|
||||||
local binary
|
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
|
if [[ -x "$profile/bin/$binary" ]]; then
|
||||||
ln -sfn "$profile/bin/$binary" "$HOME/.local/bin/$binary"
|
ln -sfn "$profile/bin/$binary" "$HOME/.local/bin/$binary"
|
||||||
fi
|
fi
|
||||||
@@ -470,6 +496,7 @@ activate_dms() {
|
|||||||
log "当前没有可用的 systemd 用户会话;DMS 将在下次 Niri 登录时启动"
|
log "当前没有可用的 systemd 用户会话;DMS 将在下次 Niri 登录时启动"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
systemctl --user unset-environment QT_QUICK_BACKEND 2>/dev/null || true
|
||||||
systemctl --user enable dms.service
|
systemctl --user enable dms.service
|
||||||
|
|
||||||
"$profile/bin/dms" auth resolve-lock --quiet >/dev/null 2>&1 || true
|
"$profile/bin/dms" auth resolve-lock --quiet >/dev/null 2>&1 || true
|
||||||
@@ -500,7 +527,8 @@ main() {
|
|||||||
install_dms_runtime
|
install_dms_runtime
|
||||||
else
|
else
|
||||||
local profile="${XDG_STATE_HOME:-$HOME/.local/state}/$PROJECT/nix-profile"
|
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 需要先完成一次完整安装。"
|
die "--config-only 需要先完成一次完整安装。"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ rm -rf \
|
|||||||
rm -f "$config_home/systemd/user/dms.service"
|
rm -f "$config_home/systemd/user/dms.service"
|
||||||
rm -rf "$state_home/DankMaterialShell"
|
rm -rf "$state_home/DankMaterialShell"
|
||||||
|
|
||||||
for binary in dms quickshell qs matugen dgop dsearch; do
|
for binary in dms quickshell qs matugen dgop dsearch nixGL; do
|
||||||
link="$HOME/.local/bin/$binary"
|
link="$HOME/.local/bin/$binary"
|
||||||
if [[ -L "$link" && "$(readlink "$link")" == "$profile/"* ]]; then
|
if [[ -L "$link" && "$(readlink "$link")" == "$profile/"* ]]; then
|
||||||
rm -f "$link"
|
rm -f "$link"
|
||||||
|
|||||||
Reference in New Issue
Block a user