Omniscio

OmniscioGuidesClaude Code on NixOS

Claude Code on NixOS

NixOS is the one system where the working install is somebody else's package rather than Anthropic's own script. That changes what you run, how you upgrade, and which problems are yours to fix.

Last checked against Anthropic's documentation on November 25, 2026. By the Omniscio team. Updated .

Is NixOS supported?

Not by Anthropic. Its requirements name macOS 13.0 or later, Windows 10 1809 or later, Ubuntu 20.04 or later, Debian 10 or later, and Alpine Linux 3.19 or later. NixOS is not on that list, and neither is any other distribution outside it.

What NixOS has instead is a package in nixpkgs, the distribution's own package collection. It fetches the same published binary Anthropic ships, from downloads.claude.ai/claude-code-releases, and verifies it against the manifest checksum — so the code is Anthropic's and the packaging is Nix's.

That package is what makes this page possible. Its platforms are aarch64-darwin, aarch64-linux and x86_64-linux, so on Linux it covers the 64-bit systems only, and its licence is marked unfree.

How do I install it?

Declaratively, in configuration.nix

Add the package to your system packages. The NixOS manual's example is { environment.systemPackages = [ pkgs.thunderbird ]; }, which is the same shape with a different name:

{ pkgs, ... }:
{
  environment.systemPackages = [ pkgs.claude-code ];
}

Because the package is unfree, that line alone is refused. The NixOS manual documents the global switch:

nixpkgs.config = {
  allowUnfree = true;
};

If you would rather not allow every unfree package, the Nixpkgs manual shows allowUnfreePredicate, which permits one named package and keeps the rest blocked.

Then rebuild as usual: sudo nixos-rebuild switch. The command lands on your PATH as /run/current-system/sw/bin/claude, a symlink that resolves into the Nix store.

Without touching the system

For a one-off session, allow unfree packages for that invocation and add --impure:

NIXPKGS_ALLOW_UNFREE=1 nix shell --impure nixpkgs#claude-code

The Nixpkgs manual documents export NIXPKGS_ALLOW_UNFREE=1 as the temporary way to allow unfree packages for one invocation of the nix tools, and nixpkgs reads that variable directly: allowUnfree = config.allowUnfree || getEnv "NIXPKGS_ALLOW_UNFREE" == "1";

--impure is the part people miss. A nixpkgs# reference is a flake installable, which Nix evaluates in pure mode, where it does not read environment variables — so without the flag the variable is invisible and the unfree package is refused anyway. The non-flake form NIXPKGS_ALLOW_UNFREE=1 nix-shell -p claude-code avoids the question entirely.

How do I upgrade it?

Upgrade by updating nixpkgs and rebuilding, not with claude update. The package disables Claude Code's background auto-updater, so a new version arrives when your nixpkgs does: sudo nix-channel --update then sudo nixos-rebuild switch on a channel-based system, or your usual flake update on a flake-based one.

claude update still works under that setting — Anthropic says disabling the auto-updater leaves claude update and claude install alone — but it installs a copy of its own under ~/.local, outside your configuration, which is the copy the check below catches.

Why not just run Anthropic's install script?

Because NixOS does not put a prebuilt binary's libraries where the binary looks for them. The Nixpkgs manual is explicit that buildFHSEnv exists to run "software which is hard or unfeasible to patch for NixOS", including third-party binaries with the standard filesystem layout baked in.

You can see the patching in the package itself: for Linux it runs autoPatchelfHook, which rewrites the binary's interpreter and library paths to point into the Nix store. Claude Code's installer does none of that — it downloads the stock binary and runs it. The error you would meet is the one Anthropic documents for a missing ld-linux shared library.

The second conflict is updates. Anthropic's native installer keeps its own copy and updates itself; on NixOS that copy sits outside your configuration, which is why the nixpkgs package turns the auto-updater off.

If you need to run the stock binary for some reason, the pothole-filling tool is one of the two the Nixpkgs manual describes — buildFHSEnv, or a patched copy like the package's own. Treat the nixpkgs package as the supported route rather than the workaround.

What breaks on NixOS, and what fixes it

CPU storms and multi-gigabyte memory use

A reported bug follows managed-settings symlinks into /nix/store. The settings watcher resolves the link and watches the target's directory, so every session ends up watching the store itself; any store change — a build, a garbage collection — makes every session read the whole store at once. The report measured sessions climbing to 4 to 7 GB of memory.

It only applies if you generate /etc/claude-code/managed-settings.json with environment.etc, because that is what makes the file a symlink into the store. If your managed settings are a real file, this is not your problem. If they are a symlink, the report's workaround is to stop that, by giving the generated file a mode other than a symlink:

environment.etc."claude-code/managed-settings.json" = {
  text = builtins.readFile ./managed-settings.json;
  mode = "0444";
};

Adjust text to whatever source you already use; the mode line is the part that matters.

Copy and paste comes out wrong

There is an open report of copy and paste picking up stray terminal control sequences, filed from Ghostty on NixOS. Its own account blames Claude Code's terminal rendering rather than Ghostty or the NixOS configuration, and its workaround is to avoid mouse-selecting out of the Claude Code pane: have the output written to a file and copy from that instead.

The sandbox

Anthropic says the Linux sandbox relies on bubblewrap and socat. The nixpkgs package puts both on Claude Code's PATH for you, along with ripgrep and procps, so those are present without your having to put anything into a read-only store.

Two things are still outside the package: the optional seccomp filter, which Anthropic lists as a fourth dependency, and the kernel's user-namespace settings. Run /sandbox and read its Dependencies tab — it names exactly which of them your machine is missing.

How do I confirm it works?

claude --version
claude doctor

A version number means the patched binary runs. claude doctor prints read-only installation and settings diagnostics without starting a session — install health, settings-file validation errors, and warnings with suggested fixes.

Two checks that are specific to Nix:

  • readlink -f "$(command -v claude)" should land in /nix/store. If it resolves to ~/.local/share/claude/versions/ instead, an installer copy has taken over your PATH — its launcher is ~/.local/bin/claude.
  • Watch the process for a minute while nothing is happening. A session idling at high CPU when your managed settings are an environment.etc symlink is the settings-watcher bug, not a slow machine.

Where these answers come from

Common questions

Is NixOS a supported system for Claude Code?

Not by Anthropic. Its requirements name macOS, Windows, Ubuntu 20.04 or later, Debian 10 or later and Alpine 3.19 or later, and NixOS is not among them. The nixpkgs collection does package Claude Code, so there is a maintained install; it is the Nix side that carries it.

How do I install Claude Code on NixOS?

Add pkgs.claude-code to environment.systemPackages in configuration.nix and rebuild, or try it without touching the system with NIXPKGS_ALLOW_UNFREE=1 nix shell --impure nixpkgs#claude-code. The package is marked unfree, and a flake installable is evaluated purely, so the variable is only visible with --impure.

Can I just run Anthropic's install script on NixOS?

It is not the route the distribution supports. Prebuilt Linux binaries look for their loader and libraries in fixed paths NixOS does not use, which is why nixpkgs rewrites the binary with autoPatchelfHook and why the Nixpkgs manual offers buildFHSEnv for software that cannot be patched.

Why does Claude Code use huge amounts of CPU on NixOS?

A reported bug watches managed-settings symlinks through to the Nix store, so every session holds a watch on /nix/store and every store change makes each session scan it. It only applies if you generate /etc/claude-code/managed-settings.json with environment.etc, which makes that file a symlink; the workaround in the report is to write it as a real 0444 file instead.

Does the sandbox work on NixOS?

The nixpkgs package puts ripgrep, procps, bubblewrap and socat on Claude Code's PATH, which covers the two packages Anthropic says the Linux sandbox relies on. Whether it starts also depends on the kernel's user-namespace settings and the optional seccomp filter, which the /sandbox panel reports.