Last active
August 29, 2015 14:08
-
-
Save 4z3/6872251aa939f6ac5ae6 to your computer and use it in GitHub Desktop.
env.nix for lftp with custom haskell environment, d3js, and a dedicated histfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install with nix-env -f env.nix -i | |
# start with load-env-projectname | |
let | |
name = "projectname"; | |
version = "0.1.0.0"; | |
buildInputs = with pkgs; [ | |
hsEnv | |
lftp | |
]; | |
# TODO what's the best way to specify HISTFILE | |
# TODO generate MANPATH from buildInputs | |
extraCmds = with pkgs; '' | |
export HISTFILE=/home/tv/.history/env-${name} | |
export MANPATH=\$MANPATH:${lftp}/share/man | |
export d3js=${d3js} | |
$(grep export ${hsEnv.outPath}/bin/ghc) | |
''; | |
pkgs = nixpkgs // extrapkgs; | |
nixpkgs = import <nixpkgs> {}; | |
extrapkgs = { | |
d3js = #{{{ | |
pkgs.stdenv.mkDerivation rec { | |
name = "d3-${version}"; | |
version = "3.4.13"; | |
src = pkgs.fetchzip { | |
url = "https://github.com/mbostock/d3/archive/v${version}.zip"; | |
sha256 = "1m8alxrll7siryig8z994qxc1hy99d2xfslr9w0jn98m8qh6szfx"; | |
}; | |
buildInputs = [ ]; | |
phases = [ "installPhase" ]; | |
installPhase = '' | |
mkdir -p $out | |
cp -r $src/d3.js $out/ | |
cp -r $src/d3.min.js $out/ | |
''; | |
} | |
; #}}} | |
}; | |
hsPkgs = pkgs.haskellPackages_ghc783_profiling; | |
hsEnv = hsPkgs.ghcWithPackages (_hsPkgs: with _hsPkgs; | |
let | |
xintmap = #{{{ | |
# generated by cabal2nix git://github.com/4z3/xintmap.git | 2>/dev/null | sed -n '/^cabal/,$p' | |
cabal.mkDerivation (self: { | |
pname = "xintmap"; | |
version = "0.6.0.1"; | |
src = pkgs.fetchgit { | |
url = "git://github.com/4z3/xintmap.git"; | |
sha256 = "595ffd5db149524944e88c70e47156e178427308f8cc1ba49d0aef627e72e48a"; | |
rev = "4f0ef52fd05e9a92842f6fbf23edd706244ff865"; | |
}; | |
}) | |
; #}}} | |
in [ | |
xintmap | |
]); | |
in pkgs.myEnvFun { | |
name = "${name}-${version}"; | |
inherit buildInputs extraCmds; | |
} | |
# vim: set fdm=marker : |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment