diff options
Diffstat (limited to 'custom')
-rw-r--r-- | custom/redo-wrapper.nix | 16 | ||||
-rw-r--r-- | custom/redo.nix | 19 | ||||
-rw-r--r-- | custom/redo.patch | 18 |
3 files changed, 53 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 new file mode 100644 index 00000000..b5255f98 --- /dev/null +++ b/custom/redo.nix | |||
@@ -0,0 +1,19 @@ | |||
1 | # This file was auto-generated by cabal2nix. Please do NOT edit manually! | ||
2 | |||
3 | { cabal, filepath, pureMD5 }: | ||
4 | |||
5 | cabal.mkDerivation (self: { | ||
6 | pname = "redo"; | ||
7 | version = "0.2.0"; | ||
8 | sha256 = "18951sri8wix8aazd8hy8g2gzcpxw2x1ihzmn2prlf10zy1jcy4d"; | ||
9 | isLibrary = false; | ||
10 | isExecutable = true; | ||
11 | buildDepends = [ filepath pureMD5 ]; | ||
12 | patches = [ ./redo.patch ]; | ||
13 | meta = { | ||
14 | homepage = "https://github.com/jekor/redo"; | ||
15 | description = "software build system, make replacement, implementation of djb's redo"; | ||
16 | license = self.stdenv.lib.licenses.publicDomain; | ||
17 | platforms = self.ghc.meta.platforms; | ||
18 | }; | ||
19 | }) | ||
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 | ||