Skip to content

Commit

Permalink
nix configuration for CLI plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
hallettj committed Mar 13, 2024
1 parent 34a3f2d commit 6472461
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
# arion-compose.nix.
mongodb-connector-workspace = final.callPackage ./nix/mongodb-connector-workspace.nix { }; # builds all packages in this repo
mongodb-connector = final.mongodb-connector-workspace.override { package = "mongodb-connector"; }; # override `package` to build one specific crate
mongodb-cli-plugin = final.mongodb-connector-workspace.override { package = "mongodb-cli-plugin"; };
v3-engine = final.callPackage ./nix/v3-engine.nix { src = v3-engine-source; };
v3-e2e-testing = final.callPackage ./nix/v3-e2e-testing.nix { src = v3-e2e-testing-source; database-to-test = "mongodb"; };
inherit v3-e2e-testing-source; # include this source so we can read files from it in arion-compose configs
Expand Down Expand Up @@ -170,6 +171,16 @@
architecture = "arm64";
};

# CLI plugin packages with cross-compilation options
mongodb-cli-plugin = pkgs.mongodb-cli-plugin.override { staticallyLinked = true; };
mongodb-cli-plugin-x86_64-linux = pkgs.pkgsCross.x86_64-linux.mongodb-cli-plugin.override { staticallyLinked = true; };
mongodb-cli-plugin-aarch64-linux = pkgs.pkgsCross.aarch64-linux.mongodb-cli-plugin.override { staticallyLinked = true; };

# CLI plugin docker images
mongodb-cli-plugin-docker = pkgs.callPackage ./nix/docker-cli-plugin.nix { };
mongodb-cli-plugin-docker-x86_64-linux = pkgs.pkgsCross.x86_64-linux.callPackage ./nix/docker-cli-plugin.nix { };
mongodb-cli-plugin-docker-aarch64-linux = pkgs.pkgsCross.aarch64-linux.callPackage ./nix/docker-cli-plugin.nix { };

publish-docker-image = pkgs.writeShellApplication {
name = "publish-docker-image";
runtimeInputs = with pkgs; [ coreutils skopeo ];
Expand Down
12 changes: 12 additions & 0 deletions nix/docker-cli-plugin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ name ? "ghcr.io/hasura/mongodb-cli-plugin"
, mongodb-cli-plugin
, dockerTools
}:

dockerTools.buildLayeredImage {
inherit name;
created = "now";
config = {
Entrypoint = [ "${mongodb-cli-plugin}/bin/hasura-mongodb" ];
};
}

0 comments on commit 6472461

Please sign in to comment.