diff options
| author | andromeda <andromeda@lenovo> | 2026-03-06 20:38:32 +0100 |
|---|---|---|
| committer | andromeda <andromeda@lenovo> | 2026-03-06 20:38:32 +0100 |
| commit | 42003df4157098f4977153b03df68491ab3c11bc (patch) | |
| tree | 27b61bd7a27df6e25db8b21dc0ee3daed01d79fb /twasm/package.nix | |
| parent | d35463e1959cb64828c3166527b06e4a79cbea5e (diff) | |
| parent | 9c65697dd8119ec9cee13f57f870b07e305d27ec (diff) | |
merge new changes
Diffstat (limited to 'twasm/package.nix')
| -rw-r--r-- | twasm/package.nix | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/twasm/package.nix b/twasm/package.nix new file mode 100644 index 0000000..f621780 --- /dev/null +++ b/twasm/package.nix @@ -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 + ''; +} |
