mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
30 lines
868 B
Nix
30 lines
868 B
Nix
{ pkgs, config, lib, ... }: let
|
|
inherit (lib.options) mkEnableOption mkPackageOption;
|
|
inherit (lib.modules) mkIf;
|
|
cfg = config.boot.binfmt.cross.aarch64;
|
|
in {
|
|
options = {
|
|
boot.binfmt.cross.aarch64 = {
|
|
enable = mkEnableOption "qemu-aarch64" // {
|
|
default = true;
|
|
};
|
|
package = mkPackageOption pkgs "qemu" { };
|
|
armv7l = mkEnableOption "arm.cachix.org";
|
|
};
|
|
};
|
|
|
|
config = {
|
|
boot.binfmt = {
|
|
emulatedSystems = mkIf cfg.enable [ "aarch64-linux" ];
|
|
registrations.aarch64-linux = mkIf cfg.enable {
|
|
interpreter = "${cfg.package}/bin/qemu-aarch64";
|
|
wrapInterpreterInShell = false;
|
|
};
|
|
};
|
|
|
|
nix.settings = mkIf cfg.armv7l {
|
|
substituters = [ "https://arm.cachix.org/" ];
|
|
trusted-public-keys = [ "arm.cachix.org-1:5BZ2kjoL1q6nWhlnrbAl+G7ThY7+HaBRD9PZzqZkbnM=" ];
|
|
};
|
|
};
|
|
}
|