haskell-te: 93a39956f75aed4509779867c95934a54bcbe194
1: { cabal2nix, lib, runCommand }:
2:
3: with builtins;
4: with lib;
5: dir:
6: assert typeOf dir == "path" || isString dir || isDerivation dir ||
7: abort "nixedHsPkg: dir should be str|path|drv, given '${typeOf dir}'";
8: runCommand "nixedHsPkg"
9: {
10: inherit dir;
11: buildInputs = [ cabal2nix ];
12: }
13: ''
14: echo "Source is '$dir'" 1>&2
15: target=$(readlink -f "$dir")
16: cp -r "$target" ./source
17: pushd ./source > /dev/null
18: echo "Setting permissions" 1>&2
19: chmod +w . -R # We need this if dir has come from the Nix store
20: echo "Cleaning up unnecessary files" 1>&2
21: rm -rf ".git" || true
22:
23: echo "Creating 'default.nix'" 1>&2
24: touch default.nix
25: chmod +w default.nix
26:
27: echo "Generating package definition" 1>&2
28: cabal2nix ./. > default.nix
29: echo "Finished generating" 1>&2
30: popd > /dev/null
31: cp -r ./source "$out"
32: ''
Generated by git2html.