Skip to content

Commit

Permalink
[nix] add omreader wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin committed Jun 24, 2024
1 parent 7bc6e29 commit a3770ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
6 changes: 5 additions & 1 deletion nix/t1/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ lib.makeScope newScope
configgen = _millOutput.configgen // { meta.mainProgram = "configgen"; };
t1package = _millOutput.t1package;

omreader = self.callPackage ./omreader.nix { };
omreader-unwrapped = self.callPackage ./omreader.nix { };
submodules = self.callPackage ./submodules.nix { };

riscv-opcodes-src = self.submodules.sources.riscv-opcodes.src;
Expand Down Expand Up @@ -65,10 +65,14 @@ lib.makeScope newScope
elaborate = innerSelf.callPackage ./elaborate.nix { target = "ip"; /* use-binder = true; */ };
mlirbc = innerSelf.callPackage ./mlirbc.nix { inherit elaborate; };
rtl = innerSelf.callPackage ./rtl.nix { inherit mlirbc; };

omreader = self.omreader-unwrapped.mkWrapper { inherit mlirbc; };

om = innerSelf.callPackage ./om.nix { inherit mlirbc; };

emu-elaborate = innerSelf.callPackage ./elaborate.nix { target = "ipemu"; /* use-binder = true; */ };
emu-mlirbc = innerSelf.callPackage ./mlirbc.nix { elaborate = emu-elaborate; };
emu-omreader = self.omreader-unwrapped.mkWrapper { mlirbc = emu-mlirbc; };
emu-rtl = innerSelf.callPackage ./rtl.nix { mlirbc = emu-mlirbc; };

emu = innerSelf.callPackage ./ipemu.nix { rtl = ip.emu-rtl; stdenv = moldStdenv; };
Expand Down
23 changes: 17 additions & 6 deletions nix/t1/omreader.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ lib
, stdenv
, runCommand
, fetchMillDeps
, makeWrapper
, jdk21
Expand Down Expand Up @@ -41,12 +42,22 @@ let
nativeBuildInputs = [ submodules.setupHook ];
};

passthru.editable = self.overrideAttrs (_: {
shellHook = ''
setupSubmodulesEditable
mill mill.bsp.BSP/install 0
'';
});
passthru = {
editable = self.overrideAttrs (_: {
shellHook = ''
setupSubmodulesEditable
mill mill.bsp.BSP/install 0
'';
});

mkWrapper = { mlirbc }: runCommand "wrap-omreader"
{ nativeBuildInputs = [ makeWrapper ]; meta.mainProgram = "omreader"; }
''
mkdir -p "$out/bin"
mlirbc=$(find ${mlirbc}/ -type f)
makeWrapper ${self}/bin/omreader "$out/bin/omreader" --append-flags "--mlirbc-file $mlirbc"
'';
};

shellHook = ''
setupSubmodules
Expand Down

0 comments on commit a3770ff

Please sign in to comment.