From 7b86fadffdd8486e294ca608d7d8dedebba6c1c6 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 30 Jun 2023 12:47:53 -0400 Subject: [PATCH] flake: Wrap foliage executable with needed dependencies Previously the `app` outputs of the flake were not usable in a minimal environment as `foliage` requires `curl` and `patch` in `PATH`. Ensure that these are available. Fixes #71. --- flake.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index c9df138..4117584 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,18 @@ lib.attrsets.optionalAttrs (system == "x86_64-linux") { crossPlatforms = p: [ p.musl64 ]; } ); + + # Wrap the foliage executable with the needed dependencies in PATH. + # See #71. + wrapExe = drv: + pkgs.runCommand "foliage" { + nativeBuildInputs = [ pkgs.makeWrapper ]; + } '' + mkdir -p $out/bin + makeWrapper ${drv}/bin/foliage $out/bin/foliage \ + --prefix PATH : ${with pkgs; lib.makeBinPath [ curl patch ]}:$out/bin + ''; + in flake // { @@ -46,9 +58,9 @@ apps = { default = flake.apps."foliage:exe:foliage"; } // lib.attrsets.optionalAttrs (system == "x86_64-linux") - { static = flake.apps."x86_64-unknown-linux-musl:foliage:exe:foliage"; } + { static = wrapExe flake.apps."x86_64-unknown-linux-musl:foliage:exe:foliage"; } // lib.attrsets.optionalAttrs (system == "aarch64-linux") - { static = flake.apps."aarch64-multiplatform-musl:foliage:exe:foliage"; }; + { static = wrapExe flake.apps."aarch64-multiplatform-musl:foliage:exe:foliage"; }; packages = { default = flake.packages."foliage:exe:foliage"; } // lib.attrsets.optionalAttrs (system == "x86_64-linux")