diff --git a/pkgs/cheriot-sim.nix b/pkgs/cheriot-sim.nix index 05fcd50..3fb5d57 100644 --- a/pkgs/cheriot-sim.nix +++ b/pkgs/cheriot-sim.nix @@ -13,53 +13,64 @@ pkg-config, gnumake, z3, -}: -stdenv.mkDerivation rec { - pname = "cheriot-sim"; - version = "e5038a0"; + darwin, +}: let + sail = ocamlPackages.sail.overrideAttrs (prev: { + # On MacOS sail needs to access the codesign package. + nativeBuildInputs = prev.nativeBuildInputs ++ lib.optional stdenv.isDarwin darwin.sigtool; + }); +in + stdenv.mkDerivation rec { + pname = "cheriot-sim"; + version = "e5038a0"; - src = fetchFromGitHub { - owner = "microsoft"; - repo = "cheriot-sail"; - rev = "e5038a0ec5fcdf2f672d0a7ddf8446225fd86cf7"; - fetchSubmodules = true; - hash = "sha256-umMN2ktOeV2Queocgi8qlYO464v/98+uTgbCkO9yLBA="; - }; + src = fetchFromGitHub { + owner = "microsoft"; + repo = "cheriot-sail"; + rev = "e5038a0ec5fcdf2f672d0a7ddf8446225fd86cf7"; + fetchSubmodules = true; + hash = "sha256-umMN2ktOeV2Queocgi8qlYO464v/98+uTgbCkO9yLBA="; + }; - buildInputs = [ - zlib - gmp - ]; + buildInputs = [ + zlib + gmp + ]; - nativeBuildInputs = [ - ocaml - pkg-config - gnumake - z3 - ]; + nativeBuildInputs = [ + ocaml + pkg-config + gnumake + z3 + ]; - postPatch = '' - for file in riscv_patches/*.patch; do - (cd sail-riscv; patch -p1 < "../$file") - done - ''; + postPatch = + '' + for file in riscv_patches/*.patch; do + (cd sail-riscv; patch -p1 < "../$file") + done + '' + + lib.optionalString stdenv.isDarwin '' + # If LTO is enabled, LLVM bitcode is produced and linking produces unrecognized file error. + substituteInPlace Makefile --replace " -flto" "" + ''; - makeFlags = [ - "SAIL=${ocamlPackages.sail}/bin/sail" - "SAIL_DIR=${ocamlPackages.sail}/share/sail" - "LEM_DIR=${ocamlPackages.lem}/share/lem" - "csim" - ]; + makeFlags = [ + "SAIL=${sail}/bin/sail" + "SAIL_DIR=${sail}/share/sail" + "LEM_DIR=${ocamlPackages.lem}/share/lem" + "csim" + ]; - installPhase = '' - mkdir -p $out/bin - cp c_emulator/cheriot_sim $out/bin/ - ''; + installPhase = '' + mkdir -p $out/bin + cp c_emulator/cheriot_sim $out/bin/ + ''; - meta = { - description = "Simulator built from the sail code model of the CHERIoT ISA"; - homepage = "https://github.com/microsoft/cheriot-sail"; - license = lib.licenses.bsd2; - mainProgram = "cheriot_sim"; - }; -} + meta = { + description = "Simulator built from the sail code model of the CHERIoT ISA"; + homepage = "https://github.com/microsoft/cheriot-sail"; + license = lib.licenses.bsd2; + mainProgram = "cheriot_sim"; + }; + } diff --git a/pkgs/python_ot/default.nix b/pkgs/python_ot/default.nix index 7b2073a..7c7fd14 100644 --- a/pkgs/python_ot/default.nix +++ b/pkgs/python_ot/default.nix @@ -5,6 +5,7 @@ inputs, pkgs, python3, + lib, ... }: let # This overlay is generated by poetry2nix @@ -12,12 +13,21 @@ poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix {inherit pkgs;}; poetryOverrides = inputs.self.lib.poetryOverrides {inherit pkgs;}; -in - poetry2nix.mkPoetryEnv { + + env = poetry2nix.mkPoetryEnv { projectDir = ./.; overrides = [ poetry-git-overlay poetryOverrides poetry2nix.defaultPoetryOverrides ]; + }; +in + env + // { + meta = + env.meta + // { + platforms = lib.platforms.linux; + }; }