返回主页 和纸静读模式

Tutorial: github:gjz010/nix-channel#nixos-with-flake-init

作者 gjz010 头像
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-manager NixOS-Module support.
  • Several quality of life tweaks around Nix experience:
    • Enabling Flake commands by default.
    • Filling in system.configurationRevision, enabling nixos-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) · 感谢您的用心卒读

如果这篇文章带给您一丝平静...

请为本篇文章摇一摇折扇,或者留下一纸感言

如果这篇文章带给您一丝平静...

把这一页递给另一位读者,或替自己留下一段地址。

本页链接
https://www.gjz010.com/posts/nixos/nixos-with-flake-init-tutorial/

点按链接框,即可完整选中这一页的地址。

通过邮件分享
已至最古老的墨稿源头
下一篇随感gjz010/notes-public

茶客沙龙 · 远方来笺

本篇暂未开启远方笺札。茶室主人尚未为此文绑定 Mastodon 讨论串。