···104 };
105 };
106107- config = {
0000000000000108 system.nixos-generate-config.configuration = mkDefault ''
109 # Edit this configuration file to define what should be installed on
110 # your system. Help is available in the configuration.nix(5) man page
···104 };
105 };
106107+ options.system.disableInstallerTools = mkOption {
108+ internal = true;
109+ type = types.bool;
110+ default = false;
111+ description = ''
112+ Disable nixos-rebuild, nixos-generate-config, nixos-installer
113+ and other NixOS tools. This is useful to shrink embedded,
114+ read-only systems which are not expected to be rebuild or
115+ reconfigure themselves. Use at your own risk!
116+ '';
117+ };
118+119+ config = lib.mkIf (!config.system.disableInstallerTools) {
120+121 system.nixos-generate-config.configuration = mkDefault ''
122 # Edit this configuration file to define what should be installed on
123 # your system. Help is available in the configuration.nix(5) man page