domani/flake.nix

40 lines
979 B
Nix
Raw Normal View History

2023-05-03 07:58:06 +00:00
{
inputs = {
naersk.url = "github:nix-community/naersk/master";
2023-05-04 12:56:31 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
2023-05-03 07:58:06 +00:00
utils.url = "github:numtide/flake-utils";
2023-05-08 16:25:51 +00:00
rust-overlay.url = "github:oxalica/rust-overlay";
2023-05-03 07:58:06 +00:00
};
2023-05-08 16:25:51 +00:00
outputs = { self, nixpkgs, utils, naersk, rust-overlay }:
2023-05-03 07:58:06 +00:00
utils.lib.eachDefaultSystem (system:
let
2023-05-08 16:25:51 +00:00
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;
};
2023-05-03 07:58:06 +00:00
in
{
defaultPackage = naersk-lib.buildPackage ./.;
devShell = with pkgs; mkShell {
2023-05-08 16:25:51 +00:00
nativeBuildInputs = [
toolchain
];
2023-05-04 12:56:31 +00:00
shellHook = ''
2023-05-15 16:03:16 +00:00
source $(pwd)/.env.dev
2023-05-04 12:56:31 +00:00
export CARGO_HOME=$(pwd)/.cargo
'';
2023-05-03 07:58:06 +00:00
};
});
}