A way more complete and documented version of this can be found at MatthiasBenaets/nixos-config, who inspired this setup.
Applying the configuration of a host:
sudo nixos-rebuild switch --flake .
Applying the home-manager config for a user:
home-manager switch --flake .
The structure is split up into a host-independent part and a host-specific part. Containers are not handled by Nix, but simply linked to ~/containers and then invoked with docker-compose.
.
├── home
│ ├── config.nix # general config
│ ├── default.nix
│ ├── myHost.nix # host specific config
│ └── home # dotfiles and modules
├── nixos # NixOS configuration
│ ├── myHost # host specific config
│ ├── configuration.nix # general config
│ ├── default.nix
│ └── otherHost # host specific config
└── README.md