Video Summary3/9/2026

How to Use NixOS Flakes (2026 Edition) | Full Install Guide


NixOS Flakes (2026 Edition) | Full Install Guide - Tony


Summary


This video provides a comprehensive guide on installing and configuring NixOS with Flakes, emphasizing it as the modern, best-practice method for managing NixOS configurations and pinning package versions. It covers the entire installation process, from downloading the ISO to setting up Flakes, managing packages, version control, and replicating the setup on a new machine.


Key Takeaways


* **Flakes are the modern best practice for NixOS:** They offer improved reproducibility and version management for your system configuration and packages.

* **Flakes enable declarative package pinning:** You can specify exact commit hashes for Nixpkgs and other dependencies, ensuring your system's state remains consistent.

* **Configuration is managed centrally in `flake.nix`:** This file defines your system's inputs (like Nixpkgs) and outputs (like your NixOS configuration).

* **`flake.lock` pins specific versions of inputs:** Running `nix flake update` allows you to update these pinned versions.

* **Git is essential for Flake management:** Using a Git repository for your `flake.nix` makes it easy to manage changes, collaborate, and deploy to multiple machines.

* **Replicating a NixOS Flake setup is straightforward:** Cloning the Git repo and running `nixos-rebuild switch` on a new machine applies the entire configuration.


Detailed Notes


---


#### **I. Introduction and Setup (0:00 - 4:35)**


* **0:00 Intro:** Introduction to NixOS Flakes as the modern, best-practice way to manage configurations and pin package versions.

* **0:39 Download ISO:** Instructions on downloading the NixOS installer ISO.

* **1:12 Launch Live CD:** Booting from the downloaded ISO into the live environment.

* **1:20 NixOS Install Wizard:** The video walks through the standard NixOS installation wizard.

* *(Note: Specifics of the wizard are not detailed but implied to be the standard interactive installation.)*

* **3:14 Launch KDE Plasma:** Demonstrating the initial boot into the KDE Plasma desktop environment after installation.

* **4:35 Edit Config File:** Navigating to the primary NixOS configuration file (`/etc/nixos/configuration.nix`).


#### **II. Initial Customization and Package Management (4:35 - 7:33)**


* **4:54 Install Vim and Ghostty:**

* Installing common tools like Vim for text editing and Ghostty (a modern terminal emulator) using `nix-env -iA nixos.vim nixos.ghostty`.

* *(This is a temporary, non-Flake method, shown for initial setup convenience.)*

* **5:18 How To Search for Packages:**

* Using `nix-env -qaP <package_name>` to search for available packages.

* Example: `nix-env -qaP vim`

* **6:25 Rebuild NixOS:**

* Applying configuration changes with `sudo nixos-rebuild switch`.


#### **III. Enabling and Configuring Flakes (7:33 - 12:51)**


* **7:33 Change Hostname:**

* Demonstrates changing the system's hostname within `/etc/nixos/configuration.nix`.

* `networking.hostName = "nixos-flakebook";`

* **8:22 Enable Flakes:**

* Crucially, enabling the Flakes feature in Nix. This is done by adding the following to `/etc/nixos/configuration.nix`:

```nix

nix.settings.experimental-features = [ "nix-command" "flakes" ];

```

* **Rebuilding is required** after adding this setting: `sudo nixos-rebuild switch`.

* **8:39 Create First Flake:**

* **The core of Flakes:** Creating a new file, typically `~/flake.nix` (though it will be moved to `/etc/nixos/flake.nix` later for system-wide configuration).

* **Basic `flake.nix` structure:**

```nix

{

description = "My NixOS configuration";


inputs = {

# Pin Nixpkgs to a specific commit

nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

};


outputs = { self, nixpkgs }: {

# Define the NixOS configuration for this system

nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {

system = "x86_64-linux"; # or "aarch64-linux" etc.

modules = [

# Include your main system configuration file

./configuration.nix

# You can also include other modules here

];

};

};

}

```

* The `inputs` section specifies external dependencies. `nixpkgs.url` points to a Git repository and branch (or commit).

* The `outputs` section defines what the flake provides. `nixosConfigurations` is a common output for NixOS systems.

* **10:50 Generate `flake.lock` File:**

* After creating `flake.nix`, run `nix flake lock` (or `nix flake init` which also creates the lock file).

* This command analyzes the inputs and creates a `flake.lock` file.

* `flake.lock` records the *exact* commit hash for each input, ensuring reproducibility.

* **Crucially, `flake.lock` should be committed to version control.**

* **12:01 How To Update Packages:**

* To update the pinned versions of your inputs (e.g., to get newer packages from Nixpkgs), run: `nix flake update`.

* This updates the `flake.lock` file with newer commit hashes.

* After updating `flake.lock`, you need to rebuild your system to apply the changes: `sudo nixos-rebuild switch --flake .#nixos` (assuming you are in the directory containing `flake.nix`).


#### **IV. Advanced Usage and Deployment (12:51 - 17:31)**


* **12:51 Install More Programs:**

* Programs are now managed declaratively within the `flake.nix` or imported configuration files.

* Instead of `nix-env`, you modify the NixOS configuration modules referenced in `flake.nix`.

* Example: Add `programs.htop.enable = true;` to your `configuration.nix` module.

* Rebuild: `sudo nixos-rebuild switch --flake .#nixos`.

* **14:28 How To Version Control:**

* **The recommended approach:** Move your `flake.nix`, `flake.lock`, and all associated configuration files (like `configuration.nix`, `home.nix` if using Home Manager) into a Git repository.

* This allows you to track changes, revert to previous states, and easily deploy to multiple machines.

* The root of the Git repository becomes your flake's directory.

* **16:31 Create Git Repo:**

* Initialize a Git repository in your configuration directory (`git init`).

* Add all relevant files (`git add .`).

* Commit the initial state (`git commit -m "Initial NixOS Flake config"`).

* Push to a remote repository (GitHub, GitLab, etc.).

* **17:00 Clone Repo on New Machine:**

* On a new machine (after a basic NixOS installation), clone your Git repository: `git clone <your_repo_url>`.

* Navigate into the cloned directory.

* **17:31 Install Flake on New Machine:**

* Copy the cloned repository's contents to `/etc/nixos` (or a similar designated location managed by the flake).

* **Crucially, run the rebuild command pointing to the flake:**

```bash

# If your flake.nix is in /etc/nixos/

sudo nixos-rebuild switch --flake /etc/nixos#nixos

```

*(The `#nixos` part refers to the `nixosConfigurations.nixos` output defined in `flake.nix`.)*

* This command tells Nix to use the `flake.nix` in `/etc/nixos` to build and switch to the system configuration.


#### **V. Final Touches and Conclusion (19:24 - 19:35)**


* **19:24 Obligatory Neofetch:** Running `neofetch` to display system information, showcasing the setup.

* **19:35 Thanking Producer:** Concluding remarks and thanks.


---


**References:**

* NixOS Flakes Wiki: [https://wiki.nixos.org/wiki/Flakes](https://wiki.nixos.org/wiki/Flakes)

* MyNixos Documentation: [https://mynixos.com/](https://mynixos.com/)

* Ghostty: [https://ghostty.org/docs](https://ghostty.org/docs)

* Video Git Repo: [https://github.com/tonybanters/nixos-...](https://github.com/tonybanters/nixos-...)

Why this video matters

This video provides valuable insights into the topic. Our AI summary attempts to capture the core message, but for the full nuance and context, we highly recommend watching the original video from the creator.

Disclaimer: This content is an AI-generated summary of a public YouTube video. The views and opinions expressed in the original video belong to the content creator. YouTube Note is not affiliated with the video creator or YouTube.

This summary was generated by AI. Generate your own unique summary now.