bunch of stuff idek

This commit is contained in:
andromeda
2026-03-06 20:33:51 +01:00
parent fdf5bb9daf
commit 9c65697dd8
20 changed files with 329 additions and 101 deletions

41
twasm/package.nix Normal file
View File

@@ -0,0 +1,41 @@
{
bootler,
stdenv,
nasm,
qemu,
...
}:
stdenv.mkDerivation {
pname = "twasm";
version = "0.1.0";
src = ./.;
buildPhase = ''
${nasm}/bin/nasm asm/main.asm -o out.bin
'';
installPhase = ''
dd if=/dev/zero of=disk bs=512 count=2880
dd if=${bootler}/bin/boot.bin of=disk conv=notrunc
dd if=out.bin of=disk bs=512 seek=1 conv=notrunc
mkdir -p $out/bin
cat<<EOF>$out/bin/twasm
#!/usr/bin/env bash
mkdir -p ./.bootle
cp $(echo $out)/bin/disk ./.bootle/disk
chmod a+w ./.bootle/disk
${qemu}/bin/qemu-system-x86_64 \
-nographic \
-drive file=./.bootle/disk,format=raw,index=0,media=disk
rm ./.bootle -r
EOF
chmod +x $out/bin/twasm
cp out.bin $out/bin
cp disk $out/bin
'';
}