Home Explore Blog CI



nixpkgs

6th chunk of `nixos/doc/manual/installation/installing.chapter.md`
ae1b5037156cc6bc04003a5c7af6cf43027898c30fac29010000000100000ebb
        option can be set to `true` to automatically add them to the grub
        menu.

    UEFI systems

    :   You must select a boot-loader, either systemd-boot or GRUB. The recommended
        option is systemd-boot: set the option [](#opt-boot.loader.systemd-boot.enable)
        to `true`. `nixos-generate-config` should do this automatically
        for new configurations when booted in UEFI mode.

        You may want to look at the options starting with
        [`boot.loader.efi`](#opt-boot.loader.efi.canTouchEfiVariables) and
        [`boot.loader.systemd-boot`](#opt-boot.loader.systemd-boot.enable)
        as well.

        If you want to use GRUB, set [](#opt-boot.loader.grub.device) to `nodev` and
        [](#opt-boot.loader.grub.efiSupport) to `true`.

        With systemd-boot, you should not need any special configuration to detect
        other installed systems. With GRUB, set [](#opt-boot.loader.grub.useOSProber)
        to `true`, but this will only detect windows partitions, not other Linux
        distributions. If you dual boot another Linux distribution, use systemd-boot
        instead.

    If you need to configure networking for your machine the
    configuration options are described in [](#sec-networking). In
    particular, while wifi is supported on the installation image, it is
    not enabled by default in the configuration generated by
    `nixos-generate-config`.

    Another critical option is `fileSystems`, specifying the file
    systems that need to be mounted by NixOS. However, you typically
    don't need to set it yourself, because `nixos-generate-config` sets
    it automatically in `/mnt/etc/nixos/hardware-configuration.nix` from
    your currently mounted file systems. (The configuration file
    `hardware-configuration.nix` is included from `configuration.nix`
    and will be overwritten by future invocations of
    `nixos-generate-config`; thus, you generally should not modify it.)
    Additionally, you may want to look at [Hardware configuration for
    known-hardware](https://github.com/NixOS/nixos-hardware) at this
    point or after installation.

    ::: {.note}
    Depending on your hardware configuration or type of file system, you
    may need to set the option `boot.initrd.kernelModules` to include
    the kernel modules that are necessary for mounting the root file
    system, otherwise the installed system will not be able to boot. (If
    this happens, boot from the installation media again, mount the
    target file system on `/mnt`, fix `/mnt/etc/nixos/configuration.nix`
    and rerun `nixos-install`.) In most cases, `nixos-generate-config`
    will figure out the required modules.
    :::

5.  Do the installation:

    ```ShellSession
    # nixos-install
    ```

    This will install your system based on the configuration you
    provided. If anything fails due to a configuration problem or any
    other issue (such as a network outage while downloading binaries
    from the NixOS binary cache), you can re-run `nixos-install` after
    fixing your `configuration.nix`.

    If you opted for a flake-based configuration, you will need to pass the
    `--flake` here as well and specify the name of the configuration as used in
    the `flake.nix` file. For the default generated flake, this is `nixos`.

    ```ShellSession
    # nixos-install --flake 'path/to/flake.nix#nixos'
    ```

    As the last step, `nixos-install` will ask you to set the password
    for the `root` user, e.g.

    ```plain
    setting root password...
    New password: ***
    Retype new password: ***
    ```

    If you have a user account declared in your `configuration.nix` and plan to log in using this user, set a password before rebooting, e.g. for the `alice` user:

Title: NixOS Installation: Bootloader Configuration, Networking, and Installation Execution
Summary
This section elaborates on configuring the bootloader for UEFI systems, recommending systemd-boot over GRUB and detailing specific GRUB settings for detecting other OSes. It highlights the importance of configuring networking and file systems, noting that `nixos-generate-config` automatically sets `fileSystems` in `/mnt/etc/nixos/hardware-configuration.nix`. It also mentions the necessity of setting `boot.initrd.kernelModules` for certain hardware configurations. Finally, it describes the execution of the `nixos-install` command, including instructions for flake-based configurations, and the process of setting the root password.