2022-05-20 12:32:45 +01:00
|
|
|
{
|
|
|
|
description = "Another cool rust disaster from samw.";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
utils.url = "github:numtide/flake-utils";
|
|
|
|
devshell.url = "github:numtide/devshell";
|
|
|
|
naersk.url = "github:nix-community/naersk";
|
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, utils, naersk, devshell, rust-overlay }:
|
|
|
|
utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
2022-05-20 13:45:39 +01:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [ (import rust-overlay) ];
|
|
|
|
};
|
|
|
|
rust = pkgs.rust-bin.stable.latest.default;
|
|
|
|
# Override naersk to use our chosen rust version from rust-overlay
|
2022-05-20 12:32:45 +01:00
|
|
|
naersk-lib = naersk.lib.${system}.override {
|
|
|
|
cargo = rust;
|
2022-05-20 13:45:39 +01:00
|
|
|
rustc = rust;
|
|
|
|
};
|
|
|
|
in rec {
|
|
|
|
packages.default = naersk-lib.buildPackage {
|
|
|
|
pname = "cool-rust-disaster";
|
|
|
|
root = ./.;
|
2022-05-20 12:32:45 +01:00
|
|
|
};
|
|
|
|
|
2022-05-20 13:45:39 +01:00
|
|
|
apps.default = utils.lib.mkApp { drv = packages.default; };
|
2022-05-20 12:32:45 +01:00
|
|
|
|
|
|
|
# Provide a dev env with rust and rls
|
|
|
|
devShell = let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
2022-05-20 13:45:39 +01:00
|
|
|
overlays = [ devshell.overlay ];
|
2022-05-20 12:32:45 +01:00
|
|
|
};
|
|
|
|
in pkgs.devshell.mkShell {
|
|
|
|
packages = with pkgs; [ (rust.override { extensions = [ "rls" ]; }) ];
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|