From 9b9aaad8df1094cb6436d10c043587af8b732093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Fri, 11 Apr 2025 01:17:37 +0200 Subject: [PATCH 1/8] libkrunfw: add nrabulinski to maintainers --- pkgs/by-name/li/libkrunfw/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/li/libkrunfw/package.nix b/pkgs/by-name/li/libkrunfw/package.nix index 5a70ea441b916..ee21e586d383f 100644 --- a/pkgs/by-name/li/libkrunfw/package.nix +++ b/pkgs/by-name/li/libkrunfw/package.nix @@ -71,6 +71,7 @@ stdenv.mkDerivation (finalAttrs: { maintainers = with maintainers; [ nickcao RossComputerGuy + nrabulinski ]; platforms = [ "x86_64-linux" ] ++ lib.optionals (!sevVariant) [ "aarch64-linux" ]; }; From d7dc981866aa9d0886c5f2181c4ee041cb7f5b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Fri, 11 Apr 2025 01:17:58 +0200 Subject: [PATCH 2/8] libkrunfw: 4.5.1 -> 4.9.0 --- pkgs/by-name/li/libkrunfw/package.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/li/libkrunfw/package.nix b/pkgs/by-name/li/libkrunfw/package.nix index ee21e586d383f..9496c7cfdc7e4 100644 --- a/pkgs/by-name/li/libkrunfw/package.nix +++ b/pkgs/by-name/li/libkrunfw/package.nix @@ -15,18 +15,18 @@ stdenv.mkDerivation (finalAttrs: { pname = "libkrunfw"; - version = "4.5.1"; + version = "4.9.0"; src = fetchFromGitHub { owner = "containers"; repo = "libkrunfw"; tag = "v${finalAttrs.version}"; - hash = "sha256-GFfBiGMOyBwMKjpD1kj3vRpvjR0ydji3QNDyoOQoQsw="; + hash = "sha256-wmvjex68Mh7qehA33WNBYHhV9Q/XWLixokuGWnqJ3n0="; }; kernelSrc = fetchurl { - url = "mirror://kernel/linux/kernel/v6.x/linux-6.6.59.tar.xz"; - hash = "sha256-I2FoCNjAjxKBX/iY9O20wROXorKEPQKe5iRS0hgzp20="; + url = "mirror://kernel/linux/kernel/v6.x/linux-6.12.20.tar.xz"; + hash = "sha256-Iw6JsHsKuC508H7MG+4xBdyoHQ70qX+QCSnEBySbasc="; }; postPatch = '' From 6d23b102f48e62e57b188fa97e0161fc3f45a992 Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Thu, 10 Oct 2024 13:00:04 -0700 Subject: [PATCH 3/8] libkrun: expose block option --- pkgs/by-name/li/libkrun/package.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/by-name/li/libkrun/package.nix b/pkgs/by-name/li/libkrun/package.nix index 71ff653b002e4..610c757bb7ac3 100644 --- a/pkgs/by-name/li/libkrun/package.nix +++ b/pkgs/by-name/li/libkrun/package.nix @@ -13,6 +13,7 @@ virglrenderer, libkrunfw, rustc, + withBlk ? false, withGpu ? false, withSound ? false, withNet ? false, @@ -65,6 +66,7 @@ stdenv.mkDerivation (finalAttrs: { [ "PREFIX=${placeholder "out"}" ] + ++ lib.optional withBlk "BLK=1" ++ lib.optional withGpu "GPU=1" ++ lib.optional withSound "SND=1" ++ lib.optional withNet "NET=1" From 3163b7e8d349c637f6236a098c1a1113b1aa3d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Thu, 10 Apr 2025 18:58:35 +0200 Subject: [PATCH 4/8] libkrun: add nrabulinski to maintainers --- pkgs/by-name/li/libkrun/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/li/libkrun/package.nix b/pkgs/by-name/li/libkrun/package.nix index 610c757bb7ac3..97e7644ac7e1f 100644 --- a/pkgs/by-name/li/libkrun/package.nix +++ b/pkgs/by-name/li/libkrun/package.nix @@ -85,6 +85,7 @@ stdenv.mkDerivation (finalAttrs: { maintainers = with maintainers; [ nickcao RossComputerGuy + nrabulinski ]; platforms = libkrunfw.meta.platforms; }; From 6897042726f4797e3691ac47c56ec78779cd06f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Thu, 10 Apr 2025 18:58:50 +0200 Subject: [PATCH 5/8] libkrun: fix dev output Previously the pkgconfig and include dirs were mistakenly moved into $dev/lib/pkgconfig/pkgconfig and $dev/include/include, which was breaking packages which depended on libkrun through pkg-config --- pkgs/by-name/li/libkrun/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/li/libkrun/package.nix b/pkgs/by-name/li/libkrun/package.nix index 97e7644ac7e1f..9ab6637a47782 100644 --- a/pkgs/by-name/li/libkrun/package.nix +++ b/pkgs/by-name/li/libkrun/package.nix @@ -74,8 +74,8 @@ stdenv.mkDerivation (finalAttrs: { postInstall = '' mkdir -p $dev/lib/pkgconfig - mv $out/lib64/pkgconfig $dev/lib/pkgconfig - mv $out/include $dev/include + mv $out/lib64/pkgconfig $dev/lib/ + mv $out/include $dev/ ''; meta = with lib; { From 4f4753e6d2ce6b4a1d7232785eed985d26a1ed46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Fri, 11 Apr 2025 01:08:21 +0200 Subject: [PATCH 6/8] libkrun: 1.9.8 -> 1.11.2 --- pkgs/by-name/li/libkrun/package.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/li/libkrun/package.nix b/pkgs/by-name/li/libkrun/package.nix index 9ab6637a47782..3f8f2c4e38954 100644 --- a/pkgs/by-name/li/libkrun/package.nix +++ b/pkgs/by-name/li/libkrun/package.nix @@ -22,13 +22,13 @@ stdenv.mkDerivation (finalAttrs: { pname = "libkrun"; - version = "1.9.8"; + version = "1.11.2"; src = fetchFromGitHub { owner = "containers"; repo = "libkrun"; tag = "v${finalAttrs.version}"; - hash = "sha256-a5ot5ad8boANK3achn6PJ52k/xmxawbTM0/hEEC/fss="; + hash = "sha256-B11f7uG/oODwkME2rauCFbVysxUtUrUmd6RKeuBdnUU="; }; outputs = [ @@ -38,9 +38,19 @@ stdenv.mkDerivation (finalAttrs: { cargoDeps = rustPlatform.fetchCargoVendor { inherit (finalAttrs) src; - hash = "sha256-X1NPZQaXFBw9IKD2DbBCPug0WDjv8XnpefbA2RNJgFU="; + hash = "sha256-bcHy8AfO9nzSZKoFlEpPKvwupt3eMb+A2rHDaUzO3/U="; }; + # Make sure libkrunfw can be found by dlopen() + # FIXME: This wasn't needed previously. What changed? + env.RUSTFLAGS = toString ( + map (flag: "-C link-arg=" + flag) [ + "-Wl,--push-state,--no-as-needed" + "-lkrunfw" + "-Wl,--pop-state" + ] + ); + nativeBuildInputs = [ rustPlatform.cargoSetupHook rustPlatform.bindgenHook From 16263fc6e9e5965ae55fc84b622bdc64986cb3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Thu, 10 Oct 2024 13:00:38 -0700 Subject: [PATCH 7/8] muvm: init from krun as 0.4.1 Co-authored-by: Tristan Ross --- pkgs/by-name/kr/krun/package.nix | 70 -------------------- pkgs/by-name/mu/muvm/package.nix | 110 +++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 70 deletions(-) delete mode 100644 pkgs/by-name/kr/krun/package.nix create mode 100644 pkgs/by-name/mu/muvm/package.nix diff --git a/pkgs/by-name/kr/krun/package.nix b/pkgs/by-name/kr/krun/package.nix deleted file mode 100644 index fa17064e39e4e..0000000000000 --- a/pkgs/by-name/kr/krun/package.nix +++ /dev/null @@ -1,70 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - fetchpatch, - rustPlatform, - libkrun, - makeWrapper, - passt, - sommelier, - mesa, - withSommelier ? false, -}: - -rustPlatform.buildRustPackage { - pname = "krun"; - version = "0-unstable-2024-06-18"; - - src = fetchFromGitHub { - owner = "slp"; - repo = "krun"; - rev = "912afa5c6525b7c8f83dffd65ec4b1425b3f7521"; - hash = "sha256-rDuxv3UakAemDnj4Nsbpqsykts2IcseuQmDwO24L+u8="; - }; - - patches = [ - (fetchpatch { - url = "https://github.com/slp/krun/pull/39.diff"; - hash = "sha256-CV69L+VDDLRcWgpgDCAYKLlTU9ytFcHhzNgOibWD8KY="; - }) - (fetchpatch { - url = "https://github.com/slp/krun/pull/38.diff"; - hash = "sha256-cK3iDhh+33H16V65lWUXahjmpSxI1HhiLUmkjfkRB7A="; - }) - ]; - - useFetchCargoVendor = true; - cargoHash = "sha256-5zrwxyzt9ZEdUNUMnCaFUVpaO53RAabVdtib9LG6Q1s="; - - nativeBuildInputs = [ - rustPlatform.bindgenHook - makeWrapper - ]; - - buildInputs = [ - (libkrun.override { - withGpu = true; - withNet = true; - }) - ]; - - # Allow for sommelier to be disabled as it can cause problems. - wrapArgs = [ - "--prefix PATH : ${lib.makeBinPath (lib.optional withSommelier [ sommelier ] ++ [ passt ])}" - ]; - - postFixup = '' - wrapProgram $out/bin/krun $wrapArgs \ - --set-default OPENGL_DRIVER ${mesa.driverLink} - ''; - - meta = { - description = "Run programs from your system in a microVM"; - homepage = "https://github.com/slp/krun"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ RossComputerGuy ]; - platforms = libkrun.meta.platforms; - mainProgram = "krun"; - }; -} diff --git a/pkgs/by-name/mu/muvm/package.nix b/pkgs/by-name/mu/muvm/package.nix new file mode 100644 index 0000000000000..64ad1e8c4ca4c --- /dev/null +++ b/pkgs/by-name/mu/muvm/package.nix @@ -0,0 +1,110 @@ +{ + lib, + stdenv, + fetchFromGitHub, + rustPlatform, + libkrun, + passt, + dhcpcd, + systemd, + udev, + pkg-config, + procps, + fex, + writeShellApplication, + coreutils, + makeBinaryWrapper, +# TODO: Enable again when sommelier is not broken. +# For now, don't give false impression of sommelier being supported. +# sommelier, +# withSommelier ? false, +}: +let + # TODO: Setup setuid wrappers. + # E.g. FEX needs fusermount for rootfs functionality + initScript = writeShellApplication { + name = "muvm-init"; + runtimeInputs = [ + coreutils + ]; + text = '' + if [[ ! -f /etc/NIXOS ]]; then exit; fi + + ln -s /run/muvm-host/run/current-system /run/current-system + # Only create the symlink if that path exists on the host and is a directory. + if [[ -d /run/muvm-host/run/opengl-driver ]]; then ln -s /run/muvm-host/run/opengl-driver /run/opengl-driver; fi + ''; + }; + binPath = [ + dhcpcd + passt + (placeholder "out") + ] ++ lib.optionals stdenv.isAarch64 [ fex ]; + wrapArgs = lib.escapeShellArgs [ + "--prefix" + "PATH" + ":" + (lib.makeBinPath binPath) + "--add-flags" + "--execute-pre=${lib.getExe initScript}" + ]; +in +rustPlatform.buildRustPackage rec { + pname = "muvm"; + version = "0.4.1"; + + src = fetchFromGitHub { + owner = "AsahiLinux"; + repo = pname; + rev = "muvm-${version}"; + hash = "sha256-1XPhVEj7iqTxdWyYwNk6cbb9VRGuhpvvowYDPJb1cWU="; + }; + + useFetchCargoVendor = true; + cargoHash = "sha256-fkvdS0c1Ib8Kto44ou06leXy731cpMHXevyFR5RROt4="; + + postPatch = + '' + substituteInPlace crates/muvm/src/guest/bin/muvm-guest.rs \ + --replace-fail "/usr/lib/systemd/systemd-udevd" "${systemd}/lib/systemd/systemd-udevd" + + substituteInPlace crates/muvm/src/monitor.rs \ + --replace-fail "/sbin/sysctl" "${lib.getExe' procps "sysctl"}" + '' + # Only patch FEX path if we're aarch64, otherwise we don't want the derivation to pull in FEX in any way + + lib.optionalString stdenv.isAarch64 '' + substituteInPlace crates/muvm/src/guest/mount.rs \ + --replace-fail "/usr/share/fex-emu" "${fex}/share/fex-emu" + ''; + + nativeBuildInputs = [ + rustPlatform.bindgenHook + makeBinaryWrapper + pkg-config + ]; + + buildInputs = [ + (libkrun.override { + withBlk = true; + withGpu = true; + withNet = true; + }) + udev + ]; + + postFixup = '' + wrapProgram $out/bin/muvm ${wrapArgs} + ''; + + meta = { + description = "Run programs from your system in a microVM"; + homepage = "https://github.com/AsahiLinux/muvm"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + RossComputerGuy + nrabulinski + ]; + inherit (libkrun.meta) platforms; + mainProgram = "muvm"; + }; +} From 8a30e8fcec6df3bdea313b05067a39840756255f Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Thu, 1 May 2025 13:25:27 -0700 Subject: [PATCH 8/8] pkgs/top-level/aliases.nix: add krun --- pkgs/top-level/aliases.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index c177b1f2b255d..242aecdba4612 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -910,6 +910,7 @@ mapAliases { kramdown-rfc2629 = throw "'kramdown-rfc2629' has been renamed to/replaced by 'rubyPackages.kramdown-rfc2629'"; # Converted to throw 2024-10-17 krb5Full = krb5; krita-beta = throw "'krita-beta' has been renamed to/replaced by 'krita'"; # Converted to throw 2024-10-17 + krun = throw "'krun' has been renamed to/replaced by 'muvm'"; # Added 2025-05-01 kubei = kubeclarity; # Added 2023-05-20 kubo-migrator-all-fs-repo-migrations = kubo-fs-repo-migrations; # Added 2024-09-24