我目前有一个定义为的列表:
environment.systemPackages = with pkgs; [
acpi
ag
alacritty
audacity
awscli
bash
breeze-gtk
cabal-install
];
如何定义两个列表,然后合并它们以设置environment.systemPackages
值?
我想拆分列表,以便更轻松地管理相关软件包的组。
答案 0 :(得分:6)
https://nixos.org/nix/manual/#sec-language-operators
++
运算符:
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;