diff options
author | Nathan Ringo <nathan@remexre.com> | 2024-09-01 21:40:34 -0500 |
---|---|---|
committer | Nathan Ringo <nathan@remexre.com> | 2024-09-01 21:40:34 -0500 |
commit | 158b7123b6a50b2e8d37529e01ccd94c9106c11a (patch) | |
tree | 9af446b259b8ac99524843e215513355668908ef /flake.nix | |
parent | 8cb34498eceef231927c444507b6787128c5f0d8 (diff) |
Fix debuginfo and restore apps.
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 151 |
1 files changed, 72 insertions, 79 deletions
@@ -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; |