As the title suggests, I’d like to split the environment.systemPackages definition in my conguration.nix into multiple lists (i.e. shell scripts, python libraries, packages).
The comment above explains the problem with your code.
However, environment.systemPackagesalready has exactly the behaviour you want. If you write environment.systemPackages = [ vim ]; in one file, and environment.systemPackages = [ git ]; in another file, and import both files (e.g. put imports = [ ./vim.nix ./git.nix ] in your configuration.nix), then Nix will merge both definitions and install both Vim and Git. See the Modularity section of the NixOS manual for more details.
@phaeseeKe5Ee: makes totally sense. I don’t know how I missed it. I thought a curly bracket was needed in order to delimit the “in…” section of the expression.
@keysmashes: thanks for the suggestion! That is actually very helpful. I might be splitting my packages in multiple files to import them accordingly
@TLATER, thank you for the suggestion. Are there some beginner-friendly resources on builtin nix functions (such as mkMerge)? So far, I only know noogle.dev (which however seems more oriented towards experienced users).