From 892d698b9782ba8fbd3f503e5e770c57d2941f42 Mon Sep 17 00:00:00 2001 From: revol-xut Date: Sat, 18 Nov 2023 15:31:13 +0100 Subject: [PATCH] using very latest rust version --- derivation.nix | 7 ++-- flake.lock | 95 +++++++++++++++++++++++++++----------------------- flake.nix | 83 +++++++++++++++++++++++++------------------ 3 files changed, 105 insertions(+), 80 deletions(-) diff --git a/derivation.nix b/derivation.nix index 0ba849b..a36b5a3 100644 --- a/derivation.nix +++ b/derivation.nix @@ -1,12 +1,13 @@ -{ craneLib, src, lib, cmake, pkg-config, protobuf, grpc, openssl, postgresql}: +{ buildPackage, lib, pkg-config, cmake, protobuf, postgresql, zlib, openssl}: -craneLib.buildPackage { +buildPackage { pname = "lizard"; version = "0.1.0"; src = ./.; - buildInputs = [ cmake protobuf grpc openssl pkg-config postgresql ]; + #cargoSha256 = lib.fakeSha256; + buildInputs = [ cmake protobuf openssl pkg-config postgresql ]; meta = { description = "Service which serves the current state of the network"; diff --git a/flake.lock b/flake.lock index 4ccd7de..5c8e824 100644 --- a/flake.lock +++ b/flake.lock @@ -1,47 +1,61 @@ { "nodes": { - "crane": { + "fenix": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1700288458, + "narHash": "sha256-jmfGuPOW3YnuEfGjB4jsb5Be5dchEGOUHSUTOiE1UNk=", + "owner": "nix-community", + "repo": "fenix", + "rev": "a8a70dfe2b9d8a40a51642c554fee83942850c49", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "naersk": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": [ - "utils" - ], "nixpkgs": [ "nixpkgs" - ], - "rust-overlay": "rust-overlay" + ] }, "locked": { - "lastModified": 1682796879, - "narHash": "sha256-X0oDZylzDXBt7RBtYXBvFexARRFvousej15feeemAx0=", - "owner": "ipetkov", - "repo": "crane", - "rev": "db21a44eb056ef65a33d9d2648ecc964b4acaddc", + "lastModified": 1698420672, + "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=", + "owner": "nix-community", + "repo": "naersk", + "rev": "aeb58d5e8faead8980a807c840232697982d47b9", "type": "github" }, "original": { - "owner": "ipetkov", - "repo": "crane", + "owner": "nix-community", + "repo": "naersk", "type": "github" } }, - "flake-compat": { - "flake": false, + "nixpkgs": { "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "lastModified": 1699963925, + "narHash": "sha256-LE7OV/SwkIBsCpAlIPiFhch/J+jBDGEZjNfdnzCnCrY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "bf744fe90419885eefced41b3e5ae442d732712d", "type": "github" }, "original": { - "owner": "edolstra", - "repo": "flake-compat", + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", "type": "github" } }, - "nixpkgs": { + "nixpkgs_2": { "locked": { "lastModified": 1700097215, "narHash": "sha256-ODQ3gBTv1iHd7lG21H+ErVISB5wVeOhd/dEogOqHs/I=", @@ -59,33 +73,26 @@ }, "root": { "inputs": { - "crane": "crane", - "nixpkgs": "nixpkgs", + "fenix": "fenix", + "naersk": "naersk", + "nixpkgs": "nixpkgs_2", "utils": "utils" } }, - "rust-overlay": { - "inputs": { - "flake-utils": [ - "crane", - "flake-utils" - ], - "nixpkgs": [ - "crane", - "nixpkgs" - ] - }, + "rust-analyzer-src": { + "flake": false, "locked": { - "lastModified": 1680488274, - "narHash": "sha256-0vYMrZDdokVmPQQXtFpnqA2wEgCCUXf5a3dDuDVshn0=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "7ec2ff598a172c6e8584457167575b3a1a5d80d8", + "lastModified": 1700247620, + "narHash": "sha256-+Xg0qZLbC9dZx0Z6JbaVHR/BklAr2I83dzKLB8r41c8=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "255eed40c45fcf108ba844b4ad126bdc4e7a18df", "type": "github" }, "original": { - "owner": "oxalica", - "repo": "rust-overlay", + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 6b28004..e03d962 100644 --- a/flake.nix +++ b/flake.nix @@ -1,45 +1,62 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; - utils.url = "github:numtide/flake-utils"; - crane = { - url = "github:ipetkov/crane"; + + naersk = { + url = "github:nix-community/naersk"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.flake-utils.follows = "utils"; }; - }; - outputs = inputs@{ self, nixpkgs, utils, crane }: - utils.lib.eachDefaultSystem - (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - craneLib = crane.lib.${system}; - package = pkgs.callPackage ./derivation.nix { craneLib = craneLib; }; - in - rec { - checks = packages; - packages = { - lizard = package; - default = package; + utils = { + url = "github:numtide/flake-utils"; }; - devShells.default = pkgs.mkShell { - nativeBuildInputs = (with packages.lizard; nativeBuildInputs ++ buildInputs); + fenix = { + url = "github:nix-community/fenix"; }; + }; - apps = { - lizard = utils.lib.mkApp { drv = packages.lizard; }; - default = apps.lizard; - }; - }) // { - nixosModules = rec { - default = funnel; - funnel = import ./nixos-module; - }; - overlays.default = final: prev: { - inherit (self.packages.${prev.system}) - lizard; + outputs = inputs@{ self, nixpkgs, utils, naersk, fenix }: + utils.lib.eachDefaultSystem + (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + + toolchain = with fenix.packages.${system}; combine [ + latest.cargo + latest.rustc + ]; + + package = pkgs.callPackage ./derivation.nix { + buildPackage = (naersk.lib.${system}.override { + cargo = toolchain; + rustc = toolchain; + }).buildPackage; + }; + in + rec { + checks = packages; + packages = { + lizard = package; + default = package; + }; + + devShells.default = pkgs.mkShell { + nativeBuildInputs = (with packages.lizard; nativeBuildInputs ++ buildInputs); + }; + + apps = { + lizard = utils.lib.mkApp { drv = packages.lizard; }; + default = apps.lizard; + }; + }) // { + nixosModules = rec { + default = funnel; + funnel = import ./nixos-module; + }; + overlays.default = final: prev: { + inherit (self.packages.${prev.system}) + lizard; + }; }; - }; }