How to combine nixos-containers with flakes?

Hi! I would like to test simple-nixos-mailserver in a separate container. The mailserver comes with its own flake.nix so I would like to combine it with my system’s flake.nix but also I want to test the whole setup in a container first. I would expect the container expression to look like the following:

{ config, pkgs, simple-nixos-mailserver, ...}:
  require = [
  mailserver = {
    enable = true;

The idea worked with my main system where I can pass simple-nixos-maiserver argument from a top-level flake, but how to make it appear using the nixos-container create ... --config-file ... command? I can see that nixos-container has the --flake option, is it related?

1 Like