aboutsummaryrefslogtreecommitdiff
path: root/shell.nix
diff options
context:
space:
mode:
authorMendes <mendes.oulamara@pm.me>2022-10-04 18:14:49 +0200
committerMendes <mendes.oulamara@pm.me>2022-10-04 18:14:49 +0200
commit829f815a897b04986559910bbcbf53625adcdf20 (patch)
tree6db3c27cff2aded754a641d1f2b05c83be701267 /shell.nix
parent99f96b9564c9c841dc6c56f1255a6e70ff884d46 (diff)
parenta096ced35562bd0a8877a1ee2f755be1edafe343 (diff)
downloadgarage-829f815a897b04986559910bbcbf53625adcdf20.tar.gz
garage-829f815a897b04986559910bbcbf53625adcdf20.zip
Merge remote-tracking branch 'origin/main' into optimal-layout
Diffstat (limited to 'shell.nix')
-rw-r--r--shell.nix132
1 files changed, 89 insertions, 43 deletions
diff --git a/shell.nix b/shell.nix
index 867d7f48..e82bce78 100644
--- a/shell.nix
+++ b/shell.nix
@@ -1,8 +1,5 @@
{
system ? builtins.currentSystem,
- rust ? true,
- integration ? true,
- release ? true,
}:
with import ./nix/common.nix;
@@ -13,12 +10,63 @@ let
overlays = [ cargo2nixOverlay ];
};
kaniko = (import ./nix/kaniko.nix) pkgs;
+ manifest-tool = (import ./nix/manifest-tool.nix) pkgs;
winscp = (import ./nix/winscp.nix) pkgs;
in
+ {
-pkgs.mkShell {
- shellHook = ''
+ /* --- 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
+ #pkgs.clippy
+ pkgs.rustfmt
+ #pkgs.perl
+ #pkgs.protobuf
+ #pkgs.pkg-config
+ #pkgs.openssl
+ pkgs.file
+ #cargo2nix.packages.x86_64-linux.cargo2nix
+ ];
+ };
+
+ /* --- Integration shell ---
+ * Use it to test Garage with common S3 clients
+ */
+ integration = pkgs.mkShell {
+ nativeBuildInputs = [
+ winscp
+ pkgs.s3cmd
+ pkgs.awscli2
+ pkgs.minio-client
+ pkgs.rclone
+ pkgs.socat
+ pkgs.psmisc
+ pkgs.which
+ pkgs.openssl
+ pkgs.curl
+ pkgs.jq
+ ];
+ };
+
+ /* --- Release shell ---
+ * A shell built to make releasing easier
+ */
+ release = pkgs.mkShell {
+ shellHook = ''
function to_s3 {
aws \
--endpoint-url https://garage.deuxfleurs.fr \
@@ -37,6 +85,34 @@ function to_docker {
--verbosity=debug
}
+function multiarch_docker {
+ manifest-tool push from-spec <(cat <<EOF
+image: dxflrs/garage:''${CONTAINER_TAG}
+manifests:
+ -
+ image: dxflrs/arm64_garage:''${CONTAINER_TAG}
+ platform:
+ architecture: arm64
+ os: linux
+ -
+ image: dxflrs/amd64_garage:''${CONTAINER_TAG}
+ platform:
+ architecture: amd64
+ os: linux
+ -
+ image: dxflrs/386_garage:''${CONTAINER_TAG}
+ platform:
+ architecture: 386
+ os: linux
+ -
+ image: dxflrs/arm_garage:''${CONTAINER_TAG}
+ platform:
+ architecture: arm
+ os: linux
+EOF
+ )
+}
+
function refresh_index {
aws \
--endpoint-url https://garage.deuxfleurs.fr \
@@ -62,43 +138,13 @@ function refresh_index {
result/share/_releases.html \
s3://garagehq.deuxfleurs.fr/
}
+ '';
+ nativeBuildInputs = [
+ pkgs.awscli2
+ kaniko
+ manifest-tool
+ ];
+ };
+ }
-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 =
- (if rust then [
- pkgs.rustPlatform.rust.rustc
- pkgs.rustPlatform.rust.cargo
- pkgs.clippy
- pkgs.rustfmt
- pkgs.perl
- pkgs.protobuf
- cargo2nix.packages.x86_64-linux.cargo2nix
- ] else [])
- ++
- (if integration then [
- winscp
- pkgs.s3cmd
- pkgs.awscli2
- pkgs.minio-client
- pkgs.rclone
- pkgs.socat
- pkgs.psmisc
- pkgs.which
- pkgs.openssl
- pkgs.curl
- pkgs.jq
- ] else [])
- ++
- (if release then [
- pkgs.awscli2
- kaniko
- ] else [])
- ;
-}