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 ++++++++++++++++++ users/gkleen@vali.nix | 2 +- 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 custom/redo-wrapper.nix create mode 100644 custom/redo.patch 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 diff --git a/users/gkleen@vali.nix b/users/gkleen@vali.nix index 9effa4dd..0ac360dc 100644 --- a/users/gkleen@vali.nix +++ b/users/gkleen@vali.nix @@ -1,5 +1,5 @@ { packageOverrides = pkgs: rec { - redo = pkgs.haskellPackages.callPackage ../custom/redo.nix {}; + redo = pkgs.callPackage ../custom/redo-wrapper.nix {}; } // (import ../utils/nix/default.nix) {}; } -- cgit v1.2.3