nemu: basic devShell

This commit is contained in:
xinyangli 2024-01-11 17:14:41 +08:00
parent fd3838a61d
commit 096cc220d1
No known key found for this signature in database
3 changed files with 144 additions and 1 deletions

View file

@ -4,7 +4,7 @@ STUNAME = 李心杨
# DO NOT modify the following code!!! # DO NOT modify the following code!!!
TRACER = tracer-ysyx TRACER = tracer-ysyx
GITFLAGS = -q --author='$(TRACER) <tracer@ysyx.org>' --no-verify --allow-empty GITFLAGS = -q --author='$(TRACER) <tracer@ysyx.org>' --no-verify --allow-empty --no-gpg-sign
YSYX_HOME = $(NEMU_HOME)/.. YSYX_HOME = $(NEMU_HOME)/..
WORK_BRANCH = $(shell git rev-parse --abbrev-ref HEAD) WORK_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)

82
nemu/flake.lock Normal file
View file

@ -0,0 +1,82 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1704722960,
"narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nur-xin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1704680562,
"narHash": "sha256-ffec3HL8OgbHB/TvLHILvC3ylou6N+KDtrn4qYVV+U4=",
"ref": "refs/heads/master",
"rev": "8adf33b6fdd113c645d83feda28622a0b1ef9f83",
"revCount": 144,
"type": "git",
"url": "https://git.xinyang.life/xin/nur.git"
},
"original": {
"type": "git",
"url": "https://git.xinyang.life/xin/nur.git"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"nur-xin": "nur-xin"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

61
nemu/flake.nix Normal file
View file

@ -0,0 +1,61 @@
{
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
gdb
jre
gtkwave
];
inputsFrom = [ self.packages.${system}.default ];
};
packages.nemu = with pkgs; stdenv.mkDerivation rec {
pname = "nemu";
version = "2024-01-02";
src = ./.;
nativeBuildInputs = [
gnumake
flex
bison
];
buildInputs = [
readline
libllvm
];
NEMU_HOME = src;
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; [ ];
};
};
}
);
}