From 77c492fa8652577568f0e78892b6bb5348ed5d9e Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 28 Sep 2019 00:42:03 +0200 Subject: [PATCH] Wrap arion binary PATH+=docker-compose, unset PYTHONPATH --- nix/overlay.nix | 21 +++++++++++++++++++++ tests/arion-test/default.nix | 1 - 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/nix/overlay.nix b/nix/overlay.nix index 3105187..6a41e14 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,6 +1,7 @@ self: super: let inherit (self.arion-project) haskellPkgs; + inherit (super) lib; srcDir = ../src; # TODO gitignoreSource + whitelist nix and arion-image eval = import (srcDir + "/nix/eval-composition.nix"); @@ -13,10 +14,30 @@ in arion-v0 = super.callPackage ../arion.nix {}; arion = hlib.justStaticExecutables (hlib.overrideCabal haskellPkgs.arion-compose (o: { + buildTools = o.buildTools ++ [super.makeWrapper]; passthru = o.passthru // { inherit eval build; }; pname = "arion"; # Cover up the needlessly long Haskell package name + + # PYTHONPATH + # + # We close off the python module search path! + # + # Accepting directories from the environment into the search path + # tends to break things. Docker Compose does not have a plugin + # system as far as I can tell, so I don't expect this to break a + # feature, but rather to make the program more robustly self- + # contained. + + postInstall = ''${o.postInstall or ""} + mkdir -p $out/libexec + mv $out/bin/arion $out/libexec + makeWrapper $out/libexec/arion $out/bin/arion \ + --unset PYTHONPATH \ + --prefix PATH : ${lib.makeBinPath [ self.docker-compose ]} \ + ; + ''; })); tests = super.callPackage ../tests {}; doc = super.callPackage ../doc {}; diff --git a/tests/arion-test/default.nix b/tests/arion-test/default.nix index 1020a1b..e197fb2 100644 --- a/tests/arion-test/default.nix +++ b/tests/arion-test/default.nix @@ -12,7 +12,6 @@ in machine = { pkgs, lib, ... }: { environment.systemPackages = [ pkgs.arion - pkgs.docker-compose ]; virtualisation.docker.enable = true;