flake.nix: extract packages/devshells/modules into smaller files

This commit is contained in:
Jörg Thalheim 2025-11-03 17:14:28 +01:00
parent 6f7f3f2461
commit 505e85b9c5
9 changed files with 360 additions and 323 deletions

View file

@ -0,0 +1,19 @@
{ libkrun, libkrunfw, rustPlatform, variant ? null, ... }:
let
libkrunfw' = libkrunfw.override { inherit variant; };
in
(libkrun.override {
withBlk = true;
withGpu = true;
withSound = true;
withNet = true;
inherit variant;
libkrunfw = libkrunfw';
}).overrideAttrs (old: {
src = ../../libkrun;
cargoDeps = rustPlatform.importCargoLock {
lockFile = ../../libkrun/Cargo.lock;
};
# mesonFlags = [ (lib.mesonOption "decoders" "gles,vulkan,composer") ]; # no magma(?)
})

View file

@ -0,0 +1,19 @@
{ libkrunfw, fetchurl, variant ? null, ... }:
(libkrunfw.override {
inherit variant;
}).overrideAttrs (old: {
version = "5.0.0";
src = ../../libkrunfw;
# src = fetchFromGitHub {
# owner = "containers";
# repo = "libkrunfw";
# tag = "v4.10.0";
# hash = "sha256-mq2gw0+xL6qUZE/fk0vLT3PEpzPV8p+iwRFJHXVOMnk=";
# };
kernelSrc = fetchurl {
url = "mirror://kernel/linux/kernel/v6.x/linux-6.12.44.tar.xz";
hash = "sha256-tlAhDtMCeyJJadFIqjd0Uqmq065/KFGr7dMa3+8Wva4=";
};
# buildInputs = old.buildInputs;
})

16
packages/mesa/default.nix Normal file
View file

@ -0,0 +1,16 @@
{ mesa, lib }:
(mesa.override {
vulkanDrivers = [
"amd"
"intel"
"microsoft-experimental" # removing this breaks the build
"nouveau"
"swrast"
"virtio"
"gfxstream" # probably not going to use this though
];
}).overrideAttrs (new: old: {
mesonFlags = old.mesonFlags ++ [ (lib.mesonBool "amdgpu-virtio" true) ];
patches = old.patches ++ [ ../../radvmmio.patch ]; # already merged to git
})

View file

@ -0,0 +1,14 @@
{ writeScriptBin, symlinkJoin, makeWrapper, muvm, passt, bubblewrap }:
let
munixScript = (writeScriptBin "munix" (builtins.readFile ../../munix)).overrideAttrs(old: {
buildCommand = "${old.buildCommand}\n patchShebangs $out";
});
in symlinkJoin {
name = "munix";
paths = [ munixScript muvm passt bubblewrap ];
buildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/munix --prefix PATH : $out/bin
'';
}

12
packages/muvm/default.nix Normal file
View file

@ -0,0 +1,12 @@
{ muvm, libkrun, systemd, rustPlatform }:
(muvm.override {
libkrun = libkrun;
}).overrideAttrs (old: {
postPatch = ""; # no more sysctl; udevd now takes the var anyway; XXX: fex
MUVM_UDEVD_PATH = "${systemd}/lib/systemd/systemd-udevd";
src = ../../muvm;
cargoDeps = rustPlatform.importCargoLock {
lockFile = ../../muvm/Cargo.lock;
};
})