commit 2250cca672c4136db02e7b96b07330ae98b6d8e0
parent 270c33dc1b75f44ab402142aa04a9ee2ff494577
Author: Vincent Demeester <vincent@sbr.pm>
Date: Mon, 29 Aug 2022 15:20:39 +0200
systems/modules: add binfmt to core
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
4 files changed, 45 insertions(+), 40 deletions(-)
diff --git a/systems/hosts/aomi.nix b/systems/hosts/aomi.nix
@@ -73,44 +73,29 @@ in
loader.systemd-boot.netbootxyz.enable = true;
kernelPackages = pkgs.linuxPackages_latest;
tmpOnTmpfs = true;
- binfmt.registrations = {
- s390x-linux = {
- # interpreter = getEmulator "s390x-linux";
- interpreter = "${pkgs.qemu}/bin/qemu-s390x";
- magicOrExtension = ''\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16'';
- mask = ''\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'';
- };
- };
- binfmt.emulatedSystems = [
- "armv6l-linux"
- "armv7l-linux"
- "aarch64-linux"
- # "s390x-linux"
- "powerpc64le-linux"
- ];
};
- # FIXME Fix tmpOnTmpfs
- # systemd.additionalUpstreamSystemUnits = [ "tmp.mount" ];
-
services.hardware.bolt.enable = true;
modules = {
- hardware = { };
+ core.binfmt.enable = true;
+ hardware = {
+ laptop.enable = true;
+ };
+ services = {
+ avahi.enable = true;
+ ssh.enable = true;
+ syncthing.enable = true;
+ };
};
profiles = {
externalbuilder.enable = true;
- # desktop.i3.enable = true;
- laptop.enable = true;
home = true;
dev.enable = true;
virtualization = { enable = true; nested = true; };
redhat.enable = true;
- ssh.enable = true;
docker.enable = true;
- avahi.enable = true;
- syncthing.enable = true;
};
diff --git a/systems/hosts/shikoku.nix b/systems/hosts/shikoku.nix
@@ -32,22 +32,6 @@ in
};
};
- boot.binfmt.registrations = {
- s390x-linux = {
- # interpreter = getEmulator "s390x-linux";
- interpreter = "${pkgs.qemu}/bin/qemu-s390x";
- magicOrExtension = ''\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16'';
- mask = ''\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'';
- };
- };
- boot.binfmt.emulatedSystems = [
- "armv6l-linux"
- "armv7l-linux"
- "aarch64-linux"
- # "s390x-linux"
- "powerpc64le-linux"
- ];
-
# TODO: check if it's done elsewhere
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
@@ -97,6 +81,10 @@ in
device = "/dev/disk/by-uuid/a9ec44e6-0c1d-4f60-9f5c-81a7eaa8e8fd";
}];
+ modules = {
+ core.binfmt.enable = true;
+ };
+
programs.ssh.setXAuthLocation = true;
profiles = {
bind.enable = true;
diff --git a/systems/modules/core/binfmt.nix b/systems/modules/core/binfmt.nix
@@ -0,0 +1,31 @@
+{ config, lib, pkgs, ... }:
+
+let
+ inherit (lib) mkEnableOption mkIf types;
+ cfg = config.modules.core.binfmt;
+in
+{
+ options = {
+ modules.core.binfmt = {
+ enable = mkEnableOption "Register extra emulated systems using binfmt";
+ };
+ };
+ config = mkIf cfg.enable {
+ boot = {
+ binfmt.registrations = {
+ s390x-linux = {
+ # interpreter = getEmulator "s390x-linux";
+ interpreter = "${pkgs.qemu}/bin/qemu-s390x";
+ magicOrExtension = ''\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16'';
+ mask = ''\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'';
+ };
+ };
+ binfmt.emulatedSystems = [
+ "armv6l-linux"
+ "armv7l-linux"
+ "aarch64-linux"
+ "powerpc64le-linux"
+ ];
+ };
+ };
+}
diff --git a/systems/modules/core/default.nix b/systems/modules/core/default.nix
@@ -4,6 +4,7 @@
./config.nix
./nix.nix
./users.nix
+ ./binfmt.nix
];
boot = {