Skip to content

Commit

Permalink
feat: working flake
Browse files Browse the repository at this point in the history
  • Loading branch information
DieracDelta committed May 14, 2024
1 parent 9511a4f commit df915a1
Show file tree
Hide file tree
Showing 2 changed files with 242 additions and 0 deletions.
183 changes: 183 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
description = "Flake for c2rust";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
};
oxalica = {
url = "github:oxalica/rust-overlay";
};
};

outputs = inputs@{ self, nixpkgs, utils, fenix, oxalica}:
utils.lib.eachDefaultSystem (system:
let
fenixStable = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-r/8YBFuFa4hpwgE3FnME7nQA2Uc1uqj0eCE1NWmI1u0";
};
pkgs = import nixpkgs {
inherit system;
overlays = [
(import oxalica)
];
config = {
allowUnfree = true;
};
};
in {
defaultPackage = self.devShell.${system};
devShell = pkgs.mkShell.override { } {

LIBCLANG_PATH = "${pkgs.llvmPackages_14.libclang.lib}/lib";
CMAKE_LLVM_DIR = "${pkgs.llvmPackages_14.libllvm.dev}/lib/cmake/llvm";
CMAKE_CLANG_DIR = "${pkgs.llvmPackages_14.libclang.dev}/lib/cmake/clang";
shellHook = ''
export CARGO_TARGET_DIR="$(git rev-parse --show-toplevel)/target_dirs/nix_rustc";
'';
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
buildInputs =
with pkgs; [
clangStdenv.cc
llvmPackages_14.libclang
pkg-config
fenix.packages.${system}.rust-analyzer
llvmPackages_14.clang
cmake
llvmPackages_14.llvm
llvmPackages_14.libllvm
openssl
python3
zlib
(rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
];
};
});
}

0 comments on commit df915a1

Please sign in to comment.