【发布时间】:2021-05-09 07:56:49
【问题描述】:
我想编写我的 nixos-configuration 和 home-manager-configuration 文件,使其在 NixOs (linux) 和 MacOs (darwin) 上都可以工作。
虽然有些东西在两个系统(例如 git)上的配置方式相同,但其他只在其中一个系统上有意义(比如 wayland-windowmanagers 只是 linux 上的一个东西)。
Nix 语言功能 if-else-statements,所以现在我需要的只是找出我使用的是哪种系统的方法。
我所追求的是这样的:
wayland.sway.enable = if (os == "MacOs") then false else true;
有没有办法找出我在 nix 中使用的系统?
【问题讨论】:
标签: nix