Tiny kexec images for breaking NixOS into your computer
  • Nix 97.2%
  • Shell 2.8%
Find a file
2026-04-18 08:14:33 -04:00
mixins init 2026-04-18 06:46:51 -04:00
modules move basic host information to base 2026-04-18 07:52:57 -04:00
personal init 2026-04-18 06:46:51 -04:00
.gitignore init 2026-04-18 06:46:51 -04:00
flake.lock init 2026-04-18 06:46:51 -04:00
flake.nix add hydra jobs 2026-04-18 08:07:33 -04:00
lib.nix init 2026-04-18 06:46:51 -04:00
LICENSE.txt add MIT license 2026-04-18 07:44:01 -04:00
README.md add hydra to readme 2026-04-18 08:14:33 -04:00
tools.sh init 2026-04-18 06:46:51 -04:00

Crowbar

Wedging NixOS into places it doesn't belong

Crowbar is a series of kexec builds of NixOS optimized to be as small as reasonably possible while still being useful. It can be used to, as the name implies, crowbar NixOS into pretty much whatever environment you want. As long as you have ~1gb of RAM and ~0.5gb of disk space, you can reformat as you please.

This can (and has) been used to install NixOS on a 1gb Oracle Cloud VM. See Tips: Oracle Cloud.

Build the kexec image with nix build .#{distribution}. See Distributions.

Images are only distributed as x86_64-linux, however you can use crowbarWith to (attempt to) create one with a different system.

Usage

Prerequisites:

  • ~0.75gb of free RAM, ~0.4gb of disk space
  • Server must be able to acquire an IP with DHCP if working over SSH

Steps:

  • Build the kexec files with nix build .#{distribution}. See Distributions
  • Copy the kexec files (bzImage, initrd.gz, kexec-boot) to the target system
  • Ensure kexec-tools is installed on the target system
  • Run ./kexec-boot as root. If connected over ssh, ssh will hang with a broken pipe
    • If you get a loading error, try stopping services to reduce RAM usage
  • If using the TTY, root will be logged in immediately
    If using SSH, reconnect with SSH and type in the password bythepowerofgreyskull
  • Ping @Infinidoge@meow.social on Mastodon to complain about your cloud provider
  • You're done! (With crowbar).
    Do whatever you need to do to setup your system, and let us know how it went!

Components

All components of Crowbar can be accessed from the crowbar attribute of the flake.

Distributions

(crowbar.distributions)

A list of modules containing the relevant Mixins. The base Modules are added by crowbarWith.

Name Description
base Just the modules (empty list)
full base + btrfs + luks + zfs
all-hardware full + all-hardware
small base + no-dbus
minimal small + no-nix

(There are also inx- prefixed variants, but those are for us. See Personal).

Modules

(src, crowbar.modules)

The core pieces of Crowbar, and are not added individually.

Name Description
base Sets Nix state version, disables grub
filesystems Adds tools for mandatory filesystems
netboot Modified from Nixpkgs; Creates the kexec/netboot image
networking Disables firewall, enables networkd
nix Configures Nix
packages System packages, including removing unnecessary defaults
slimming Disabling unnecessary cruft
ssh Configures ssh
systemd Configures systemd, disables optional components
users Configures the only user you need: root

Mixins

(src, crowbar.mixins)

The optional pieces you can choose to include (or remove).

Name Image Size Description
all-hardware ? Enables hardware.enableAllHardware
btrfs +10mb Enables btrfs
luks +10mb Enables LUKS/cryptsetup and udev
zfs +75mb Enables ZFS
no-dbus -10mb Removes dbus
no-kexec -1mb Removes kexec support
no-nix -50mb Removes Nix

Personal

(src, crowbar.personal)

The selfish stuff just for us.

Name Description
nix Adds our Hydra instance as a substituter
shell Adds all of our standard shell aliases/functions
ssh Installs the inx.moe SSH CA

crowbarWith

(crowbar.crowbarWith)

crowbarWith is the main function used to create a spin of crowbar. It creates a NixOS system with the Modules, and anything added in the list of modules.

Usage:

crowbarWith "system" [ list of modules ]

For example:

crowbarWith "x86_64-linux" crowbar.distributions.full

Tips

If you needed to do any special steps to use Crowbar with a cloud provider, or any other tips that may be useful, let us know and we'll add it here!

Hydra

All of the default images are built on hydra.inx.moe!

To use them, you can add the following to your NixOS configuration:

nix.settings = {
  substituters = [
    "https://hydra.inx.moe"
  ];
  trusted-public-keys = [
    "infinidoge-1:uw2A6JHHdGJ9GPk0NEDnrdfVkPp0CUY3zIvwVgNlrSk="
  ];
};

Oracle Cloud

(Tested on an Ubuntu image)

If you get an error due to lack of memory, run the following commands to stop services to free up RAM:

systemctl stop snapd
systemctl stop snap.oracle-cloud-agent.oracle-cloud-agent-updater.service
systemctl stop snap.oracle-cloud-agent.oracle-cloud-agent.service
systemctl stop dbus
systemctl stop iscsid
systemctl stop polkit
systemctl stop rpcbind
systemctl stop systemd-logind
systemctl stop systemd-timesyncd
systemctl stop systemd-udevd
systemctl stop udisks2
systemctl stop unattended-upgrades

Then continue with Usage