How to compactly specify a list of NixOS wallpapers that I want installed?

In this previous post, I was informed that I need to include nixos-artwork.wallpapers.<name> (where name specifies a specific wallpaper I want) in my list of packages in /etc/nixos/configuration.nix to get NixOS artwork official wallpapers in /run/current-system/sw/share/backgrounds/nixos. I was wondering, however, is there a nice compact way to include all the wallpapers I want in configuration.nix? I currently have this under my environment.systemPackages = with pkgs; [ line in configuration.nix:

nixos-artwork.wallpapers = [
		binary-black # this is where I was hoping to specify the wallpapers I want in a list
	]

but, unfortunately, rebuilding my system with this in my configuration gives this error:

error:
       … while evaluating the attribute 'config'
         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:12284:
       … while calling the 'seq' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:12293:
       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: syntax error, unexpected '='
       at /etc/nixos/configuration.nix:132:34:
          131|  xclip
          132|         nixos-artwork.wallpapers = [
             |                                  ^
          133|              binary-black

So I was hoping is there a way to compactly list all the wallpapers I want? Or do I need to add nixos-artwork.wallpapers.<name> to my system packages array for each wallpaper I want?

environment.systemPackages = (with pkgs; [ ... ]) ++ (with pkgs.nixos-artwork.wallpapers; [ binary-black ... ]);

Replace the ... bits.

1 Like

Ive been tryna figure this out for a while and have not found an answer that satisfied me. I see you all the time here so can you explain exactly how the:

++ (with pkgs.nixos-artwork.wallpapers; [ binary-black ... ]);

is functionally different than just including the packages in question as system/user installed packages, i understand some that they are included as dependency for another package but i dont totally understand it.

specifically the ++(with …) statement, what exactly does the ++ operator do in this context?
When use it and why?

Interesting query. I think your answer to this question, waffle8946, could help me too.

It’s just list concatenation.

https://nix.dev/manual/nix/2.24/language/operators

They all end up in environment.systemPackages, they’re not dependencies of anything (other than system-path which is a dependency of the system closure).

Interesting. Thank you for the link and the answer, ima start reading.