aboutsummaryrefslogtreecommitdiff
path: root/shell.nix
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2022-10-18 14:16:52 +0000
committerAlex <alex@adnab.me>2022-10-18 14:16:52 +0000
commit7bc9fd34b250384d1b80ed28dc6c9e6abcda69ae (patch)
tree2aa704a85ec0fe7ef8e28daaa1c71fd449be1453 /shell.nix
parent4582a8f34aba85ff7b0a56935f27cc166819dec1 (diff)
parenta54a63c491556b746dab02a0766034af70c61457 (diff)
downloadgarage-7bc9fd34b250384d1b80ed28dc6c9e6abcda69ae.tar.gz
garage-7bc9fd34b250384d1b80ed28dc6c9e6abcda69ae.zip
Merge pull request 'upgrade Nix toolchain' (#400) from upgrade-toolchain into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/400
Diffstat (limited to 'shell.nix')
-rw-r--r--shell.nix33
1 files changed, 22 insertions, 11 deletions
diff --git a/shell.nix b/shell.nix
index e82bce78..480bc349 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&region=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,12 +57,33 @@ 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&region=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 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&region=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 \
--region garage \
s3 cp \
- ./result/bin/garage \
+ ./result-bin/bin/garage \
s3://garagehq.deuxfleurs.fr/_releases/''${DRONE_TAG:-$DRONE_COMMIT}/''${TARGET}/garage
}