Giter Club home page Giter Club logo

.nix's Introduction

目录结构

├── home              # home manager 配置信息
│  ├── core.nix       # 核心的通用配置,由其他配置引入
│  ├── desktop.nix    # 桌面环境配置
│  ├── server.nix     # 服务器配置
├── modules           # 通用模块,不同机器可以根据的需要引入
│  ├── home           # home manager 通用模块
│  │  └── -
│  └── nixos          # nixos 通用模块
├── overlays          # 安装包的修改配置
│  └── -
├── pkgs
│  └── -
├── profiles          # 不同机器的配置文件
│  ├── appolo         # 主服务器配置
│  ├── gaea           # 主用机配置
│  └── luna           # 虚拟机配置
├── secrets
│  └── _public_keys_
├── flake.lock
├── flake.nix         # nix flake 入口
├── nixos-install.sh  # nixos 全新安装脚本
└── flake.lock

如何安装?

  1. 准备一个 64 位的 nixos minimal iso image 烧录好,然后进入 live 系统。
  2. 分区

使用 fdisk 或 parted 工具进行分区。现在假设两个分区为:/dev/sda1 /dev/sda2

  1. 格式化分区
  mkfs.fat -F 32 /dev/sda1  # boot / EFI 分区
  mkfs.ext4 /dev/sda2       # 系统分区
  1. 挂载
  mount /dev/sda2 /mnt/nix
  mkdir -p /mnt/boot
  mount /dev/sda1 /mnt/boot
  1. 生成一个基本的配置
  nixos-generate-config --root /mnt
  1. 克隆仓库到本地
nix-shell -p git
git clone  https://github.com/synebula/.nix.git /mnt/.nix
cd /mnt/.nix/
nix develop --extra-experimental-features "nix-command flakes"
  1. 将 /mnt/etc/nixos 中的 hardware-configuration.nix 拷贝到 /mnt/.nix/profiles/<profile>/hardware-configuration.nix, 其中<profile>指需要的 profile。
cp /mnt/etc/nixos/hardware-configuration.nix /mnt/.nix/profiles/<profile>/hardware-configuration.nix
  1. 用户名修改: 编辑 /mnt/.nix/flake.nix 修改 username 变量。

  2. 使用 mkpasswd {PASSWORD} -m sha-512 命令生成的密码哈希串替换掉 /mnt/.nix/modules/nixos/user-group.nix 中的 users.users.<name>.hashedPassword 值替换掉。

  3. 安装

nixos-install --option substituters "https://mirrors.ustc.edu.cn/nix-channels/store https://cache.nixos.org" --no-root-passwd --flake .#<profile>

# 或者

./nixos-install <profile>
  1. 重启
reboot

日常更新系统脚本

./nixos-switch

.nix's People

Contributors

synebula avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.