Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 0 additions & 70 deletions pkgs/by-name/kr/krun/package.nix

This file was deleted.

23 changes: 18 additions & 5 deletions pkgs/by-name/li/libkrun/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
virglrenderer,
libkrunfw,
rustc,
withBlk ? false,
withGpu ? false,
withSound ? false,
withNet ? false,
Expand All @@ -21,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 = [
Expand All @@ -37,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
Expand All @@ -65,15 +76,16 @@ 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"
++ lib.optional sevVariant "SEV=1";

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; {
Expand All @@ -83,6 +95,7 @@ stdenv.mkDerivation (finalAttrs: {
maintainers = with maintainers; [
nickcao
RossComputerGuy
nrabulinski
];
platforms = libkrunfw.meta.platforms;
};
Expand Down
9 changes: 5 additions & 4 deletions pkgs/by-name/li/libkrunfw/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down Expand Up @@ -71,6 +71,7 @@ stdenv.mkDerivation (finalAttrs: {
maintainers = with maintainers; [
nickcao
RossComputerGuy
nrabulinski
];
platforms = [ "x86_64-linux" ] ++ lib.optionals (!sevVariant) [ "aarch64-linux" ];
};
Expand Down
110 changes: 110 additions & 0 deletions pkgs/by-name/mu/muvm/package.nix
Original file line number Diff line number Diff line change
@@ -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";
};
}
1 change: 1 addition & 0 deletions pkgs/top-level/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down