From 0c7281ee4a7858b8288cd6c3d60da8b40cb2e698 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 16 Jul 2015 11:54:00 +0200 Subject: Wrapper around redo for $PATH reasons --- custom/redo-wrapper.nix | 16 ++++++++++++++++ custom/redo.nix | 1 + custom/redo.patch | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 custom/redo-wrapper.nix create mode 100644 custom/redo.patch (limited to 'custom') diff --git a/custom/redo-wrapper.nix b/custom/redo-wrapper.nix new file mode 100644 index 00000000..20e1675a --- /dev/null +++ b/custom/redo-wrapper.nix @@ -0,0 +1,16 @@ +{ stdenv, makeWrapper, haskellPackages }: + +let + redo = haskellPackages.callPackage ./redo.nix {}; +in stdenv.mkDerivation { + name = "redo-wrapper"; + + nativeBuildInputs = [ makeWrapper ]; + + buildCommand = '' + mkdir -p $out/bin + ln -s $out/bin/redo $out/bin/redo-ifchange + makeWrapper ${redo}/bin/redo $out/bin/redo \ + --set REDO_PATH "$out/bin" + ''; +} diff --git a/custom/redo.nix b/custom/redo.nix index 9d679e55..b5255f98 100644 --- a/custom/redo.nix +++ b/custom/redo.nix @@ -9,6 +9,7 @@ cabal.mkDerivation (self: { isLibrary = false; isExecutable = true; buildDepends = [ filepath pureMD5 ]; + patches = [ ./redo.patch ]; meta = { homepage = "https://github.com/jekor/redo"; description = "software build system, make replacement, implementation of djb's redo"; diff --git a/custom/redo.patch b/custom/redo.patch new file mode 100644 index 00000000..cd3a678e --- /dev/null +++ b/custom/redo.patch @@ -0,0 +1,18 @@ +diff --git a/redo.hs b/redo.hs +index f0e816a..01c6a2e 100644 +--- a/redo.hs ++++ b/redo.hs +@@ -48,7 +48,12 @@ redo target dir = do + createDirectoryIfMissing True metaDepsDir + writeMD5 target path + oldEnv <- getEnvironment +- let newEnv = toList $ adjust (++ ":.") "PATH" $ insert "REDO_TARGET" target $ fromList oldEnv ++ redoPath <- lookupEnv "REDO_PATH" ++ let ++ redoPath' = case redoPath of ++ Just p -> p ++ _ -> "." ++ newEnv = toList $ adjust (++ (':' : redoPath')) "PATH" $ insert "REDO_TARGET" target $ fromList oldEnv + (_, _, _, ph) <- createProcess $ (shell $ cmd path) {env = Just newEnv} + exit <- waitForProcess ph + case exit of -- cgit v1.2.3