39 lines
944 B
Nix
39 lines
944 B
Nix
{
|
|
inputs = {
|
|
naersk.url = "github:nix-community/naersk/master";
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
|
|
utils.url = "github:numtide/flake-utils";
|
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, utils, naersk, rust-overlay }:
|
|
utils.lib.eachDefaultSystem (system:
|
|
let
|
|
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [ (import rust-overlay) ];
|
|
};
|
|
|
|
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
|
|
naersk-lib = pkgs.callPackage naersk {
|
|
cargo = toolchain;
|
|
rustc = toolchain;
|
|
};
|
|
|
|
in
|
|
{
|
|
defaultPackage = naersk-lib.buildPackage ./.;
|
|
devShell = with pkgs; mkShell {
|
|
nativeBuildInputs = [
|
|
toolchain
|
|
];
|
|
shellHook = ''
|
|
export CARGO_HOME=$(pwd)/.cargo
|
|
'';
|
|
};
|
|
});
|
|
}
|