2022-12-27 04:51:32 +00:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
naersk.url = "github:nix-community/naersk/master";
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
utils.url = "github:numtide/flake-utils";
|
2022-12-28 02:14:29 +00:00
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
2022-12-27 04:51:32 +00:00
|
|
|
};
|
|
|
|
|
2023-06-18 00:46:31 +00:00
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
utils,
|
|
|
|
naersk,
|
|
|
|
rust-overlay,
|
|
|
|
}:
|
|
|
|
utils.lib.eachDefaultSystem (system: let
|
|
|
|
overlays = [rust-overlay.overlays.default];
|
|
|
|
pkgs = import nixpkgs {inherit system overlays;};
|
|
|
|
rust_pkgs =
|
|
|
|
pkgs.rust-bin.selectLatestNightlyWith
|
|
|
|
(
|
|
|
|
toolchain:
|
2023-01-10 15:30:52 +00:00
|
|
|
toolchain.default.override {
|
2023-06-18 00:46:31 +00:00
|
|
|
extensions = ["rust-src" "rust-analyzer" "rust-docs" "clippy" "miri"];
|
2023-01-10 15:30:52 +00:00
|
|
|
}
|
2023-06-18 00:46:31 +00:00
|
|
|
);
|
|
|
|
naersk-lib = pkgs.callPackage naersk {};
|
|
|
|
in {
|
|
|
|
defaultPackage = naersk-lib.buildPackage ./.;
|
|
|
|
devShell = with pkgs;
|
|
|
|
mkShell {
|
2022-12-27 04:51:32 +00:00
|
|
|
buildInputs = [
|
2023-01-10 15:30:52 +00:00
|
|
|
rust_pkgs
|
|
|
|
# rust's compiler is quite powerful enough to the point where
|
|
|
|
# a REPL is not really necessary.
|
|
|
|
# Rely on the compiler and bacon 99% of the time
|
|
|
|
# only use REPL if you need to explore/prototype
|
|
|
|
# In that case, might as well put the code into sandbox
|
|
|
|
pkgs.evcxr
|
|
|
|
pkgs.bacon
|
2022-12-27 04:51:32 +00:00
|
|
|
];
|
|
|
|
shellHook = ''
|
|
|
|
# nix flake update # is this even needed?
|
|
|
|
'';
|
|
|
|
};
|
2023-06-18 00:46:31 +00:00
|
|
|
});
|
2022-12-27 04:51:32 +00:00
|
|
|
}
|