summaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorandromeda <andromeda@lenovo>2026-03-06 16:53:18 +0100
committerandromeda <andromeda@lenovo>2026-03-06 16:53:18 +0100
commitd35463e1959cb64828c3166527b06e4a79cbea5e (patch)
tree65017b84447f63eaaac8326c6d18f5c5e34e6bac /nix
parentfdf5bb9daf8574b7f993e2e38e400c35aedc3b96 (diff)
reorganise
Diffstat (limited to 'nix')
-rw-r--r--nix/package.nix47
-rw-r--r--nix/pkgs/bootle.nix68
-rw-r--r--nix/pkgs/bootler.nix49
3 files changed, 0 insertions, 164 deletions
diff --git a/nix/package.nix b/nix/package.nix
deleted file mode 100644
index 3d56a51..0000000
--- a/nix/package.nix
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- stdenv,
- nasm,
- qemu,
- ...
-}: let
- bootImg = "boot";
-in
- stdenv.mkDerivation {
- pname = "bootler";
- version = "0.1.0";
- src = ../.;
- buildPhase = ''
- ${nasm}/bin/nasm asm/boot.asm -o boot.bin
- ${nasm}/bin/nasm asm/kernel.asm -o kernel.bin
-
- dd if=/dev/zero of=${bootImg} bs=512 count=2
- dd if=boot.bin of=${bootImg} conv=notrunc
- dd if=kernel.bin of=${bootImg} bs=512 seek=1 conv=notrunc
- '';
- installPhase = ''
- mkdir -p $out/bin
- cp ${bootImg} $out/bin
-
- # create emulation binary
- cat<<EOF>$out/bin/bootler
- #!/usr/bin/env bash
-
- # create temp dir
- mkdir -p ./.bootler
- cp $(echo $out)/bin/${bootImg} ./.bootler/${bootImg}
- chmod a+w ./.bootler/${bootImg}
-
- # run image
- ${qemu}/bin/qemu-system-x86_64 \
- -nographic \
- -drive file=./.bootler/${bootImg},format=raw,index=0,media=disk
-
- # clean up
- rm ./.bootler -r
-
- EOF
-
- chmod +x $out/bin/${bootImg}
- chmod +x $out/bin/bootler
- '';
- }
diff --git a/nix/pkgs/bootle.nix b/nix/pkgs/bootle.nix
deleted file mode 100644
index 99bdb55..0000000
--- a/nix/pkgs/bootle.nix
+++ /dev/null
@@ -1,68 +0,0 @@
-{
- callPackage,
- rust-bin,
- naersk,
- bootler,
- qemu,
- ...
-}: let
- rust-toolchain = rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml;
- naersk' = callPackage naersk {
- cargo = rust-toolchain;
- rustc = rust-toolchain;
- clippy = rust-toolchain;
- };
-in (naersk'.buildPackage {
- src = ../../.;
-
- # deps for rust-src
- additionalCargoLock = "${rust-toolchain.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock";
-
- # just library build
- copyBins = false;
- copyLibs = true;
- release = true;
-
- # build std
- cargoBuildOptions = x:
- x
- ++ [
- "-Zbuild-std"
- ];
-
- postInstall = ''
- ld --oformat binary \
- -o kernel.bin \
- -T src/linker.ld \
- -e _start \
- target/x86_64-unknown-none/release/libbootle.a
-
- dd if=/dev/zero of=disk bs=512 count=2
- dd if=${bootler}/bin/boot.bin of=disk conv=notrunc
- dd if=kernel.bin of=disk bs=512 seek=1 conv=notrunc
-
- mkdir -p $out/lib
- mkdir -p $out/bin
-
- cat<<EOF>$out/bin/bootle
- #!/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/bootle
-
- cp target/x86_64-unknown-none/release/libbootle.a $out/lib
- cp kernel.bin $out/bin
- cp disk $out/bin
- '';
-})
diff --git a/nix/pkgs/bootler.nix b/nix/pkgs/bootler.nix
deleted file mode 100644
index 3e5d2e4..0000000
--- a/nix/pkgs/bootler.nix
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- stdenv,
- nasm,
- qemu,
- ...
-}: let
- bootImg = "boot";
-in
- stdenv.mkDerivation {
- pname = "bootler";
- version = "0.1.0";
- src = ../../.;
- buildPhase = ''
- ${nasm}/bin/nasm asm/boot.asm -o boot.bin
- ${nasm}/bin/nasm asm/kernel.asm -o dummy.bin
-
- dd if=/dev/zero of=${bootImg} bs=512 count=2
- dd if=boot.bin of=${bootImg} conv=notrunc
- dd if=dummy.bin of=${bootImg} bs=512 seek=1 conv=notrunc
- '';
- installPhase = ''
- mkdir -p $out/bin
- cp boot.bin $out/bin
- cp dummy.bin $out/bin
- cp ${bootImg} $out/bin
-
- # create emulation binary
- cat<<EOF>$out/bin/bootler
- #!/usr/bin/env bash
-
- # create temp dir
- mkdir -p ./.bootler
- cp $(echo $out)/bin/${bootImg} ./.bootler/${bootImg}
- chmod a+w ./.bootler/${bootImg}
-
- # run image
- ${qemu}/bin/qemu-system-x86_64 \
- -nographic \
- -drive file=./.bootler/${bootImg},format=raw,index=0,media=disk
-
- # clean up
- rm ./.bootler -r
-
- EOF
-
- chmod +x $out/bin/${bootImg}
- chmod +x $out/bin/bootler
- '';
- }