Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ default `networking.hostName = "coder-box"` (set in `configuration.nix`).
Two community tools do the heavy lifting:

- [`disko`](https://github.com/nix-community/disko) declares partition layouts in Nix. `nixos/disko-standard.nix` is a single-disk UEFI layout (1 GB EFI / ZFS root pool; no on-disk swap — zram instead). `install.sh` picks the device at install time; the ZFS `networking.hostId` is derived in Nix from the hostname (sha256 substring), so each host gets a distinct id automatically. ZFS gives cheap on-demand snapshots (take one before a risky rebuild and roll back in seconds), zstd compression, and checksum/scrub integrity.
- [`nixos-facter`](https://github.com/nix-community/nixos-facter) writes a JSON hardware report (`facter.json`) that replaces `hardware-configuration.nix` on new hosts. The `nixos-facter-modules` module reads it to set kernel modules, microcode, GPU drivers, and so on.
- [`nixos-facter`](https://github.com/nix-community/nixos-facter) writes a JSON hardware report (`facter.json`) that replaces `hardware-configuration.nix` on new hosts. NixOS's built-in facter module (`hardware.facter`, shipped in nixpkgs) reads it to set kernel modules, microcode, GPU drivers, and so on.

## Installing on a new machine

Expand Down
2 changes: 1 addition & 1 deletion agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ sudo k3s kubectl describe pod -n coder-workspaces <pod-name>
```
/etc/nixos-repo/ # repo root (a Nix flake; sudo git required)
flake.nix # entry point: nixosConfigurations.<host> per machine
flake.lock # pinned nixpkgs / disko / nixos-facter-modules
flake.lock # pinned nixpkgs / disko
configuration.nix # shared NixOS config (edit here for services/packages)
local.nix.example # template for hosts/<host>/local.nix
nixos/
Expand Down
16 changes: 0 additions & 16 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
inputs.nixpkgs.follows = "nixpkgs";
};

# Hardware detection. `nixos-facter -o facter.json` on the target writes
# a JSON hardware report; nixos-facter-modules consumes it to set kernel
# modules, microcode, GPU drivers, etc. Replaces hardware-configuration.nix
# for common hardware.
nixos-facter-modules.url = "github:nix-community/nixos-facter-modules";

# One-stop formatter/linter runner. Drives nixfmt + statix + deadnix (Nix)
# and shfmt + shellcheck (shell) from a single config (./treefmt.nix), and
# exposes both `nix fmt` (apply) and a `nix flake check` formatting check
Expand All @@ -37,7 +31,6 @@
self,
nixpkgs,
disko,
nixos-facter-modules,
treefmt-nix,
...
}@inputs:
Expand Down Expand Up @@ -89,7 +82,12 @@
modules = [
./configuration.nix
disko.nixosModules.disko
nixos-facter-modules.nixosModules.facter
# nixos-facter's NixOS module ships in nixpkgs (hardware.facter.*)
# and is imported automatically, so no separate flake input is
# needed. Hosts point hardware.facter.reportPath at their
# facter.json to drive kernel modules, microcode, GPU drivers, etc.
# `nixos-facter -o facter.json` on the target generates the report;
# it replaces hardware-configuration.nix for common hardware.
(./hosts + "/${hostname}")
]
# Install hosts use their folder name as the hostname so
Expand Down
Loading