ysyx-workbench/nemu/flake.nix
tracer-ysyx f2a6cf21a5 > compile NEMU
ysyx_22040000 李心杨
Linux calcite 6.6.18 #1-NixOS SMP PREEMPT_DYNAMIC Fri Feb 23 08:25:28 UTC 2024 x86_64 GNU/Linux
 20:12:50  up   4:30,  2 users,  load average: 0.35, 0.31, 0.35
2024-03-03 20:12:50 +08:00

79 lines
1.8 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nur-xin = {
url = "git+https://git.xinyang.life/xin/nur.git";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, ... }@inputs: with inputs;
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system} //
{ nur.xin = nur-xin.legacyPackages.${system}; };
in
{
devShells.default = with pkgs; mkShell {
packages = [
clang-tools
rnix-lsp
bear
gdb
jre
gtkwave
];
inputsFrom = [ self.packages.${system}.nemu ];
};
packages.nemu = with pkgs; stdenv.mkDerivation rec {
pname = "nemu";
version = "2024-01-02";
src = ./.;
nativeBuildInputs = [
gnumake
flex
bison
pkg-config
python3 # for testing
];
buildInputs = [
check
readline
libllvm
];
configurePhase = ''
echo pwd=$(pwd)
'';
buildPhase = ''
make NEMU_HOME=/build/nemu --trace
'';
installPhase = ''
BUILD_DIR=$out make install
'';
checkPhase = ''
BUILD_DIR=$out make test
'';
meta = with lib; {
description = "NJU EMUlator, a full system x86/mips32/riscv32/riscv64 emulator for teaching";
homepage = "https://github.com/NJU-ProjectN/nemu.git";
license = with licenses; [ ];
maintainers = with maintainers; [ ];
};
};
}
);
}