Tutorial: github:gjz010/nix-channel#nixos-with-flake-init
gjz010
2024-03-28 3 min read
介绍 github:gjz010/nix-channel#nixos-with-flake-init:用 Flake 替代默认 configuration.nix 的 NixOS 安装方式,以及它默认提供的配置与安装步骤。
github:gjz010/nix-channel#nixos-with-flake-init upgrades nixos-generate-config by generating a Flake rather than just configuration.nix.
What is provided by default?
- NixOS installation as Flake output
nixosConfigurations. home-managerNixOS-Module support.- Several quality of life tweaks around Nix experience:
- Enabling Flake commands by default.
- Filling in
system.configurationRevision, enablingnixos-version --configuration-revision. - Unifying nixpkgs versions by Nix channel, by Flake registry, and the one used by current installation.
How to install NixOS using nixos-with-flake-init?
TL;DR: Follow the official tutorial but replace the nixos-generate-config line with:
# You may save your configurations elsewhere as long as they are presisted.
mkdir -p /mnt/etc/nixos
cd /mnt/etc/nixos
# Invoke nixos-with-flake-init here.
nix --experimental-features "nix-command flakes" run github:gjz010/nix-channel#nixos-with-flake-init
and replace the nixos-install line with:
# nixos-with-flake-init will require you to enter your hostname, say [YOUR_HOST_NAME].
nixos-install --flake .#[YOUR_HOST_NAME]
Additional notes
Source: https://github.com/gjz010/nix-channel/tree/main/pkgs/nixos-with-flake-init
gjz010的笔记 (gjz010) · 感谢您的用心卒读
如果这篇文章带给您一丝平静...
请为本篇文章摇一摇折扇,或者留下一纸感言
已至最古老的墨稿源头
下一篇随感gjz010/notes-public
本篇暂未开启远方笺札。茶室主人尚未为此文绑定 Mastodon 讨论串。