From 7c0c2299349d81bdffe38f901770d501c5ad625f Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 18 Oct 2022 12:15:31 +0200 Subject: move refresh_toolchain --- shell.nix | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'shell.nix') diff --git a/shell.nix b/shell.nix index e82bce78..36a290a9 100644 --- a/shell.nix +++ b/shell.nix @@ -15,20 +15,10 @@ let in { - /* --- Rust Shell --- * Use it to compile Garage */ rust = pkgs.mkShell { - shellHook = '' -function refresh_toolchain { - nix copy \ - --to 's3://nix?endpoint=garage.deuxfleurs.fr®ion=garage&secret-key=/etc/nix/signing-key.sec' \ - $(nix-store -qR \ - $(nix-build --quiet --no-build-output --no-out-link nix/toolchain.nix)) -} - ''; - nativeBuildInputs = [ #pkgs.rustPlatform.rust.rustc pkgs.rustPlatform.rust.cargo @@ -67,6 +57,15 @@ function refresh_toolchain { */ release = pkgs.mkShell { shellHook = '' +function refresh_toolchain { + pass show deuxfleurs/nix_priv_key > /tmp/nix-signing-key.sec + nix copy \ + --to 's3://nix?endpoint=garage.deuxfleurs.fr®ion=garage&secret-key=/tmp/nix-signing-key.sec' \ + $(nix-store -qR \ + $(nix-build --no-build-output --no-out-link nix/toolchain.nix)) + rm /tmp/nix-signing-key.sec +} + function to_s3 { aws \ --endpoint-url https://garage.deuxfleurs.fr \ -- cgit v1.2.3 From 8fc93abc79eb3fa74facda7ca2e8798ff7d01658 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 18 Oct 2022 13:17:30 +0200 Subject: Some things are now in result-bin --- shell.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shell.nix') diff --git a/shell.nix b/shell.nix index 36a290a9..3b98f8b1 100644 --- a/shell.nix +++ b/shell.nix @@ -71,7 +71,7 @@ function to_s3 { --endpoint-url https://garage.deuxfleurs.fr \ --region garage \ s3 cp \ - ./result/bin/garage \ + ./result-bin/bin/garage \ s3://garagehq.deuxfleurs.fr/_releases/''${DRONE_TAG:-$DRONE_COMMIT}/''${TARGET}/garage } -- cgit v1.2.3 From a54a63c491556b746dab02a0766034af70c61457 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 18 Oct 2022 14:19:19 +0200 Subject: Add function to upload a build and its dependencies to the cache to faster bootstrap new runner nodes --- shell.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'shell.nix') diff --git a/shell.nix b/shell.nix index 3b98f8b1..480bc349 100644 --- a/shell.nix +++ b/shell.nix @@ -66,6 +66,18 @@ function refresh_toolchain { rm /tmp/nix-signing-key.sec } +function refresh_cache { + pass show deuxfleurs/nix_priv_key > /tmp/nix-signing-key.sec + for attr in clippy.amd64 test.amd64 pkgs.{amd64,i386,arm,arm64}.{debug,release}; do + echo "Updating cache for ''${attr}" + derivation=$(nix-instantiate --attr ''${attr}) + nix copy \ + --to 's3://nix?endpoint=garage.deuxfleurs.fr®ion=garage&secret-key=/tmp/nix-signing-key.sec' \ + $(nix-store -qR ''${derivation%\!bin}) + done + rm /tmp/nix-signing-key.sec +} + function to_s3 { aws \ --endpoint-url https://garage.deuxfleurs.fr \ -- cgit v1.2.3