2024-03-04 03:59:50 +00:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, ... }@inputs: with inputs;
|
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
crossPkgs = import nixpkgs {
|
|
|
|
localSystem = system;
|
|
|
|
crossSystem = {
|
|
|
|
config = "riscv32-none-elf";
|
2024-03-25 09:29:46 +00:00
|
|
|
gcc = {
|
|
|
|
abi = "ilp32";
|
|
|
|
arch = "rv32if";
|
|
|
|
};
|
2024-03-04 03:59:50 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
2024-03-25 09:29:46 +00:00
|
|
|
packages.nemu = pkgs.callPackage ./nemu { am-kernels = self.packages.${system}.am-kernels-cmake; };
|
|
|
|
packages.abstract-machine = crossPkgs.callPackage ./abstract-machine { isa = "riscv"; platform = "nemu"; };
|
2024-03-04 03:59:50 +00:00
|
|
|
|
2024-03-25 09:29:46 +00:00
|
|
|
packages.am-kernels-cmake = crossPkgs.stdenv.mkDerivation rec {
|
|
|
|
pname = "am-kernels-cmake";
|
2024-03-04 03:59:50 +00:00
|
|
|
version = "2024.02.18";
|
|
|
|
|
2024-03-25 09:29:46 +00:00
|
|
|
src = ./am-kernels;
|
2024-03-04 03:59:50 +00:00
|
|
|
|
2024-03-25 09:29:46 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgs.cmake
|
|
|
|
];
|
2024-03-04 03:59:50 +00:00
|
|
|
|
2024-03-25 09:29:46 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
(pkgs.lib.cmakeFeature "ISA" "riscv")
|
|
|
|
(pkgs.lib.cmakeFeature "PLATFORM" "nemu")
|
|
|
|
(pkgs.lib.cmakeFeature "CMAKE_INSTALL_DATADIR" "share")
|
|
|
|
];
|
2024-03-04 03:59:50 +00:00
|
|
|
|
2024-03-25 09:29:46 +00:00
|
|
|
buildInputs = [
|
|
|
|
# SDL2
|
|
|
|
self.packages.${system}.abstract-machine
|
|
|
|
];
|
2024-03-04 03:59:50 +00:00
|
|
|
};
|
2024-03-07 05:19:12 +00:00
|
|
|
|
|
|
|
devShells.nemu = pkgs.mkShell {
|
|
|
|
packages = with pkgs; [
|
|
|
|
clang-tools
|
2024-03-20 11:46:54 +00:00
|
|
|
gdb
|
2024-03-07 05:19:12 +00:00
|
|
|
];
|
|
|
|
inputsFrom = [
|
|
|
|
self.packages.${system}.nemu
|
|
|
|
];
|
|
|
|
};
|
2024-03-04 03:59:50 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|