-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The current nix expression doesn't build for me on nixos on 23.11 stable (bunch of various build errors that I can share if useful). This nix flake builds the project without erroring (e.g. `nix develop -c cargo build --release`) and also brings in the rust toolchain declaratively with nix instead of with rustup.
- Loading branch information
Showing
2 changed files
with
242 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
]; | ||
}; | ||
}); | ||
} |