From 600aa2c8ac71ad28ba515a123933657c10061dce Mon Sep 17 00:00:00 2001 From: kghugo Date: Sun, 17 Oct 2021 21:02:51 +0100 Subject: [PATCH] Link only sh from bash package to reduce image size --- examples/flake/arion-compose.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/flake/arion-compose.nix b/examples/flake/arion-compose.nix index 141dba7..b4ddbc5 100644 --- a/examples/flake/arion-compose.nix +++ b/examples/flake/arion-compose.nix @@ -1,10 +1,20 @@ { pkgs, ... }: -{ +let + sh = pkgs.stdenv.mkDerivation { + name = "sh"; + phases = [ "installPhase" ]; + + installPhase = '' + mkdir -p "$out"/bin + ln -s ${pkgs.bash}/bin/sh "$out"/bin/sh + ''; + }; +in{ config.project.name = "webapp"; config.services = { webserver = { - image.contents = with pkgs; [ bash ]; + image.contents = [ sh ]; service.useHostStore = true; service.command = [ "sh" "-c" '' cd "$$WEB_ROOT"