如何在 Nix 中组合两个列表?
How can I combine two lists in Nix?
我目前有一个列表定义为:
environment.systemPackages = with pkgs; [
acpi
ag
alacritty
audacity
awscli
bash
breeze-gtk
cabal-install
];
我将如何定义两个列表,然后合并它们以设置 environment.systemPackages
值?
我想拆分列表,以便更轻松地管理相关软件包组。
https://nixos.org/manual/nix/stable/expressions/language-operators.html
++
运算符:
nix-repl> [1 2 3] ++ [5 6]
[ 1 2 3 5 6 ]
代码示例:
let
unstable = import <unstable> {
config = config.nixpkgs.config;
};
examplePkgs = with pkgs; [
bash
];
in
{
environment.systemPackages = with pkgs; [
google-chrome
]
++ examplePkgs;
我目前有一个列表定义为:
environment.systemPackages = with pkgs; [
acpi
ag
alacritty
audacity
awscli
bash
breeze-gtk
cabal-install
];
我将如何定义两个列表,然后合并它们以设置 environment.systemPackages
值?
我想拆分列表,以便更轻松地管理相关软件包组。
https://nixos.org/manual/nix/stable/expressions/language-operators.html
++
运算符:
nix-repl> [1 2 3] ++ [5 6]
[ 1 2 3 5 6 ]
代码示例:
let
unstable = import <unstable> {
config = config.nixpkgs.config;
};
examplePkgs = with pkgs; [
bash
];
in
{
environment.systemPackages = with pkgs; [
google-chrome
]
++ examplePkgs;