about summary refs log tree commit diff
path: root/playbooks/nix_gcr/cloud_run.nix
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-07-20T09·26+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-07-20T13·38+0100
commitc6106f7884fab3048ccce14dd56a193e706fbaac (patch)
tree473254a350490ce6956a656370fe695bf7cb0bdf /playbooks/nix_gcr/cloud_run.nix
parent5add8ddc13be3a7a5fbb6deb3f70cb18594f8750 (diff)
Create //playbooks
I'm particularly excited about this idea. As I was reading Graham's "Erase your
darlings" blog post, I had an idea: I should have playbooks at the root of my
monorepo.

I can have playbooks for the following:
- How to install NixOS
- How to build GCR images from Nix expressions
- A collection of miscellaneous shell commands (e.g. "how to kill a process by name")
- What series of steps should I follow when I receive a paycheck

I already keep README's at the root of each package, which I think is where many
of these instructions belong. Other tutorials that I write for myself that do
not belong to any package can go in //playbooks. I also will host my personal
habits in //playbooks since habits are a bit like playbooks for life. Let's see
how this idea ages as the caffeine wears off...
Diffstat (limited to 'playbooks/nix_gcr/cloud_run.nix')
-rw-r--r--playbooks/nix_gcr/cloud_run.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/playbooks/nix_gcr/cloud_run.nix b/playbooks/nix_gcr/cloud_run.nix
new file mode 100644
index 000000000000..70be4040c36b
--- /dev/null
+++ b/playbooks/nix_gcr/cloud_run.nix
@@ -0,0 +1,18 @@
+{
+  pkgs ? import <nixpkgs> {},
+  depot ? import <depot> {},
+  ...
+}:
+
+pkgs.dockerTools.buildLayeredImage {
+  name = "gemma";
+  tag = "latest";
+  config.ExposedPorts = {
+    "4242" = {};
+  };
+  config.Env = [
+    "GEMMA_CONFIG=${./config.lisp}"
+  ];
+  config.Cmd = [ "${depot.fun.gemma}/bin/gemma" ];
+  maxLayers = 120;
+}