I’m trying to build a nix image to put on a raspberry pi (aarch64-linux) using raspberry-pi-nix. I’m building this image on my x86_64-linux nix laptop, and it’s taking far too long to be reasonable.
I’m building a very basic config to start with, basically the default given in the github repo, but every time i try to build it the process gets stuck compiling linux. I can see that it is doing something, but I’ve left it running for almost two hours with cpu and fans on full and it didn’t complete; obviously nix build doesn’t show you how close to complete a specific step of the build process is, though.
I’m just a bit lost about what the right way to go about this is, because this doesn’t seem to be it. My laptop is pretty beefy, it shouldn’t take this long. I suspect it’s compiling through an emulator, which is why it’s taking so long, but I’m not sure how to check for sure or how to force it to cross-compile properly. Any advice much appreciated.
I have the following line in my system flake config which I think enables building / compilation through an emulator:
# Enable emulation of other systems
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
And the flake.nix I’m trying to compile looks like this:
{
description = "Your new nix config";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# Stylix
stylix.url = "github:danth/stylix";
# Home manager
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Firefox addons flake
firefox-addons = {
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
# Sddm theme
sddm-sugar-candy-nix = {
url = "gitlab:Zhaith-Izaliel/sddm-sugar-candy-nix";
# Optional, by default this flake follows nixpkgs-unstable.
inputs.nixpkgs.follows = "nixpkgs";
};
# AGS for widgets
ags.url = "github:Aylur/ags";
};
outputs =
{ self, nixpkgs, home-manager, stylix, sddm-sugar-candy-nix, ... }@inputs:
let
inherit (self) outputs;
defaultWallpaper = ./images/wallpaper_default.jpg;
in {
# NixOS configuration entrypoint
nixosConfigurations = {
# Config for gpteapot system
gpteapot = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs defaultWallpaper; };
modules = [
# System-level configuration
./system/configuration.nix
sddm-sugar-candy-nix.nixosModules.default
# Stylix
stylix.nixosModules.stylix
home-manager.nixosModules.home-manager
{
# Home manager modules
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
# User-specific configs
home-manager.users.username = import ./home;
}
];
};
};
};
}
(configuration.nix has no effect on the process if removed, it just configures ssh and wifi)
I’m building with the following command:
nix build '.#nixosConfigurations.rpi.config.system.build.sdImage'
But i’ve tried a couple different settings like adding --system aarch64-linux
with seemingly no effect.