You need to set nix.package in configuration.nix:
nix = {
package = pkgs.nixFlakes;
extraOptions = lib.optionalString (config.nix.package == pkgs.nixFlakes)
"experimental-features = nix-command flakes";
};
The fragment above should be adjusted to check for the nix version instead as of 2022-07.