From 5efcdc0de3121da18e7531a9f8196ef38cecd93c Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 25 Apr 2023 14:46:47 +0200 Subject: [PATCH] Update rust toolchain to 1.68 and simplify Nix stuff --- flake.lock | 99 +++++++++++++++++++++++++++++++++++++------------ flake.nix | 20 ++++++++-- nix/common.nix | 25 +++++-------- nix/compile.nix | 2 +- nix/kaniko.nix | 4 +- 5 files changed, 106 insertions(+), 44 deletions(-) diff --git a/flake.lock b/flake.lock index beba6a7b..ac5b10e2 100644 --- a/flake.lock +++ b/flake.lock @@ -41,12 +41,15 @@ } }, "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -56,12 +59,15 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -72,44 +78,61 @@ }, "nixpkgs": { "locked": { - "lastModified": 1665657542, - "narHash": "sha256-mojxNyzbvmp8NtVtxqiHGhRfjCALLfk9i/Uup68Y5q8=", + "lastModified": 1682109806, + "narHash": "sha256-d9g7RKNShMLboTWwukM+RObDWWpHKaqTYXB48clBWXI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a3073c49bc0163fea6a121c276f526837672b555", + "rev": "2362848adf8def2866fabbffc50462e929d7fffb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1682423271, + "narHash": "sha256-WHhl1GiOij1ob4cTLL+yhqr+vFOUH8E5wAX8Ir8fvjE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "94517a501434a627c5d9e72ac6e7f26174b978d3", "type": "github" }, "original": { "owner": "NixOS", "repo": "nixpkgs", - "rev": "a3073c49bc0163fea6a121c276f526837672b555", + "rev": "94517a501434a627c5d9e72ac6e7f26174b978d3", "type": "github" } }, "root": { "inputs": { "cargo2nix": "cargo2nix", - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs" - } - }, - "rust-overlay": { - "inputs": { + "flake-compat": [ + "cargo2nix", + "flake-compat" + ], "flake-utils": [ "cargo2nix", "flake-utils" ], - "nixpkgs": [ - "cargo2nix", - "nixpkgs" - ] + "nixpkgs": "nixpkgs_2" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1664247556, - "narHash": "sha256-J4vazHU3609ekn7dr+3wfqPo5WGlZVAgV7jfux352L0=", + "lastModified": 1682389182, + "narHash": "sha256-8t2nmFnH+8V48+IJsf8AK51ebXNlVbOSVYOpiqJKvJE=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "524db9c9ea7bc7743bb74cdd45b6d46ea3fcc2ab", + "rev": "74f1a64dd28faeeb85ef081f32cad2989850322c", "type": "github" }, "original": { @@ -117,6 +140,36 @@ "repo": "rust-overlay", "type": "github" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 7eb9e33b..3ae3668d 100644 --- a/flake.nix +++ b/flake.nix @@ -2,16 +2,30 @@ description = "Garage, an S3-compatible distributed object store for self-hosted deployments"; + # Nixpkgs unstable as of 2023-04-25, has rustc v1.68 inputs.nixpkgs.url = - "github:NixOS/nixpkgs/a3073c49bc0163fea6a121c276f526837672b555"; + "github:NixOS/nixpkgs/94517a501434a627c5d9e72ac6e7f26174b978d3"; + inputs.cargo2nix = { # As of 2022-10-18: two small patches over unstable branch, one for clippy and one to fix feature detection url = "github:Alexis211/cargo2nix/a7a61179b66054904ef6a195d8da736eaaa06c36"; + + # As of 2023-04-25: + # - my two patches were merged into unstable (one for clippy and one to "fix" feature detection) + # - rustc v1.66 + # url = "github:cargo2nix/cargo2nix/8fb57a670f7993bfc24099c33eb9c5abb51f29a2"; + + # Rust overlay as of 2023-04-25 + inputs.rust-overlay.url = + "github:oxalica/rust-overlay/74f1a64dd28faeeb85ef081f32cad2989850322c"; + inputs.nixpkgs.follows = "nixpkgs"; }; - inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs, cargo2nix, flake-utils }: + inputs.flake-utils.follows = "cargo2nix/flake-utils"; + inputs.flake-compat.follows = "cargo2nix/flake-compat"; + + outputs = { self, nixpkgs, cargo2nix, flake-utils, ... }: let git_version = self.lastModifiedDate; compile = import ./nix/compile.nix; diff --git a/nix/common.nix b/nix/common.nix index 57f354dd..acc5ce7e 100644 --- a/nix/common.nix +++ b/nix/common.nix @@ -1,19 +1,14 @@ -rec { - # * Fixed dependencies - pkgsSrc = fetchTarball { - # As of 2022-10-13 +let + lock = builtins.fromJSON (builtins.readFile ../flake.lock); + flakeCompatRev = lock.nodes.flake-compat.locked.rev; + flakeCompat = fetchTarball { url = - "https://github.com/NixOS/nixpkgs/archive/a3073c49bc0163fea6a121c276f526837672b555.zip"; - sha256 = "1bz632psfbpmicyzjb8b4265y50shylccvfm6ry6mgnv5hvz324s"; + "https://github.com/edolstra/flake-compat/archive/${flakeCompatRev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; }; - cargo2nixSrc = fetchGit { - # As of 2022-10-18: two small patches over unstable branch, one for clippy and one to fix feature detection - url = "https://github.com/Alexis211/cargo2nix"; - ref = "custom_unstable"; - rev = "a7a61179b66054904ef6a195d8da736eaaa06c36"; - }; - - # * Shared objects - cargo2nix = import cargo2nixSrc; + flake = ((import flakeCompat) { src = ../.; }).defaultNix; +in rec { + pkgsSrc = flake.inputs.nixpkgs; + cargo2nix = flake.inputs.cargo2nix; cargo2nixOverlay = cargo2nix.overlays.default; } diff --git a/nix/compile.nix b/nix/compile.nix index 54e920db..c2f557da 100644 --- a/nix/compile.nix +++ b/nix/compile.nix @@ -32,7 +32,7 @@ let */ toolchainOptions = if target == null || target == "x86_64-unknown-linux-musl" || target == "aarch64-unknown-linux-musl" then { - rustVersion = "1.63.0"; + rustVersion = "1.68.0"; extraRustComponents = [ "clippy" ]; } else { rustToolchain = pkgs.symlinkJoin { diff --git a/nix/kaniko.nix b/nix/kaniko.nix index 64cadd14..8380fa2f 100644 --- a/nix/kaniko.nix +++ b/nix/kaniko.nix @@ -1,13 +1,13 @@ pkgs: pkgs.buildGoModule rec { pname = "kaniko"; - version = "1.6.0"; + version = "1.9.2"; src = pkgs.fetchFromGitHub { owner = "GoogleContainerTools"; repo = "kaniko"; rev = "v${version}"; - sha256 = "1fnclr556avxay6pvgw5ya3xbxfnf2gv4njq2hr4fd6fcjyslq5h"; + sha256 = "dXQ0/o1qISv+sjNVIpfF85bkbM9sGOGwqVbWZpMWfMY="; }; vendorSha256 = null;