From d088d31c37ebf754e54f48e2875425b4f3dd9d05 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Sat, 30 Aug 2025 12:52:32 -0400 Subject: [PATCH] add qemu patch for unshare --- clients/quadphone/overlays.nix | 42 ------------------------------ clients/quadphone/repart.nix | 12 --------- flake.lock | 17 ------------ flake.nix | 1 - modules/desktop/binfmt.nix | 1 - modules/desktop/binfmt/default.nix | 11 ++++++++ modules/desktop/binfmt/qemu.patch | 16 ++++++++++++ 7 files changed, 27 insertions(+), 73 deletions(-) delete mode 100644 clients/quadphone/overlays.nix delete mode 100644 modules/desktop/binfmt.nix create mode 100644 modules/desktop/binfmt/default.nix create mode 100644 modules/desktop/binfmt/qemu.patch diff --git a/clients/quadphone/overlays.nix b/clients/quadphone/overlays.nix deleted file mode 100644 index 546bd5d..0000000 --- a/clients/quadphone/overlays.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - lib, - inputs, - ... -}: let - ibusPath = "i18n/input-method/default.nix"; -in { - # disabledModules = [ibusPath]; - # imports = [ - # (import "${inputs.ibus-fix}/nixos/modules/${ibusPath}") - # ]; - - # nixpkgs.overlays = [ - # (_: super: { - # # https://github.com/NixOS/nixpkgs/pull/434550 - # iniparser = super.iniparser.overrideAttrs (old: { - # cmakeFlags = [ - # (lib.cmakeBool "BUILD_TESTING" false) - # ]; - # }); - - # # TODO: Upstream to nixpkgs - # glycin-loaders = super.glycin-loaders.overrideAttrs (old: { - # env.CARGO_BUILD_TARGET = super.stdenv.hostPlatform.rust.rustcTargetSpec; - # postPatch = '' - # substituteInPlace loaders/meson.build \ - # --replace-fail "cargo_target_dir / rust_target / loader," "cargo_target_dir / '${super.stdenv.hostPlatform.rust.cargoShortTarget}' / rust_target / loader," - # ''; - - # nativeBuildInputs = (old.nativeBuildInputs or []) ++ [super.buildPackages.rustPlatform.cargoSetupHook]; - # cargoVendorDir = "vendor"; - # }); - - # # TODO: Maybe upstream to nixpkgs (ruby maintainer please reply to my DM) - # ruby_3_3 = super.ruby_3_3.overrideAttrs (old: { - # NIX_RUSTFLAGS = - # (old.NIX_RUSTFLAGS or "") - # + " --target ${super.stdenv.hostPlatform.rust.rustcTargetSpec}"; - # }); - # }) - # ]; -} diff --git a/clients/quadphone/repart.nix b/clients/quadphone/repart.nix index 57b58d0..cc5a783 100644 --- a/clients/quadphone/repart.nix +++ b/clients/quadphone/repart.nix @@ -35,18 +35,6 @@ in { }; }; - # TODO: Fix: - # error: builder for '/nix/store/4pbzqss4j7xpbj742zjbhrbl5azdgfnl-image.drv' failed with exit code 1; - # last 7 log lines: - # > structuredAttrs is enabled - # > Running phase: patchPhase - # > 'repart.d' -> '/build/amended-repart.d' - # > Running phase: updateAutotoolsGnuConfigScriptsPhase - # > Running phase: buildPhase - # > Building image with systemd-repart... - # > unshare: unshare failed: Invalid argument - # For full logs, run 'nix log /nix/store/4pbzqss4j7xpbj742zjbhrbl5azdgfnl-image.drv'. - image.repart = { name = "image"; partitions = { diff --git a/flake.lock b/flake.lock index 2c0a2b4..0a28cb4 100644 --- a/flake.lock +++ b/flake.lock @@ -1265,22 +1265,6 @@ "type": "github" } }, - "ibus-fix": { - "locked": { - "lastModified": 1755615982, - "narHash": "sha256-x+vQv6K/A70KbLa+xB4wmu2X1eVa4FJ2Y3auQ3Ef41U=", - "owner": "Artturin", - "repo": "nixpkgs", - "rev": "28555291142cfb7f19e3fcf086f2ef0e54a167c6", - "type": "github" - }, - "original": { - "owner": "Artturin", - "ref": "i18inputmethodcross", - "repo": "nixpkgs", - "type": "github" - } - }, "kukui-nixos": { "inputs": { "conf2nix": [ @@ -2648,7 +2632,6 @@ "gnome-mobile": "gnome-mobile", "grapevine": "grapevine", "home-manager": "home-manager_2", - "ibus-fix": "ibus-fix", "lasuite-docs-proxy": "lasuite-docs-proxy", "matrixoidc": "matrixoidc", "nexusbot": "nexusbot", diff --git a/flake.nix b/flake.nix index 893b8b2..7798ee5 100755 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,6 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; wrapper-manager.url = "github:viperML/wrapper-manager"; flake-parts.url = "github:hercules-ci/flake-parts"; - ibus-fix.url = "github:Artturin/nixpkgs/i18inputmethodcross"; disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/desktop/binfmt.nix b/modules/desktop/binfmt.nix deleted file mode 100644 index ef79873..0000000 --- a/modules/desktop/binfmt.nix +++ /dev/null @@ -1 +0,0 @@ -{boot.binfmt.emulatedSystems = ["aarch64-linux"];} diff --git a/modules/desktop/binfmt/default.nix b/modules/desktop/binfmt/default.nix new file mode 100644 index 0000000..d44fe9a --- /dev/null +++ b/modules/desktop/binfmt/default.nix @@ -0,0 +1,11 @@ +{ + boot.binfmt.emulatedSystems = ["aarch64-linux"]; + nixpkgs.overlays = [ + (_: super: { + # Because of https://github.com/NixOS/nixpkgs/pull/378579 + qemu = super.qemu.overrideAttrs (old: { + patches = (old.patches or []) ++ [./qemu.patch]; + }); + }) + ]; +} diff --git a/modules/desktop/binfmt/qemu.patch b/modules/desktop/binfmt/qemu.patch new file mode 100644 index 0000000..4817501 --- /dev/null +++ b/modules/desktop/binfmt/qemu.patch @@ -0,0 +1,16 @@ +diff --git a/util/rcu.c b/util/rcu.c +index fa32c942e4..8ae899f74e 100644 +--- a/util/rcu.c ++++ b/util/rcu.c +@@ -409,12 +409,6 @@ static void rcu_init_complete(void) + + qemu_event_init(&rcu_call_ready_event, false); + +- /* The caller is assumed to have BQL, so the call_rcu thread +- * must have been quiescent even after forking, just recreate it. +- */ +- qemu_thread_create(&thread, "call_rcu", call_rcu_thread, +- NULL, QEMU_THREAD_DETACHED); +- + rcu_register_thread(); + }