Nixos
Nix 值不是“有符號整數的屬性集”類型
我正在嘗試設置:
networking.firewall.allowedTCPPortRanges = [ 80 81 5900];
但是我收到以下錯誤:
錯誤:選項值
networking.firewall.allowedTCPPortRanges.[definition 1-entry 1]' in
/etc/nixos/configuration.nix’ 不是“有符號整數的屬性集”類型。networking.firewall.allowedTCPPorts = mkOption { default = []; example = [ 22 80 ]; type = types.listOf types.int; description = '' List of TCP ports on which incoming connections are accepted. ''; };
我使用的語法有什麼問題?
中有兩個名稱相似的屬性
networking.firewall
:
- 允許的 TCP 埠
- allowedTCPPortRanges
前者是一個列表,因此 的值是
[80 81 5900]
可以接受的。但是,後者是一個定義如下的集合:allowedTCPPortRanges = mkOption { type = types.listOf (types.attrsOf types.int); default = [ ]; example = [ { from = 8999; to = 9003; } ]; description = '' A range of TCP ports on which incoming connections are accepted. ''; };