Skip to content

Instantly share code, notes, and snippets.

@MAHDTech
Created March 3, 2023 12:19
Show Gist options
  • Save MAHDTech/c61ef2a0d57af3fadaa207ba1ba5ba4e to your computer and use it in GitHub Desktop.
Save MAHDTech/c61ef2a0d57af3fadaa207ba1ba5ba4e to your computer and use it in GitHub Desktop.
Referencing custom derivations
{pkgs, ...}:
pkgs.dockerTools.buildImage {
name = "pivnet";
tag = "latest";
created = "now";
copyToRoot = pkgs.buildEnv {
name = "image-root";
pathsToLink = ["/bin"];
paths = with pkgs; [
# Common
busybox
curlFull
cacert
# Tools
(callPackage ./pivnet.nix {})
];
};
config = {
Entrypoint = [
""${REFERENCE_HERE}/bin/pivnet"
];
Cmd = [
];
ExposedPorts = {
};
Env = [
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
];
WorkingDir = "/workdir";
};
}
{pkgs, ...}: let
pivnet = pkgs.fetchurl {
name = "pivnet";
url = "https://github.com/pivotal-cf/pivnet-cli/releases/download/v3.0.1/pivnet-linux-amd64-3.0.1";
sha256 = "sha256-et44d6fpcyJ8WMrGrjpRrXiBMDh8FmRjaR/gjzd5KPw=";
};
in
pkgs.stdenv.mkDerivation {
name = "pivnet";
version = "v3.0.1";
phases = ["installPhase"];
installPhase = ''
mkdir --parents $out/bin
install --verbose ${pivnet} $out/bin/pivnet
'';
meta = {
description = "CLI to interact with Tanzu Network API V2 interface.";
homepage = "https://github.com/pivotal-cf/pivnet-cli";
license = "Apache 2.0";
};
}
@MAHDTech
Copy link
Author

MAHDTech commented Mar 3, 2023

{pkgs, ...}:
let 
  pivnet = callPackage ./pivnet.nix {};
in
pkgs.dockerTools.buildImage {
  name = "pivnet";
  tag = "latest";
  created = "now";

  copyToRoot = pkgs.buildEnv {
    name = "image-root";
    pathsToLink = ["/bin"];

    paths = (with pkgs; [
      busybox
      curlFull
      cacert
    ]) ++ [pivnet];
  };

  config = {
    Entrypoint = [
      "${pivnet}/bin/pivnet"
    ];
    Cmd = [
    ];
    ExposedPorts = {
    };
    Env = [
      "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
    ];
    WorkingDir = "/workdir";
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment