diff --git a/nixos/doc/manual/man-nixos-option.xml b/nixos/doc/manual/man-nixos-option.xml index f7a8ce403dc1..bd180363e70d 100644 --- a/nixos/doc/manual/man-nixos-option.xml +++ b/nixos/doc/manual/man-nixos-option.xml @@ -18,17 +18,12 @@ nixos-option - - - - + + + option.name - - nixos-option - - @@ -40,16 +35,7 @@ of the option name given as argument. By default, it returns the value of the option. When the option name is not an option, the command prints the list of -attributes in contained in the attribute set. This could used to provide -completion in some editors. - -When the option (or ) is -used with no option name, this command generates a template configuration -with a scan of the target system. It produces a template configuration -in /etc/nixos/configuration.nix, and a scan of the -machine in /etc/nixos/hardware-configuration.nix. The -scan of the machine is produced -by nixos-hardware-scan. +attributes contained in the attribute set. @@ -59,15 +45,6 @@ by nixos-hardware-scan. - - , - - Use the installation configuration instead of current system - configuration. Generate a template configuration if no option name is - specified. - - - , @@ -102,15 +79,6 @@ by nixos-hardware-scan. - - mountPoint - - Location of the target file system. Defaults to - /mnt. This environment variable is only used in - combinaison with option. - - - NIXOS_CONFIG diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index 58508560b8e4..e6d8eda016da 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -250,7 +250,7 @@ my $modulePackages = toNixExpr(removeDups @modulePackages); my $attrs = multiLineList(" ", removeDups @attrs); my $imports = multiLineList(" ", removeDups @imports); -my $fn = "$outDir/hardware.nix"; +my $fn = "$outDir/hardware-configuration.nix"; print STDERR "writing $fn...\n"; mkpath($outDir, 0, 0755); @@ -271,4 +271,100 @@ write_file($fn, <= 3.10 + boot.kernelPackages = pkgs.linuxPackages_3_10; +EOF + } else { + $bootLoaderConfig = < "$hardware_config" - fi - - if test -e "$NIXOS_CONFIG"; then - echo 1>&2 "error: Cannot generate a template configuration because a configuration file exists." - exit 1 - fi - - nl=" -" - if test -e /sys/firmware/efi/efivars; then - l1=" # Use the gummiboot efi boot loader." - l2=" boot.loader.grub.enable = false;" - l3=" boot.loader.gummiboot.enable = true;" - l4=" boot.loader.efi.canTouchEfiVariables = true;" - # !!! Remove me when nixos is on 3.10 or greater by default - l5=" # EFI booting requires kernel >= 3.10" - l6=" boot.kernelPackages = pkgs.linuxPackages_3_10;" - bootloader_config="$l1$nl$l2$nl$l3$nl$l4$nl$nl$l5$nl$l6" - else - l1=" # Use the Grub2 boot loader." - l2=" boot.loader.grub.enable = true;" - l3=" boot.loader.grub.version = 2;" - l4=" # Define on which hard drive you want to install Grub." - l5=' # boot.loader.grub.device = "/dev/sda";' - bootloader_config="$l1$nl$l2$nl$l3$nl$nl$l4$nl$l5" - fi - - echo "Generating a basic configuration file in $NIXOS_CONFIG..." - - # Generate a template configuration file where the user has to - # fill the gaps. - cat < "$NIXOS_CONFIG" -# Edit this configuration file to define what should be installed on -# the system. Help is available in the configuration.nix(5) man page -# or the NixOS manual available on virtual console 8 (Alt+F8). - -{ config, pkgs, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - boot.initrd.kernelModules = - [ # Specify all kernel modules that are necessary for mounting the root - # filesystem. - # "xfs" "ata_piix" - # fbcon # Uncomment this when EFI booting to see the console before the root partition is mounted - ]; - -$bootloader_config - - # networking.hostName = "nixos"; # Define your hostname. - # networking.wireless.enable = true; # Enables Wireless. - - # Add filesystem entries for each partition that you want to see - # mounted at boot time. This should include at least the root - # filesystem. - - # fileSystems."/".device = "/dev/disk/by-label/nixos"; - - # fileSystems."/data" = # where you want to mount the device - # { device = "/dev/sdb"; # the device - # fsType = "ext3"; # the type of the partition - # options = "data=journal"; - # }; - - # List swap partitions activated at boot time. - swapDevices = - [ # { device = "/dev/disk/by-label/swap"; } - ]; - - # Select internationalisation properties. - # i18n = { - # consoleFont = "lat9w-16"; - # consoleKeyMap = "us"; - # defaultLocale = "en_US.UTF-8"; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # Enable the X11 windowing system. - # services.xserver.enable = true; - # services.xserver.layout = "us"; - # services.xserver.xkbOptions = "eurosign:e"; - - # Enable the KDE Desktop Environment. - # services.xserver.displayManager.kdm.enable = true; - # services.xserver.desktopManager.kde4.enable = true; -} -EOF - - exit 0 -fi; - # This duplicates the work made below, but it is useful for processing # the output of nixos-option with other tools such as nixos-gui. if $xml; then