A (very dirty) configuration example of Project Panama.
at main 82 lines 1.9 kB view raw
1{ 2 description = "A Nix-flake-based Rust development environment"; 3 4 inputs = { 5 nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs 6 fenix = { 7 url = "https://flakehub.com/f/nix-community/fenix/0.1"; 8 inputs.nixpkgs.follows = "nixpkgs"; 9 }; 10 }; 11 12 outputs = 13 { self, ... }@inputs: 14 15 let 16 supportedSystems = [ 17 "x86_64-linux" 18 "aarch64-linux" 19 "x86_64-darwin" 20 "aarch64-darwin" 21 ]; 22 forEachSupportedSystem = 23 f: 24 inputs.nixpkgs.lib.genAttrs supportedSystems ( 25 system: 26 f { 27 pkgs = import inputs.nixpkgs { 28 inherit system; 29 overlays = [ 30 inputs.self.overlays.default 31 ]; 32 }; 33 } 34 ); 35 in 36 { 37 overlays.default = final: prev: { 38 rustToolchain = 39 with inputs.fenix.packages.${prev.stdenv.hostPlatform.system}; 40 combine ( 41 with stable; 42 [ 43 clippy 44 rustc 45 cargo 46 rustfmt 47 rust-src 48 ] 49 ); 50 }; 51 52 devShells = forEachSupportedSystem ( 53 { pkgs }: 54 { 55 default = pkgs.mkShell { 56 packages = with pkgs; [ 57 clang 58 rustToolchain 59 openssl 60 pkg-config 61 cargo-deny 62 cargo-edit 63 cargo-watch 64 rust-analyzer 65 66 # Panama FFI 67 jextract 68 rust-cbindgen 69 70 zulu25 71 ]; 72 73 env = { 74 # Required by rust-analyzer 75 RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library"; 76 CPATH = "${pkgs.glibc.dev}/include"; 77 }; 78 }; 79 } 80 ); 81 }; 82}