diff --git a/pkgs/default.nix b/pkgs/default.nix index df39b56..b051e16 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -27,6 +27,7 @@ # IT packages gcsfuse = pkgs.callPackage ./gcsfuse {}; + gcs-fuse-csi-driver-sidecar-mounter = pkgs.callPackage ./gcs-fuse-csi-driver-sidecar-mounter.nix {inherit gcsfuse;}; container-hotplug = pkgs.callPackage ./container-hotplug {}; surfer = pkgs.callPackage ./surfer/default.nix {}; diff --git a/pkgs/gcs-fuse-csi-driver-sidecar-mounter.nix b/pkgs/gcs-fuse-csi-driver-sidecar-mounter.nix new file mode 100644 index 0000000..91e32e4 --- /dev/null +++ b/pkgs/gcs-fuse-csi-driver-sidecar-mounter.nix @@ -0,0 +1,62 @@ +# Copyright lowRISC Contributors. +# Licensed under the MIT License, see LICENSE for details. +# SPDX-License-Identifier: MIT +{ + lib, + fetchFromGitHub, + buildGoModule, + gcsfuse, + dockerTools, + runCommandLocal, + cacert, +}: let + mounter = buildGoModule rec { + pname = "gcs-fuse-csi-driver-sidecar-mounter"; + version = "1.8.0"; + + src = fetchFromGitHub { + owner = "googlecloudplatform"; + repo = "gcs-fuse-csi-driver"; + rev = "v${version}"; + hash = "sha256-qJJLOek11ARxcrdB8M6UZh6PaJBV0tvVnL//ANn7YMc="; + }; + vendorHash = null; + + subPackages = ["cmd/sidecar_mounter"]; + + ldflags = ["-s" "-w" "-X main.version=${version}"]; + + postInstall = '' + mv $out/bin/sidecar_mounter $out/bin/gcs-fuse-csi-driver-sidecar-mounter + ''; + + dontCheck = true; + + meta.mainProgram = pname; + }; +in + dockerTools.buildLayeredImage { + name = "gcs-fuse-csi-driver-sidecar-mounter"; + tag = "latest"; + contents = [ + (runCommandLocal "root" {} '' + mkdir -p $out/etc/ssl/certs + ln -s ${lib.getExe gcsfuse} $out/ + ln -s ${lib.getExe mounter} $out/ + # Ensure SSL can still find certificates + ln -s ${cacert}/etc/ssl/certs/ca-bundle.crt $out/etc/ssl/certs/ca-certificates.crt + '') + ]; + config = { + Entrypoint = ["/gcs-fuse-csi-driver-sidecar-mounter"]; + }; + } + // { + meta = with lib; { + description = "Sidecar mounter for the Google Cloud Storage FUSE Container Storage Interface (CSI) Plugin"; + homepage = "https://github.com/GoogleCloudPlatform/gcs-fuse-csi-driver"; + changelog = "https://github.com/GoogleCloudPlatform/gcs-fuse-csi-driver/releases/tag/v${version}"; + license = licenses.asl20; + platforms = ["x86_64-linux"]; + }; + }