diff options
author | tv <tv@shackspace.de> | 2014-12-19 20:42:38 +0100 |
---|---|---|
committer | tv <tv@shackspace.de> | 2014-12-19 20:42:38 +0100 |
commit | 4299cd382b10947a8a79e586f95d38823aaa9597 (patch) | |
tree | 86bb8127d0c2a72932baca9d1aa2826ea1d4dd77 /env.nix |
initial commit
Diffstat (limited to 'env.nix')
-rw-r--r-- | env.nix | 63 |
1 files changed, 63 insertions, 0 deletions
@@ -0,0 +1,63 @@ +{ nixpkgs ? import <nixpkgs> {} }: + +let + name = "much"; + version = "1"; + + buildInputs = with pkgs; [ + hsEnv + ]; + + extraCmds = with pkgs; '' + export HISTFILE="\$HOME/.history/env-${name}" + $(grep export ${hsEnv.outPath}/bin/ghc) + ${mkExports staticPkgs} + ''; + + # ghcWithPackagesOld b/c terminfo collision + hsEnv = hsPkgs.ghcWithPackagesOld (self: with self; + terminfo.nativeBuildInputs ++ + [ + cabalInstall + dataDefault + vtyUi + + # for NotmuchCmd + aeson + #blazeHtml + caseInsensitive + #conduit + #conduitExtra + process + safe + ] + ); + + hsPkgs = pkgs.haskellPackages_ghc783_profiling.override { + extension = self: super: with self; { + #vty = callPackage ./nixpkgs/vty-5.2.5.nix { #{{{ + #}; #}}} + }; + }; + + 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 = "${name}-${version}"; + inherit buildInputs extraCmds; +} +# vim: set fdm=marker : |