From cc55a8cfe1878788ffa2f0db0ae16a3b859040ff Mon Sep 17 00:00:00 2001 From: Vika Date: Wed, 5 May 2021 00:06:35 +0300 Subject: Switched to naersk for building crates with Nix... that requires unstable Cargo! --- flake.nix | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'flake.nix') 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; -- cgit 1.4.1