如何验证 nixos 中是否已安装特定软件包?

问题描述 投票:0回答:1

我刚刚将

grim
添加到
configuration.nix
中的系统包中并运行
sudo nixos-rebuild switch

现在我想验证它是否安装在我的系统上。

通常我会为此运行类似

grim --version
的东西。但这在 NixOS 上不起作用。

检查 NixOS 上是否安装了特定软件包的等效方法是什么?

nix
1个回答
0
投票
if test -x /run/current-system/sw/bin/grim; then
  echo "Grim is installed system-wide on this NixOS system" >&2
elif command -v grim >/dev/null 2>&1; then
  echo "Grim is available to the current user, but not installed system-wide" >&2
else
  echo "Grim is not available" >&2
fi
© www.soinside.com 2019 - 2024. All rights reserved.