diff --git a/nix/t1/default.nix b/nix/t1/default.nix index dfeea63acb..0b8ceb13b4 100644 --- a/nix/t1/default.nix +++ b/nix/t1/default.nix @@ -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; @@ -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; }; diff --git a/nix/t1/omreader.nix b/nix/t1/omreader.nix index 66873e0504..a8d5da3992 100644 --- a/nix/t1/omreader.nix +++ b/nix/t1/omreader.nix @@ -1,5 +1,6 @@ { lib , stdenv +, runCommand , fetchMillDeps , makeWrapper , jdk21 @@ -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