diff options
Diffstat (limited to 'custom')
-rw-r--r-- | custom/redo-wrapper.nix | 16 | ||||
-rw-r--r-- | custom/redo.nix | 1 | ||||
-rw-r--r-- | custom/redo.patch | 18 |
3 files changed, 35 insertions, 0 deletions
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 @@ | |||
1 | { stdenv, makeWrapper, haskellPackages }: | ||
2 | |||
3 | let | ||
4 | redo = haskellPackages.callPackage ./redo.nix {}; | ||
5 | in stdenv.mkDerivation { | ||
6 | name = "redo-wrapper"; | ||
7 | |||
8 | nativeBuildInputs = [ makeWrapper ]; | ||
9 | |||
10 | buildCommand = '' | ||
11 | mkdir -p $out/bin | ||
12 | ln -s $out/bin/redo $out/bin/redo-ifchange | ||
13 | makeWrapper ${redo}/bin/redo $out/bin/redo \ | ||
14 | --set REDO_PATH "$out/bin" | ||
15 | ''; | ||
16 | } | ||
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: { | |||
9 | isLibrary = false; | 9 | isLibrary = false; |
10 | isExecutable = true; | 10 | isExecutable = true; |
11 | buildDepends = [ filepath pureMD5 ]; | 11 | buildDepends = [ filepath pureMD5 ]; |
12 | patches = [ ./redo.patch ]; | ||
12 | meta = { | 13 | meta = { |
13 | homepage = "https://github.com/jekor/redo"; | 14 | homepage = "https://github.com/jekor/redo"; |
14 | description = "software build system, make replacement, implementation of djb's redo"; | 15 | 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 @@ | |||
1 | diff --git a/redo.hs b/redo.hs | ||
2 | index f0e816a..01c6a2e 100644 | ||
3 | --- a/redo.hs | ||
4 | +++ b/redo.hs | ||
5 | @@ -48,7 +48,12 @@ redo target dir = do | ||
6 | createDirectoryIfMissing True metaDepsDir | ||
7 | writeMD5 target path | ||
8 | oldEnv <- getEnvironment | ||
9 | - let newEnv = toList $ adjust (++ ":.") "PATH" $ insert "REDO_TARGET" target $ fromList oldEnv | ||
10 | + redoPath <- lookupEnv "REDO_PATH" | ||
11 | + let | ||
12 | + redoPath' = case redoPath of | ||
13 | + Just p -> p | ||
14 | + _ -> "." | ||
15 | + newEnv = toList $ adjust (++ (':' : redoPath')) "PATH" $ insert "REDO_TARGET" target $ fromList oldEnv | ||
16 | (_, _, _, ph) <- createProcess $ (shell $ cmd path) {env = Just newEnv} | ||
17 | exit <- waitForProcess ph | ||
18 | case exit of | ||