From 8af7ea5958d83d9f6b491e1a59da9b18a23cd3ed Mon Sep 17 00:00:00 2001 From: Philipp Hochkamp Date: Mon, 5 Sep 2022 04:38:58 +0200 Subject: [PATCH] daedalusvm rosetta --- darwin-common.nix | 5 +++-- hosts/daedalusvm/default.nix | 11 +++++++++++ hosts/daedalusvm/hardware-configuration.nix | 8 ++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/darwin-common.nix b/darwin-common.nix index d9c286cf..eca5d282 100644 --- a/darwin-common.nix +++ b/darwin-common.nix @@ -17,11 +17,12 @@ publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUorQkJYdWZYQUpoeVVIVmZocWxrOFk0ekVLSmJLWGdKUXZzZEU0ODJscFYgcm9vdEBpc28K"; } { - systems = [ "aarch64-linux" ]; + systems = [ "aarch64-linux" "x86_64-linux" ]; + speedFactor = 2; supportedFeatures = [ "kvm" "big-parallel" ]; sshUser = "ragon"; maxJobs = 8; - hostName = "192.168.64.5"; + hostName = "192.168.64.7"; sshKey = "/Users/ragon/.ssh/id_ed25519"; publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUJMMm94ZEtha01Ka05iTExZK2xnNFkzd25jWnJwVE1sVHRBUWdsazVkVVEgcm9vdEBkYWVkYWx1c3ZtCg=="; }]; diff --git a/hosts/daedalusvm/default.nix b/hosts/daedalusvm/default.nix index f9c3a8c9..a60f23c3 100644 --- a/hosts/daedalusvm/default.nix +++ b/hosts/daedalusvm/default.nix @@ -23,6 +23,17 @@ in boot.supportedFilesystems = [ "nfs" "nfs4" ]; environment.systemPackages = [ pkgs.nfs-utils pkgs.virt-manager pkgs.firefox ]; + nix.settings.extra-platforms = [ "x86_64-linux" ]; + nix.settings.extra-sandbox-paths = [ "/tmp/rosetta" "/run/binfmt" ]; + boot.binfmt.registrations."rosetta" = { + interpreter = "/tmp/rosetta/rosetta"; + fixBinary = true; + wrapInterpreterInShell = false; + matchCredentials = true; + magicOrExtension = ''\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00''; + mask = ''\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff''; + }; + services.qemuGuest.enable = true; services.xserver.desktopManager.gnome.enable = true; diff --git a/hosts/daedalusvm/hardware-configuration.nix b/hosts/daedalusvm/hardware-configuration.nix index 384e7e2e..23bb9890 100644 --- a/hosts/daedalusvm/hardware-configuration.nix +++ b/hosts/daedalusvm/hardware-configuration.nix @@ -5,14 +5,18 @@ { imports = [ "${modulesPath}/profiles/qemu-guest.nix" ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" "usb_storage" "sr_mod" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" "usb_storage" "sr_mod" "virtiofs" ]; - networking.interfaces.enp0s5.useDHCP = true; + networking.interfaces.enp0s1.useDHCP = true; swapDevices = [{ device = "/dev/disk/by-label/NIXOS_SWAP"; }]; fileSystems."/boot" = { device = "/dev/disk/by-label/NIXOS_BOOT"; fsType = "vfat"; }; + fileSystems."/tmp/rosetta" = { + device = "rosetta"; + fsType = "virtiofs"; + }; fileSystems."/" = { device = "/dev/disk/by-label/NIXOS_ROOT";