Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MacOS builds of packages #43

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 54 additions & 43 deletions pkgs/cheriot-sim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
}
14 changes: 12 additions & 2 deletions pkgs/python_ot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,29 @@
inputs,
pkgs,
python3,
lib,
...
}: let
# This overlay is generated by poetry2nix
poetry-git-overlay = import ./poetry-git-overlay.nix {inherit pkgs;};

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;
};
}