Skip to content

Commit 1dde336

Browse files
committed
feat!: adopt Lix as default Nix daemon
Introduce Lix and make the shared configuration default to the upstream source-build path while still allowing consumers to opt out via `repo.lix.enable = false`. Add flake input wiring for `lix` and `lix-module`, export the upstream default nixos and darwin modules, and apply the upstream source-build overlay during nixpkgs imports when Lix is enabled. Update the standalone Home Manager `nix.package` fallback so enabling Lix does not get overridden back to `pkgs.nix`, and regenerate `flake.nix` and `flake.lock` to capture the new inputs. Refresh the README to document a Lix-first bootstrap flow for darwin and standalone Home Manager hosts, fix the concrete installer invocation, and tighten the domain-joined machine guidance around the known `sssd`/`nscd` workaround. Strengthen repo and agent guidance to require staging new Nix files before validation, since untracked files are ignored by flake evaluation and can lead to misleading test results. Add a temporary `just rebuild` workaround that appends `extra-deprecated-features = broken-string-indentation` to `NIX_CONFIG` so upstream zen-browser-flake warnings stay out of local rebuild output until 0xc000022070/zen-browser-flake#268 lands. BREAKING CHANGE: Lix is now the default daemon and package-manager wiring for this repo's shared configuration surface. Consumers that need the previous behavior must opt out explicitly with `repo.lix.enable = false`.
1 parent 4a61a55 commit 1dde336

10 files changed

Lines changed: 186 additions & 32 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runner: macos-latest
2222
steps:
2323
- uses: actions/checkout@v6
24-
- uses: cachix/install-nix-action@v31
24+
- uses: samueldr/lix-gha-installer-action@v2026-02-22
2525
with:
2626
github_access_token: ${{ secrets.GITHUB_TOKEN }}
2727
- uses: nix-community/cache-nix-action@v7

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Use the Nix MCP first for Nix package, option, flake-input, and cache lookups be
8989
- Make the smallest correct change.
9090
- Prefer editing files under `modules/` and future `profiles/` trees over generated outputs.
9191
- If a change affects generated flake output, regenerate `flake.nix` rather than hand-editing it.
92-
- For any new file that must be evaluated by Nix, ensure it is tracked by git before relying on `nix` commands for validation; untracked files are ignored by flake evaluation.
92+
- For any new file that must be evaluated by Nix, stage it with git before relying on `nix` commands for validation; untracked files are ignored by flake evaluation, and staged files are the safest default for accurate testing.
9393
- Prefer exposing maintained operational commands via `nix run .#<name>` or `nix build .#<name>` instead of telling users to run repository-local shell scripts directly.
9494
- Prefer introducing or consuming profiles instead of expanding repeated host import lists.
9595
- Prefer mapping `hostFacts.roles` to existing profiles in `modules/roles/defaults.nix` rather than making hosts import repeated role bundles directly.
@@ -99,6 +99,7 @@ Use the Nix MCP first for Nix package, option, flake-input, and cache lookups be
9999
## Verification
100100

101101
- For configuration changes, prefer the narrowest useful validation first.
102+
- Before running validation for changes that add new Nix files or change generated flake inputs, stage the relevant new files first so evaluation sees the intended source tree.
102103
- Use `nix flake check` when it meaningfully covers the change.
103104
- Use `just rebuild` for local apply flows across nix-darwin, NixOS, and standalone Home Manager.
104105
- On macOS bootstrap flows, preserving `NIX_CONFIG` may be required until managed Nix settings are active.

README.md

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,47 +24,61 @@ Reusable Nix library plus public live host configurations for NixOS, standalone
2424

2525
### Prerequisites
2626

27-
Install a standard multi-user Nix daemon. For nix-darwin hosts, prefer the standard Nix installer over Determinate if you want nix-darwin to manage the Nix installation.
27+
For darwin and standalone Home Manager hosts, install a multi-user Nix daemon
28+
manually to bootstrap the configuration. The recommended happy path is
29+
[Lix](https://lix.systems/), which enables the required defaults out of the box.
2830

29-
On Arch Linux: `sudo pacman -S nix`
31+
Our configuration relies on `flakes` and `nix-command`.
3032

31-
For other distros:
33+
`trusted-users` should also cover your user directly or via an admin group,
34+
especially for standalone Home Manager hosts where daemon settings are not
35+
managed declaratively post-bootstrap.
3236

3337
```sh
34-
sudo install -d -m755 -o $(id -u) -g $(id -g) /nix
35-
curl -L https://nixos.org/nix/install | sh
36-
sudo systemctl enable --now nix-daemon
38+
$ LIX_INSTALLER="$(mktemp)"
39+
$ curl --proto 'https' --tlsv1.2 -fsSLo "$LIX_INSTALLER" https://install.lix.systems/lix
40+
$ less "$LIX_INSTALLER" # inspect the installer to make sure it looks correct
41+
$ sh "$LIX_INSTALLER" install \
42+
--extra-conf 'trusted-users = root @wheel @sudo'
43+
$ rm -vf "$LIX_INSTALLER"
3744
```
3845

39-
If running on a domain-joined machine, you may need to install `nscd`.
46+
#### Domain-joined machines
4047

41-
Ensure the user is in the `trusted-users` list to prevent annoying warnings:
48+
If running on a domain-joined Linux machine, apps may have issues with UID,
49+
group, or host lookups. This is usually because `sssd` provides that
50+
functionality through NSS plugins configured in `/etc/nsswitch.conf`, and
51+
Nix-built glibc binaries on non-NixOS systems often cannot use the host NSS
52+
plugins directly.
4253

43-
```sh
44-
echo "trusted-users = $(whoami)" | sudo tee -a /etc/nix/nix.conf
45-
sudo systemctl restart nix-daemon
46-
```
47-
48-
### Bootstrap note
49-
50-
If you are bootstrapping on a machine where `nix` does not yet have flakes enabled, run commands with:
54+
Installing `nscd` via the host package manager is a known workaround here and
55+
has worked reliably on a few machines. Nix's libc will check for
56+
`/var/run/nscd/socket`, so an `nscd`-compatible daemon can bridge those
57+
lookups without requiring Nix-built binaries to load the host NSS plugins
58+
themselves.
5159

52-
```sh
53-
NIX_CONFIG='experimental-features = nix-command flakes'
54-
```
60+
This is still suboptimal: upstream SSSD documentation advises against running
61+
`nscd` alongside `sssd` because of caching and behavior conflicts.
5562

56-
This is mainly needed for first-run bootstrapping before this repo's own Nix settings are active.
63+
Possible alternatives that are not yet validated:
64+
- Use [nsncd](https://github.com/twosigma/nsncd), an `nscd`-compatible daemon that forwards lookups without glibc `nscd`'s caching behavior
65+
- Make the required NSS modules discoverable to Nix-built binaries directly instead of routing lookups through an `nscd`-compatible socket
66+
- In practice this likely means a glibc/NSS setup that can expose `libnss_sss` compatibly to those binaries
67+
- The exact implementation is environment-specific and still untested here
5768

5869
### Rebuilding the current machine
5970

6071
The pinned `nh` CLI is exposed as a flake app on all supported platforms.
6172

6273
Bootstrap rebuilds can be run directly with:
6374

75+
If you are not using Lix, ensure `nix-command` and `flakes` are enabled before
76+
running these commands.
77+
6478
```sh
65-
NIX_CONFIG='experimental-features = nix-command flakes' nix run .#nh -- darwin switch .
66-
NIX_CONFIG='experimental-features = nix-command flakes' nix run .#nh -- os switch .
67-
NIX_CONFIG='experimental-features = nix-command flakes' nix run .#nh -- home switch .
79+
nix run .#nh -- darwin switch .
80+
nix run .#nh -- os switch .
81+
nix run .#nh -- home switch .
6882
```
6983

7084
Once `just` is available, `just rebuild` wraps the same pinned `nh` entrypoint:

flake.lock

Lines changed: 91 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@
2323
inputs.nixpkgs.follows = "nixpkgs";
2424
};
2525
import-tree.url = "github:vic/import-tree";
26+
lix = {
27+
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
28+
flake = false;
29+
};
30+
lix-module = {
31+
url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz";
32+
inputs = {
33+
lix.follows = "lix";
34+
nixpkgs.follows = "nixpkgs";
35+
};
36+
};
2637
llm-agents = {
2738
url = "github:numtide/llm-agents.nix";
2839
inputs.nixpkgs.follows = "nixpkgs-unstable";

justfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# WORKAROUND: suppress upstream broken-string-indentation warnings from
2+
# zen-browser-flake until https://github.com/0xc000022070/zen-browser-flake/pull/268 lands.
3+
nix_config_prefix := if env_var_or_default("NIX_CONFIG", "") == "" {
4+
"extra-deprecated-features = broken-string-indentation"
5+
} else {
6+
trim_end(env_var("NIX_CONFIG")) + "\nextra-deprecated-features = broken-string-indentation"
7+
}
8+
19
is_wsl := path_exists("/proc/sys/fs/binfmt_misc/WSLInterop")
210
is_nixos := path_exists("/run/current-system/nixos-version")
311

@@ -19,7 +27,7 @@ default:
1927
@just --list --unsorted
2028

2129
rebuild target=".":
22-
{{rebuild_command}} {{target}}
30+
NIX_CONFIG='{{nix_config_prefix}}' {{rebuild_command}} {{target}}
2331

2432
fix-nix-daemon:
2533
@set -e; \

modules/inputs/lix.nix

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{ lib, inputs, ... }:
2+
{
3+
flake-file.inputs.lix = {
4+
url = lib.mkDefault "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
5+
flake = false;
6+
};
7+
8+
flake-file.inputs.lix-module = {
9+
url = lib.mkDefault "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz";
10+
inputs.lix.follows = lib.mkDefault "lix";
11+
inputs.nixpkgs.follows = lib.mkDefault "nixpkgs";
12+
};
13+
14+
flake.modules = {
15+
nixos.lix = inputs.lix-module.nixosModules.default;
16+
darwin.lix = inputs.lix-module.darwinModules.default;
17+
};
18+
}

modules/nix/nixpkgs.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ let
1313
system = pkgs.stdenv.hostPlatform.system;
1414
in
1515
{
16+
options.repo.lix.enable = lib.mkOption {
17+
type = lib.types.bool;
18+
default = true;
19+
description = "Whether this module should enable the shared Lix overlay and module wiring.";
20+
};
21+
1622
options.repo.nixpkgs.enable = lib.mkOption {
1723
type = lib.types.bool;
1824
default = true;
@@ -26,7 +32,7 @@ let
2632
allowUnfreePredicate = _: true;
2733
nvidia.acceptLicense = true;
2834
};
29-
overlays = [
35+
overlays = lib.optional config.repo.lix.enable inputs.lix-module.overlays.default ++ [
3036
(_final: _prev: {
3137
unstable = import inputs.nixpkgs-unstable {
3238
inherit system;

modules/nix/settings.nix

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,19 @@ in
5454
{
5555
lib,
5656
pkgs,
57+
config,
5758
osConfig ? null,
5859
...
5960
}:
6061
mkSettingsAdapter {
61-
nix.package = lib.mkDefault (if osConfig != null then osConfig.nix.package else pkgs.nix);
62+
nix.package = lib.mkDefault (
63+
if osConfig != null then
64+
osConfig.nix.package
65+
else if lib.attrByPath [ "repo" "lix" "enable" ] false config then
66+
pkgs.lix
67+
else
68+
pkgs.nix
69+
);
6270
};
6371
};
6472
};

modules/packages/dev/files/opencode/AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ The `agent-health` skill must be active for any task longer than a few exchanges
1515
- Prefer small verifiable steps over large monolithic outputs
1616
- If a task is underspecified, ask one focused clarifying question before proceeding
1717
- Escalate to the user rather than silently retrying when blocked
18+
- Stage any new files that must participate in Nix evaluation before testing; untracked files are ignored by flake evaluation, so staging is required for reliable validation

0 commit comments

Comments
 (0)