Nix 桌面文件

cra*_*010 8 .desktop nix

当我使用 nix 安装 GUI 应用程序时,我看到桌面文件在~/.nix-profile目录中结束,例如:

~/.nix-profile/share/applications/firefox.desktop

但是,我的桌面希望文件在其中/user/share/applications,以便能够为它们创建桌面图标。

有什么方法可以告诉 nix 将桌面文件符号链接到,/user/share/applications这样我就不必手动执行了吗?

谢谢

Zim*_*i48 15

假设您使用的是 NixOS 以外的发行版,那么是的,您可以期望您的桌面环境在其中查找您的应用程序,/usr/share/applications而那些安装了 Nix 的应用程序实际上在~/.nix-profile/share/applications.

与其从/usr/share/applications您那里创建符号链接,不如告诉您桌面在哪里查看。您应该能够通过将以下内容添加到您的~/.profile:

export XDG_DATA_DIRS=$HOME/.nix-profile/share:$HOME/.share:"${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}"
Run Code Online (Sandbox Code Playgroud)

因此,您的桌面将在/usr/share/applications和 中寻找应用程序~/.nix-profile/share/applications,优先考虑与 Nix 一起安装的应用程序。

有关更多信息,请访问 https://nixos.org/wiki/KDE#Using_KDE_outside_NixOS

  • 您的简化命令对应于我原来的答案。对于“$XDG_DATA_DIRS”不存在的情况,编辑器刚刚使该命令更加防故障。我不知道为什么 `$HOME/.share` 被添加到列表中。 (2认同)
  • `$HOME/.share` 不应该是 `$HOME/.local/share` 吗? (2认同)