build: 添加 Nix flake 支持 - #151
Conversation
|
Hello i have failed to reproduce this on my system NIxOS 26.05 x86-linux 你好,我无法在我的 NixOS 26.05 x86-linux 系统上复现此构建。 |
|
NixOS用户如果想现在用的话可以尝试https://github.com/ccicnce113424/nix-packages ,可以作为flake,也可以从nur里面拉 |
aef527b to
33857ed
Compare
|
坏了,被抢先了() |
1aed849 to
a11564a
Compare
|
这个 flake 已根据 @ccicnce113424 的工作进行了调整。即使他们在 nixpkgs 中的 PR 最终被合并,我仍希望保留这个 flake,作为一种为 Nix 打包项目最新 commit 的方式。 @MasterZack69 报告的问题应该也已经解决了,因为之前用于处理 bindgen 的临时 workaround 已经被正确的解决方案所替代。目前正在等待他确认问题是否已经修复。 The flake has been updated to build on the good work by @ccicnce113424. Even if their PR in nixpkgs gets merged, If possible, I’d still like to keep this flake as a way to package the latest commit of the project for Nix. The issue reported by @MasterZack69 should also be resolved, as the previous hacky workaround for bindgen has been replaced with the proper solution. I’m waiting for him to confirm that the issue is fixed. |
|
除非能够自动从Cargo.lock和pnpm-lock.yaml中自动获得依赖,否则只要发生依赖变动,旧的FOD hash就会失效。如果不能实现这两点,只会增加麻烦。 |
我用新的 flake.nix 编译了,但问题依然存在,还是报一样的错。 |
4f5b8ee to
5518b90
Compare
Cargo.lock 从来都不是问题,因为这里使用的是 |
|
使用FOD的情况下,如果每次更新依赖都需要更新者自行修改hash,对于本来不使用nix的用户来说是额外劳动;如果不要求更新者自行修改,那么即使有自动化修改,合并自动化产生的PR也是一种负担。 |
|
看起来我这边无法正常播放封装在 m4a 容器里的 ALAC 文件(我手头没有原生 alac 容器的文件来测试,而且我也懒得手动去转封装了)。 在正式版本发布之前,我自己从源码编译 splayer-next 时这些文件是可以正常播放的。 我怀疑可能是 Flake 相关的问题,所以发在这里反馈一下(我还没试过官方正式发布的版本)。 english: |
|
我已在 @ccicnce113424 提供的软件包中复现了相同的问题。 english: i have been able to reproduce the same decoding issue in @ccicnce113424's package |
|
I have tested the x86-64 Appimage from splayer-next's official github release and I can confirm that this issue is not there 我测试了 splayer-next 官方 GitHub Release 的 x86_64 AppImage,可以确认这里面没有这个问题。 |
|
@MasterZack69 我仍然认为,在nixpkgs中,应该避免使用附带的ffmpeg。至于这个flake,我觉得无所谓。 |
备选方案则是发布一个损坏的包(package),这样它就无法与我的离线音乐库正常配合使用了。 |
|
疑似是FFMPEG_MODE=system配置下的ffmpeg给链接到chromium自带的那个版本里去了。我曾经有一个解决方案可能能解决这个问题。具体地说是那一堆LD_PRELOAD |
| --add-flags $out/share/splayer-next/resources/app.asar \ | ||
| --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true --wayland-text-input-version=3}}" \ | ||
| --set-default ELECTRON_FORCE_IS_PACKAGED 1 \ | ||
| --set-default ELECTRON_IS_DEV 0 \ |
There was a problem hiding this comment.
经测试,在此处加入
--prefix LD_PRELOAD : "${pkgs.ffmpeg-headless.lib}/lib/libavformat.so" \
--prefix LD_PRELOAD : "${pkgs.ffmpeg-headless.lib}/lib/libavcodec.so" \
--prefix LD_PRELOAD : "${pkgs.ffmpeg-headless.lib}/lib/libavutil.so" \
--prefix LD_PRELOAD : "${pkgs.ffmpeg-headless.lib}/lib/libswresample.so" \
可以解决问题。这可能不是最优雅的解决方案。
这样做的原因在于Electron自己也带着一个ffmpeg(阉割版的),如果只是设置FFMPEG_MODE=system那么编译出的原生模块会链接到Electron自带的那个,因此这里要手动加载nixpkgs版的ffmpeg才能得到完整功能
There was a problem hiding this comment.
添加LD_LIBRARY_PATH可以解决这个问题吗?我现在不知道怎么用splayer打开外部的媒体文件。 不行
9580e4d to
42ee1c5
Compare
|
如果这个pr还在跟进的话,以下是一些可能需要的更新: 61d19d3 加入了 deb8336 加入了一个对 |
42ee1c5 to
a9b6634
Compare
refactor: 从 package.json 获取 flake 的包版本 fix: 在 flake 中修正 desktop 文件的 icon 属性。 fix: 删除 `prebuilds/` 目录以强制重新构建。 fix: 在包装器中设置 LD_PRELOAD 前缀,以加载正确的 FFmpeg 库 fix: 修补 fingerprinting.ts 中的资源路径并添加 PulseAudio 依赖
a9b6634 to
89999ac
Compare
|
在最新的提交之后,ALAC 解码问题已经解决了 |
改动类型
是否包含破坏性变更
改动说明
这个 flake 基于 nixpkgs 中现有的 SPlayer 打包方案。
这个 PR 添加了一个用于打包该应用的 Nix flake,使 Nix 用户能够轻松地在自己的 flake 中引用并构建该应用。
此外,这个 PR 还更新了这是我的误解,lockfile 已恢复到之前的版本。pnpm-lock.yaml,因为fetchPnpmDeps要求使用最新的 lockfile,否则 flake 将无法构建。fetchPnpmDeps还要求提供依赖关系图的哈希值,这意味着每当依赖关系图发生变化时,都需要相应更新 flake。因此,我愿意在依赖关系发生变化导致 flake 失效时负责更新它。测试情况
这个 flake 已在 NixOS 26.11.20260801.148bab9(Zokor)x86-64 Linux 上进行了测试。构建成功生成了应用程序,包括可执行文件、桌面文件、图标以及其他所需资源。生成的可执行文件能够正常启动 SPlayer-Next,在测试期间未遇到任何崩溃。
自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.tsdev分支提交免责声明
我不懂中文,因此需要使用 LLM 帮助我翻译 PR 模板。我先用英文回答了模板中的问题,然后使用 LLM 将其翻译成中文。由于我无法核实翻译的准确性,因此我同时附上了英文原文和中文翻译,以便他人可以独立核实我所提供的信息。
Disclaimer
I do not understand Chinese, so I had to use an LLM to translate the PR template. I wrote my responses to the questions in English and then used an LLM to translate them into Chinese. Since I am unable to verify the accuracy of the translation, I am including the English text alongside the Chinese translation so that the information I provided can be independently verified.
Change Type
Does this include breaking changes?
Description
This flake is based on the existing SPlayer packaging recipe in nixpkgs.
This PR adds a Nix flake that packages the application, allowing Nix users to easily include and build it in their own flakes.
This PR also updatesThis was a misconception on my part, lockfile was restored to its previous version.pnpm-lock.yaml, asfetchPnpmDepsrequires an up-to-date lockfile and the flake fails to build without it.fetchPnpmDepsalso requires a hash of the dependency graph, meaning the flake will need to be updated whenever the dependency graph changes. Therefore, I volunteer to update the flake whenever this happens.Testing
The flake was tested on NixOS 26.11.20260801.148bab9 (Zokor) on x86-64 Linux. It successfully builds the application, including the executable, desktop entry, icons, and other required resources. The resulting executable launches SPlayer-Next successfully, and I have not encountered any crashes during my testing.
Checklist
pnpm formatand confirmed thatpnpm typecheckandpnpm lintpasspnpm build:native; I have not manually writtennative/*/index.d.tsdevbranch