diff --git a/flake.nix b/flake.nix index dd8c362..cc64e33 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,8 @@ # Licensed under the MIT License, see LICENSE for details. # SPDX-License-Identifier: MIT { + description = "lowRISC CIC's Nix Packages and Environments"; + inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; flake-utils.url = "github:numtide/flake-utils"; @@ -22,8 +24,9 @@ pkgs = import nixpkgs { inherit system; }; + lowrisc_pkgs = import ./pkgs {inherit pkgs inputs;}; in { - packages = import ./pkgs {inherit pkgs inputs;}; + packages = lowrisc_pkgs; formatter = pkgs.alejandra; }); in diff --git a/pkgs/default.nix b/pkgs/default.nix index 7db6812..0e144e8 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -9,6 +9,7 @@ { verilator_ot = import ./verilator {inherit pkgs;}; python_ot = pkgs.callPackage ./python_ot {inherit inputs;}; + llvm_cheriot = import ./llvm_cheriot.nix {inherit pkgs;}; } // pkgs.lib.optionalAttrs (pkgs.system == "x86_64-linux") { lowrisc-toolchain-gcc-rv32imcb = pkgs.callPackage ./lowrisc-toolchain-gcc-rv32imcb.nix {}; diff --git a/pkgs/llvm_cheriot.nix b/pkgs/llvm_cheriot.nix new file mode 100644 index 0000000..563084b --- /dev/null +++ b/pkgs/llvm_cheriot.nix @@ -0,0 +1,28 @@ +# Copyright lowRISC contributors. +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 +{pkgs, ...}: +pkgs.stdenv.mkDerivation rec { + name = "llvm-cheriot"; + src = pkgs.fetchFromGitHub { + owner = "CHERIoT-Platform"; + repo = "llvm-project"; + rev = "432ef65c96c9f8be8b7802a8bfb9bcf3609b2b79"; + sha256 = "sha256-ddLnG1olyRYxvKJ0zKEbThq/ZnxP68X32+1ws76WeV4="; + }; + sourceRoot = "${src.name}/llvm"; + nativeBuildInputs = with pkgs; [cmake ninja lld python3]; + cmakeFlags = [ + "-DCMAKE_BUILD_TYPE=Release" + "-DLLVM_ENABLE_ASSERTIONS=True" + "-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld'" + "-DLLVM_ENABLE_UNWIND_TABLES=NO" + "-DLLVM_TARGETS_TO_BUILD=RISCV" + "-DLLVM_DISTRIBUTION_COMPONENTS='clang;clangd;lld;llvm-objdump'" + ]; + meta = { + description = "The clang/LLVM compiler with CHERIoT support."; + homepage = "https://cheriot.org/"; + license = pkgs.lib.licenses.asl20-llvm; + }; +}