如何让 nixpkgs 更快地更新
NixOS 的声明式安装 pkgs 确实很爽,但是随之而来的问题是 pkgs 的更新会比较慢,在 Repology 可以看到1,即使是 nixpkgs-unstable 的更新百分比也只有 87.71%,远低于 Homebrew 的 94%。
Continue Reading »
NixOS 的声明式安装 pkgs 确实很爽,但是随之而来的问题是 pkgs 的更新会比较慢,在 Repology 可以看到1,即使是 nixpkgs-unstable 的更新百分比也只有 87.71%,远低于 Homebrew 的 94%。
Continue Reading »GPT5 API 中默认不使用 markdown 格式化,官方建议居然是手动更新 prompts1:
1- Use Markdown **only where semantically correct** (e.g., `inline code`, ```code fences```, lists, tables).
2- When using markdown in assistant messages, use backticks to format file, directory, function, and class names. Use \( and \) for inline math, \[ and \] for block math.
当 NixOS 配置好了 flake、home-manager 等等,后续的更新我们只需要运行:
1❯ nix flake update
2
3❯ sudo nixos-rebuild switch
4building the system configuration...
5activating the configuration...
6setting up /etc...
7reloading user units for davinci42...
8restarting sysinit-reactivation.target
9the following new units were started: NetworkManager-dispatcher.service
10Done. The new configuration is /nix/store/mp17nhbadmffs9ah961ldj0y1l38a73m-nixos-system-azure-25.05.20250424.f771eb4
除了 kernel 的更新需要重启,某些环境变量需要新开 session 之外,其它 pkg 和对应的 systemd-service 应该都是最新的状态了。
Continue Reading »
The Age of AI 是 Eric Schmidt 于 24 年 4 月在斯坦福做的一期访谈,有意思的是官方在 8 月把视频上传到 YouTube 之后不久就被下架了。
Continue Reading »
花了 3 天时间刷完了 LeetCode 751,然而 Top Interview 1502 却花了足足 2 周,链表是 Rust 里永远的神,古人诚不我欺。
算是给 The Rust Programming Language 的期末大作业吧。
Continue Reading »Brown University 版本的 The Rust Programming Language 教程中,Generic 这一章节末尾提出了一个非常棒的 Quiz1。
假如某个 library 定义了如下 function 而我们不知道具体实现是什么:
1fn mystery<T>(x: T) -> T {
2 // ????
3}
当我们在代码中如此调用时,当然可以确定 foo 的类型,但是能确定值吗?
1let foo = mystery(42);
令人意外的是,foo 的值是唯一的。
Claude Sonnet 老师也在恍然大悟后直言「这正是理解 Rust 泛型系统的关键点之一」。