Use a nix flake with oxalica/rust-overlay instead of a shell.nix

This commit is contained in:
Tristan Daniël Maat 2021-03-31 02:12:04 +01:00
parent c51feeac77
commit 620b84fd46
Signed by: tlater
GPG key ID: 49670FD774E43268
5 changed files with 107 additions and 9 deletions

37
flake.nix Normal file
View file

@ -0,0 +1,37 @@
{
description = "tlater.net web server";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-20.09";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }@inputs:
flake-utils.lib.simpleFlake {
inherit self nixpkgs;
name = "tlaternet";
preOverlays = [ rust-overlay.overlay ];
shell = { pkgs }:
let
rust_channel =
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(rust_channel.override {
extensions =
[ "rust-src" "rust-analysis" "rust-analyzer-preview" ];
})
pkgconfig
];
buildInputs = with pkgs; [ openssl ];
};
};
}