---
title: 'Guide for Guix Builds on NixOS'
description: 'This blog may be out of date and is subject to change These are adapted and updated steps from bitcoin-resource . Installations Add the following to e...'
canonical: 'https://rustaceanrob.com/posts/guide-for-guix-builds-on-nixos'
created: 2026-07-23T00:00:00.000Z
tags: ['bitcoin']
author: '@rustaceanrob'
rights: 'All rights reserved.'
---

_This blog may be out of date and is subject to change_

These are adapted and updated steps from [`bitcoin-resource`](https://github.com/ismaelsadeeq/bitcoin.resource/blob/main/nix-os-guix-build.md).

# Installations

Add the following to `environment.systemPackages`:

```configuration.nix
  guix
  xar
  pbzx
  cpio
  rcodesign
  gnumake
  python3
```

Then, add the daemon as a system service:

```configuration.nix
services.guix.enable = true;
```

Now you may rebuild your system:

```shell
sudo nixos-rebuild switch
```

## Recommended Folder Structure

While not required, using a separate `git` tree for Guix builds can keep your working directory available and organized for usual development. Here is the recommended directory structure:

```
guix-builds/
├─ bitcoin/
├─ Xcode_*/
├─ run_build.sh
```

## Apple Developer Account

Unfortunately, to use the Xcode SDK, Apple expects you to register a [developer account](https://developer.apple.com/). It is not required to pay for the full license to download the SDK.

# Per-release steps

The Xcode SDK may, and likely will, change per release. For each version of the Xcode SDK, create an Xcode folder in the `guix-builds` directory, for example `Xcode_26.1.1`. The universal platform SDK is downloadable as an `xip`, which may be found by searching [here](https://developer.apple.com/download/all/?q=Xcode%2026.1.1) after signing in.

If required, copy the downloaded `xip` to your server:

```shell
rsync -azP ~/Downloads/Xcode_26.1.1_Universal.xip user@server:/home/user/guix-builds/Xcode_26.1.1/
```

Afterwards, extract the `xip`:

```shell
# inside `guix-builds/Xcode_26.1.1`
xar -xf Xcode_26.1.1_Universal.xip

pbzx -n Content | cpio -i
rm Content Metadata

rcodesign verify Xcode.app/Contents/MacOS/Xcode
```

You should see `no problems detected!`. Optionally, you may clean up the `xip` folder. Next, we will unpack the SDK, move into the `bitcoin` directory and run:

```shell
# inside `guix-builds/bitcoin`
python ./contrib/macdeploy/gen-sdk.py ../guix-builds/Xcode_26.1.1/Xcode.app
```

The output will be `.tar` archive. You can attest to it by taking the `sha256sum` hash and comparing it to the one found [here](https://github.com/bitcoin/bitcoin/blob/master/contrib/macdeploy/README.md#step-2-generating-the-sdk-tarball-from-xcodeapp):

```shell
sha256sum Xcode-26.1.1-17B100-extracted-SDK-with-libcxx-headers.tar
```

Assuming the hashes match, move that `tar` archive to the `Xcode_26.1.1` folder:

```shell
mv Xcode-26.1.1-17B100-extracted-SDK-with-libcxx-headers.tar ../Xcode_26.1.1/
```

Almost ready to do the first guix build! Lastly, we need to extract the tarball in the `Xcode_26.1.1` folder:

```
tar -C ./ -xaf Xcode-26.1.1-17B100-extracted-SDK-with-libcxx-headers.tar
```

# Build Steps

I use the following script for my builds, which requires a lot of CPU and memory. To reduce the system usage, you may remove the `ADDITION_GUIX_COMMON_FLAGS`:

```run-build.sh
# in guix-builds
unset SOURCE_DATE_EPOCH
export SDK_PATH=$1
export ADDITIONAL_GUIX_COMMON_FLAGS='--max-jobs=8'
cd bitcoin
./contrib/guix/guix-build
```

An example run, with the SDK we just unpacked:

```shell
./run-build.sh /home/you/guix-builds/Xcode_26.1.1
```

This will take a while, so it is recommended to run in a detached `tmux` or `zellij` session.

# Cleaning up

You may gather the shasums of the builds by running:

```shell
# in guix-builds/bitcoin
source contrib/shell/git-utils.bash && uname -m && find guix-build-$(git_head_version)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
```

If you would like to remove the build artifacts:

```shell
# in guix-builds/bitcoin
./contrib/guix/guix-clean
```
