summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix151
1 files changed, 72 insertions, 79 deletions
diff --git a/flake.nix b/flake.nix
index 5990c23..0b2a514 100644
--- a/flake.nix
+++ b/flake.nix
@@ -57,95 +57,88 @@
;
};
};
- in
- /*
- pkgsHost = import nixpkgs {
- inherit system;
- crossSystem.config = "riscv64-unknown-none-elf";
- };
- packages = rec {
- boards = import ./boards {
- inherit libkernel;
- pkgs = pkgsHost;
- };
- libkernel = pkgsBuild.callPackage ./kernel { inherit rust; };
- };
- run-vm = pkgsBuild.writeShellApplication {
- name = "run-vm";
+ run-qemu-virt = pkgs.writeShellApplication {
+ name = "run-qemu-virt";
- runtimeInputs = [ pkgsBuild.qemu ];
+ runtimeInputs = [ pkgs.qemu ];
- text = ''
- set -x
- qemu-system-riscv64 \
- -machine virt \
- -m 1G \
- -nographic \
- -bios none \
- -kernel ${packages.boards.qemu-virt}/kernel.elf \
- "$@"
- '';
- };
- */
+ text = ''
+ set -x
+ qemu-system-riscv64 \
+ -machine virt \
+ -m 1G \
+ -nographic \
+ -bios none \
+ -kernel ${packages.kernel.qemu-virt}/vernos_kernel.elf \
+ "$@"
+ '';
+ };
+ in
{
- /*
- apps = {
- default = {
- type = "app";
- program = pkgsBuild.lib.getExe run-vm;
- };
+ apps = {
+ default = {
+ type = "app";
+ program = pkgs.lib.getExe run-qemu-virt;
+ };
- run = {
- type = "app";
- program = pkgsBuild.lib.getExe run-vm;
- };
+ run = {
+ type = "app";
+ program = pkgs.lib.getExe run-qemu-virt;
+ };
- debug = {
- type = "app";
- program = pkgsBuild.lib.getExe (
- pkgsBuild.writeShellApplication {
- name = "run-vm-debug";
- runtimeInputs = [ run-vm ];
- text = ''
- port=$(( 1000 * ("$(id -u)" - 990) ))
- run-vm -gdb tcp::$port -S "$@"
- '';
- }
- );
- };
+ debug = {
+ type = "app";
+ program = pkgs.lib.getExe (
+ pkgs.writeShellApplication {
+ name = "run-vm-debug";
+ runtimeInputs = [ run-qemu-virt ];
+ text = ''
+ port=$(( 1000 * ("$(id -u)" - 990) ))
+ run-qemu-virt -gdb tcp::$port -S "$@"
+ '';
+ }
+ );
+ };
- gdb = {
- type = "app";
- program = pkgsBuild.lib.getExe (
- pkgsBuild.writeShellApplication {
- name = "gdb";
- runtimeInputs = [ toolchain ];
- text = ''
- port=$(( 1000 * ("$(id -u)" - 990) ))
- rust-gdb ${packages.boards.qemu-virt}/kernel.elf \
- -ex "target remote 127.0.0.1:$port" \
- -ex "set riscv use-compressed-breakpoints yes" \
- -ex "layout asm" \
- -ex "layout regs" \
- -ex "focus cmd" \
- -ex "tbreak hart0_boot" \
- -ex "c"
- '';
- }
- );
- };
+ gdb = {
+ type = "app";
+ program = pkgs.lib.getExe (
+ pkgs.writeShellApplication {
+ name = "gdb";
+ text = ''
+ port=$(( 1000 * ("$(id -u)" - 990) ))
+ rust-gdb ${packages.kernel.qemu-virt}/vernos_kernel.elf \
+ -ex "symbol-file ${packages.kernel.qemu-virt}/vernos_kernel.sym" \
+ -ex "target remote 127.0.0.1:$port" \
+ -ex "set riscv use-compressed-breakpoints yes" \
+ -ex "layout asm" \
+ -ex "layout regs" \
+ -ex "focus cmd" \
+ -ex "tbreak hart0_boot" \
+ -ex "c"
+ '';
+ }
+ );
};
- */
+ };
devShells.default = pkgs.mkShell {
- nativeBuildInputs = [
- (pkgs.callPackage ./nix/miri.nix { inherit fenix; })
- pkgs.cargo-watch
- pkgs.qemu
- python
- rust-toolchain
- ];
+ nativeBuildInputs =
+ [
+ (pkgs.callPackage ./nix/miri.nix { inherit fenix; })
+ pkgs.cargo-watch
+ pkgs.qemu
+ python
+ rust-toolchain
+ ]
+ ++ (builtins.map (
+ { crossSystem, ... }:
+ (import nixpkgs {
+ inherit system;
+ crossSystem.config = crossSystem;
+ }).stdenv.cc.bintools.bintools
+ ) (builtins.attrValues arches));
};
packages = flake-utils.lib.flattenTree packages;