dotfiles/templates/rust/flake.nix

36 lines
1.1 KiB
Nix
Raw Permalink Normal View History

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
};
outputs = { self, nixpkgs, utils, naersk, rust-overlay }:
utils.lib.eachDefaultSystem (system:
let
overlays = [ rust-overlay.overlays.default ];
pkgs = import nixpkgs { inherit system overlays; };
naersk-lib = pkgs.callPackage naersk { };
in
{
defaultPackage = naersk-lib.buildPackage ./.;
devShell = with pkgs; mkShell {
buildInputs = [
(pkgs.rust-bin.selectLatestNightlyWith
(
toolchain:
toolchain.default.override {
extensions = [ "rust-src" ];
}
))
pkgs.rust-analyzer
];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
shellHook = ''
# nix flake update # is this even needed?
'';
};
});
}