Including multiple types of packages in environment.systemPackages

Hello everyone,

I’m trying to put pip3 packages into environment.systemPackages array. I have it declared in this way:

environment.systemPackages = with pkgs; [
...
];

But i need python3 packages to occur in this list. It works if I add it this way:

environment.systemPackages = with pkgs; [
...
python38Packages.flask
];

But I do not want to write python38Packages every time I need to add a python package.
I want to include another with directive in the list, to omit writing python38Packages.

I need something similar to this:

environment.systemPackages = with pkgs; [
  ...
  with python38Packages; [
    flask
  ]
];

But that is syntactically incorrect. Could you please advice me a way to do so, against the Nix Expression Language syntax?

with pkgs; [ … ] ++ (with python38Packages; [ … ]) if you want to separate by source or with pkgs; with pythonPackages; [ … ] if you do not care.

Though “flask” is more of a library, I wouldn’t install it as a system package but only as a buildInputs in a shell.nix.