summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix80
1 files changed, 26 insertions, 54 deletions
diff --git a/flake.nix b/flake.nix
index 4b7dbad..a94eb7d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,62 +1,34 @@
 {
   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";
+    fenix = {
+      url = "github:nix-community/fenix";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
   };
-  outputs = { self, flake-utils, mozilla, naersk, nixpkgs }: flake-utils.lib.eachDefaultSystem (
+  outputs = { self, flake-utils, nixpkgs, fenix }: 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
-            ];
-          };
-        }
+    let
+      pkgs = import nixpkgs {
+        inherit system;
+        overlays = [ fenix.overlay ];
+      };
+    in
+    {
+      devShell = pkgs.mkShell {
+        buildInputs = with pkgs; [
+          (fenix.packages.${system}.complete.withComponents [
+            "cargo"
+            "clippy"
+            "rust-src"
+            "rustc"
+            "rustfmt"
+          ])
+          rust-analyzer-nightly
+          cargo-edit
+        ];
+      };
+    }
   );
 }