about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--flake.lock22
-rw-r--r--flake.nix25
2 files changed, 38 insertions, 9 deletions
diff --git a/flake.lock b/flake.lock
index 7b1a509..d9567e8 100644
--- a/flake.lock
+++ b/flake.lock
@@ -15,6 +15,27 @@
         "type": "github"
       }
     },
+    "naersk": {
+      "inputs": {
+        "nixpkgs": [
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1618844365,
+        "narHash": "sha256-Z9t0rr+5OG/ru3jdg3jivfYVU4ydV/nqt8UwIut7uHs=",
+        "owner": "nmattia",
+        "repo": "naersk",
+        "rev": "32e3ba39d9d83098b13720a4384bdda191dd0445",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nmattia",
+        "ref": "master",
+        "repo": "naersk",
+        "type": "github"
+      }
+    },
     "nixpkgs": {
       "locked": {
         "lastModified": 1618743970,
@@ -32,6 +53,7 @@
     "root": {
       "inputs": {
         "flake-utils": "flake-utils",
+        "naersk": "naersk",
         "nixpkgs": "nixpkgs",
         "rust": "rust"
       }
diff --git a/flake.nix b/flake.nix
index 007218a..0cf7d95 100644
--- a/flake.nix
+++ b/flake.nix
@@ -9,8 +9,15 @@
       inputs.flake-utils.follows = "flake-utils";
       inputs.nixpkgs.follows = "nixpkgs";
     };
+    naersk = {
+      type = "github";
+      owner = "nmattia";
+      repo = "naersk";
+      ref = "master";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
   };
-  outputs = { self, nixpkgs, rust, flake-utils }: let
+  outputs = { self, nixpkgs, rust, flake-utils, naersk }: let
     supportedSystems = ["aarch64-linux" "x86_64-linux"];
     forAllSystems = f: flake-utils.lib.eachSystem supportedSystems f;
   in forAllSystems (system: let
@@ -20,15 +27,15 @@
     };
     rust-bin = pkgs.rust-bin.stable.latest;
     packages = {
-      kittybox-micropub = { stdenv, lib, openssl, pkg-config, redis, rustPlatform }:
-      rustPlatform.buildRustPackage {
-        name = "kittybox-micropub";
+      kittybox-micropub = { stdenv, lib, openssl, pkg-config, redis, naersk-lib }:
+      naersk-lib.buildPackage {
+        pname = "kittybox-micropub";
         version = "0.1.0";
 
         src = ./.;
 
         #cargoSha256 = nixpkgs.lib.fakeSha256;
-        cargoHash = "sha256-c862J7qXkrCAA6+gFn/bX5NXrgu/1HtCH1DqOpQePgk=";
+        #cargoHash = "sha256-c862J7qXkrCAA6+gFn/bX5NXrgu/1HtCH1DqOpQePgk=";
 
         buildInputs = [ openssl ];
         nativeBuildInputs = [ pkg-config ];
@@ -44,12 +51,12 @@
     };
   in {
     packages = let
-      rustPlatform = pkgs.makeRustPlatform {
-        rustc = rust-bin.minimal;
-        cargo = rust-bin.minimal;
+      naersk-lib = naersk.lib.${system}.override {
+        rustc = pkgs.rust-bin.nightly.latest.minimal;
+        cargo = pkgs.rust-bin.nightly.latest.minimal;
       };
     in {
-      kittybox-micropub = pkgs.callPackage packages.kittybox-micropub { inherit rustPlatform; };
+      kittybox-micropub = pkgs.callPackage packages.kittybox-micropub { inherit naersk-lib; };
     };
     defaultPackage = self.packages.${system}.kittybox-micropub;