我可以看到 NixOS 有这些版本可供安装:
...
nodejs-0.10-statsd-0.7.2
nodejs-0.10.42
nodejs-4.3.1
nodejs-5.9.0
...
然而 systemPackages 不喜欢我安装 nodejs-5.9.0
因为它提示说:
error: syntax error, unexpected INT, expecting ID or OR_KW or DOLLAR_CURLY or '"', at /etc/nixos/configuration.nix:49:14
(use ‘--show-trace’ to show detailed location information)
error: syntax error, unexpected INT, expecting ID or OR_KW or DOLLAR_CURLY or '"', at /etc/nixos/configuration.nix:49:14
(use ‘--show-trace’ to show detailed location information)
building the system configuration...
error: syntax error, unexpected INT, expecting ID or OR_KW or DOLLAR_CURLY or '"', at /etc/nixos/configuration.nix:49:14
(use ‘--show-trace’ to show detailed location information)
这表明我做错了什么。我宁愿不只是安装 nix-env -i ...
因为我希望在系统范围内使用它(并且我正在为我所有的开发机器构建我的标准 NixOS 配置)。
根据nixpkgs repository v6 可用,但我不知道如何判断 nixos-rebuild
通过 configuration.nix 或其他方式安装它。
如何正确配置它以便我可以安装最新版本的 NodeJS,或者特别是 5.9.0?
最佳答案
事实证明这是可能的,但我使用了错误的包名。如果您使用 nix-env -qaP | 查询grep nodejs
你从它的命名空间中获取名称:
$ nix-env -qaP | grep nodejs
nixos.statsd nodejs-0.10-statsd-0.7.2
nixos.nodejs-0_10 nodejs-0.10.42
nixos.nodejs nodejs-4.3.1
*nixos.nodejs-5_x nodejs-5.9.0*
nixos.azure-cli nodejs-azure-cli-0.9.15
nixos.dnschain nodejs-dnschain-0.5.3
nixos.groovebasin nodejs-groovebasin-1.5.1
nixos.keybase nodejs-keybase-0.8.25
nixos.npm2nix nodejs-npm2nix-5.12.0
nixos.pumpio nodejs-pump.io-git-2015-11-09
nixos.ripple-rest nodejs-ripple-rest-1.7.0-rc1
nixos.shout nodejs-shout-0.51.1
nixos.sloc nodejs-sloc-0.1.9
nixos.wring nodejs-wring-1.0.0
我特别想要 nodejs-5.9.0,这意味着我需要使用 nodejs-5_x
包,如上所述(强调我的)。
关于node.js - NixOS 安装特定的 NodeJS 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38436527/