-
NixOS 与 Flakes 阅读笔记 - Nixpkgs Module 系统
Tuesday, April 30, 2024
Nixpkgs Module 结构的简单介绍 e.g. for a simple Nixpkgs Module: {lib, config, options, pkgs, ...}: { imports = [ # ...... # ./xxx.nix ]; for.bar.enable = true; # other options declarations # ... } args lib: nixpkgs fuctions lib config: the set of current env options options: the set of current env defined options pkgs: the set of entire nixpkgs default: nixpkgs.legacyPackages."${system}" can be defined…
-
NixOS 与 Flakes 阅读笔记 - 安装使用 Home Manager
Tuesday, April 30, 2024
将 home manager 作为 NixOS 模块安装。
-
NixOS 与 Flakes 阅读笔记 - flakes.nix 配置详解
Tuesday, April 30, 2024
flake inputs inputs 是一个 attribute set, 在其中定义这个 flake 的依赖项, 在拉取后传递给 outputs 函数. { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; }; outputs = { self, nixpkgs, ... }@inputs: {}; } github:owner/name/reference 其中 reference 可为分支名称, commit-id, tag. flake outputs outputs = { self, nixpkgs, ……
-
NixOS 与 Flakes 阅读笔记 - 用 Flakes 管理 NixOS
Monday, April 29, 2024
启用 Flakes 支持 file: ``/etc/nixos/configuration.nix` { config, pkgs, ... }: { nix.settings.experimental-features = [ "nix-command" "flakes" ]; } 系统配置切换到 flake.nix nix flake show templates nix flake init -t templates#full cat flake.nix file: /etc/nixos/flake.nix { description = "A simple NixOS flake"; inputs = { # NixOS 官方软件源,这里使用 nixos-23.11 分支 nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; };…
-
NixOS 与 Flakes 阅读笔记 - Flakes 简介
Monday, April 29, 2024
作用:引入了一种管理 Nix 表达式之间的依赖关系的策略, 提高了 Nix 生态系统中的可复现性、可组合性和可用性。 flake.nix flake.lock nix-command Flakes 依赖 nix-command(New CLI). nix-channel -> 在flake.nix 中…
-
NixOS 与 Flakes 阅读笔记 - Nix 与 NixOS 简介
Monday, April 29, 2024
Nix 包管理器 OS as Code: 声明 - 状态 - 构建 hame-manager: Home 目录 Why NixOS? 回滚,可复现,同步管理。 优缺点 优点: OS as Code flake.lock 系统自定义能力 可回滚 依赖冲突(多版本共存) 社区活跃 缺…
-
NixOS 与 Flakes 阅读笔记 - 使用
Monday, April 29, 2024
配置:/etc/nixos/configuration.nix 部署:sudo nixos-rebuild switch 出错:sudo nixos-rebuild --show-trace --print-build-logs --verbose
-
NixOS 与 Flakes 阅读笔记 - 前言
Monday, April 29, 2024
文档与 Flakes Nix 包管理器,Flakes 特性。
-
NixOS Manual Reading Notes - Development
Monday, April 29, 2024
This chapter describes how you can modify and extend NixOS. Getting the Sources # /run/current-system/bin/switch-to-configuration boot # nixos-rebuild switch --rollback
-
NixOS Manual Reading Notes - Administration
Monday, April 29, 2024
Rolling Back # /run/current-system/bin/switch-to-configuration boot # nixos-rebuild switch --rollback Nix Store Corruption # nixos-rebuild switch --repair # nix-store --verify --check-contents --repair Alternative Binary Caches Disable: nixos-rebiuld switch --option use-binary-caches false Change: nixos-rebiuld switch --option binary-caches http://my-cache.example.org/