summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix62
1 files changed, 62 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..4b7dbad
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,62 @@
+{
+ inputs = {
+ flake-utils.url = "github:numtide/flake-utils";
+ mozilla = {
+ url = "github:mozilla/nixpkgs-mozilla";
+ flake = false;
+ };
+ naersk.url = "github:nmattia/naersk";
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ };
+ outputs = { self, flake-utils, mozilla, naersk, nixpkgs }: flake-utils.lib.eachDefaultSystem (
+ system:
+ let
+ overlay = final: prev:
+ let
+ # rustChannel = final.rustChannelOf {
+ # channel = "stable";
+ # date = "2021-09-09";
+ # sha256 = "sha256-HNIlEerJvk6sBfd8zugzwSgSiHcQH8ZbqWQn9BGfmpo=";
+ # };
+ rustChannel = final.rustChannelOf {
+ channel = "nightly";
+ date = "2021-10-25";
+ sha256 = "sha256-/zS2GztCeH6kc3ZjhBRvT7Pbnea5JvGBuWdZmagh788=";
+ };
+ rust = rustChannel.rust.override {
+ extensions = [ "rust-src" ];
+ };
+ in
+ {
+ rustc = rust;
+ cargo = rust;
+ };
+ pkgs = import nixpkgs {
+ inherit system;
+ overlays = [
+ (import "${mozilla}/rust-overlay.nix")
+ overlay
+ ];
+ };
+ naerskLib = pkgs.callPackage "${naersk}/default.nix" {};
+ persea = naerskLib.buildPackage {
+ pname = "persea";
+ src = ./.;
+ };
+ in
+ {
+ defaultPackage = persea;
+ devShell = pkgs.mkShell {
+ buildInputs = with pkgs; [
+ cargo
+ cargo-edit
+ rust-analyzer
+ rustfmt
+
+ pkg-config
+ openssl
+ ];
+ };
+ }
+ );
+}