diff options
author | tv <tv@shackspace.de> | 2014-11-18 16:05:40 +0100 |
---|---|---|
committer | tv <tv@shackspace.de> | 2014-11-18 16:05:40 +0100 |
commit | 179d8980e55578e3553bad0b237368d74e074f15 (patch) | |
tree | cee326bc5071a71866ede0487beb28d510ea989a /env.nix |
initial commit
Diffstat (limited to 'env.nix')
-rw-r--r-- | env.nix | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -0,0 +1,55 @@ +{ nixpkgs ? import <nixpkgs> {} }: + +let + pname = "regfish"; + version = "1"; + + buildInputs = with pkgs; [ + hsEnv + ]; + + extraCmds = with pkgs; '' + export HISTFILE="\$HOME/.history/env-${pname}" + export MANPATH=\$MANPATH:${lftp}/share/man + $(grep export ${hsEnv.outPath}/bin/ghc) + ${mkExports staticPkgs} + if test -f "\$HOME/.env-${pname}"; then + . "\$HOME/.env-${pname}" + fi + ''; + + hsEnv = hsPkgs.ghcWithPackagesOld (self: with self; + [ + acidState + cabalInstall + tagsoup + wreq + ] + ); + + hsPkgs = pkgs.haskellPackages_ghc783_profiling.override { + extension = self: super: with self; { + }; + }; + + pkgs = nixpkgs // staticPkgs; + staticPkgs = with nixpkgs; { + }; + + #{{{ mkExports : set -> string + # Create shell script that exports a set's attributes. + mkExports = set: with builtins; with pkgs.lib.strings; + let + # XXX attribute names are not escaped, they have to be sane + # XXX the value should not contain <newline> + mkExport = k: "export ${k}=${escapeSh (getAttr k set)}"; + escapeSh = stringAsChars (c: "\\${c}"); + in + concatStringsSep "\n" (map mkExport (attrNames set)); + #}}} + +in pkgs.myEnvFun { + name = "${pname}-${version}"; + inherit buildInputs extraCmds; +} +# vim: set fdm=marker : |