Skip to content

Commit 96925a9

Browse files
Add opencode, pinned to nixos-25.11 on WSL
opencode built on nixos-unstable (1.17.9) segfaults at startup under WSL2 — glibc's ld.so crashes while loading the Bun-compiled binary (anomalyco/opencode#26846). The nixos-25.11 build (1.1.14) runs fine, so add a nixpkgs-stable input and overlay it in on the WSL hosts until unstable is fixed. The non-WSL template keeps the unstable package.
1 parent 22c9a30 commit 96925a9

4 files changed

Lines changed: 38 additions & 2 deletions

File tree

‎flake.lock‎

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flake.nix‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
# Track nixos-unstable (this system reports 26.11pre / "Zokor").
66
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
77

8+
# Stable channel, used only to swap in packages that are broken on
9+
# unstable (currently opencode on WSL2 — see modules/wsl.nix).
10+
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-25.11";
11+
812
nixos-wsl = {
913
url = "github:nix-community/NixOS-WSL/main";
1014
# Build NixOS-WSL against the same nixpkgs pinned above.
@@ -22,6 +26,7 @@
2226
{
2327
self,
2428
nixpkgs,
29+
nixpkgs-stable,
2530
nixos-wsl,
2631
home-manager,
2732
...
@@ -31,6 +36,7 @@
3136
# WSL host, graphical (GNOME). This is the default.
3237
nixos = nixpkgs.lib.nixosSystem {
3338
system = "x86_64-linux";
39+
specialArgs = { inherit nixpkgs-stable; };
3440
modules = [
3541
nixos-wsl.nixosModules.default
3642
home-manager.nixosModules.home-manager
@@ -42,6 +48,7 @@
4248
# Switch on demand: nixos-rebuild switch --flake .#nixos-headless
4349
nixos-headless = nixpkgs.lib.nixosSystem {
4450
system = "x86_64-linux";
51+
specialArgs = { inherit nixpkgs-stable; };
4552
modules = [
4653
nixos-wsl.nixosModules.default
4754
home-manager.nixosModules.home-manager

‎home/default.nix‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# User-facing apps. Base CLI tools stay in modules/common.nix.
2525
home.packages = with pkgs; [
2626
ghostty
27+
opencode
2728

2829
# unfree (allowed in modules/common.nix; useGlobalPkgs makes it apply here)
2930
claude-code

‎modules/wsl.nix‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# WSL-specific configuration. Only imported by the WSL host; the nixos-wsl
22
# module itself (which provides the `wsl.*` options) is added in flake.nix.
3-
{ lib, ... }:
3+
# nixpkgs-stable comes from flake.nix via specialArgs.
4+
{ lib, nixpkgs-stable, ... }:
45

56
let
67
flakePath = "/home/nixos/personal/nixos-config";
@@ -10,6 +11,16 @@ in
1011
wsl.defaultUser = "nixos";
1112
# wsl.wslg.enable = true;
1213

14+
# opencode from nixos-unstable segfaults at startup under WSL2 — the crash
15+
# is in glibc's ld.so while it loads the Bun-compiled binary
16+
# (https://github.com/anomalyco/opencode/issues/26846). The nixos-25.11
17+
# build works, so swap it in here until unstable is fixed.
18+
nixpkgs.overlays = [
19+
(final: prev: {
20+
opencode = nixpkgs-stable.legacyPackages.${prev.stdenv.hostPlatform.system}.opencode;
21+
})
22+
];
23+
1324
# GNOME pulls in NetworkManager, whose module unconditionally enables the
1425
# wpa_supplicant service for its wifi backend. WSL has no wifi hardware and
1526
# the unit fails at startup (226/NAMESPACE), so force it off here.

0 commit comments

Comments
 (0)