summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-12-27 12:47:25 +0100
committertv <tv@shackspace.de>2014-12-27 12:47:25 +0100
commit505e832e3131e73f418fa7f6c06f246e2668120a (patch)
tree68869008dced54a1301e77392e5e3ea965318e7f
parent4ff2919d844f17dbd4de0d6c49c032292ea53603 (diff)
env.nix: `~/.env-home`-reduction; ref load-env 58f2234
-rw-r--r--default.nix25
-rw-r--r--env.nix55
2 files changed, 55 insertions, 25 deletions
diff --git a/default.nix b/default.nix
deleted file mode 100644
index 599a096..0000000
--- a/default.nix
+++ /dev/null
@@ -1,25 +0,0 @@
-
-let
- pkgs = import <nixpkgs> {};
- hsEnv = pkgs.haskellPackages.ghcWithPackages (hsPkgs : with hsPkgs; [
- lens
- mtl
- ]);
-in
-
-pkgs.myEnvFun {
- name = "hack";
- buildInputs = with pkgs; [
- hsEnv
- ];
-
- # XXX https://nixos.org/wiki/Haskell says:
- # Since tools (such as hdevtools [snap-loader-dynamic in our case]) that
- # rely on the ghc-api to do haskell language manipulation are sensitive
- # to nix-wrapping of ghc, we need the extraCmds line to ensure the
- # proper ghc-wrapping environment variables are set inside the
- # dev-environment shell.
- extraCmds = ''
- $(grep export ${hsEnv.outPath}/bin/ghc)
- '';
-}
diff --git a/env.nix b/env.nix
new file mode 100644
index 0000000..f0f23ce
--- /dev/null
+++ b/env.nix
@@ -0,0 +1,55 @@
+{ nixpkgs ? import <nixpkgs> {} }:
+
+let
+ name = "hack";
+ version = "1";
+
+ buildInputs = with pkgs; [
+ hsEnv
+ ];
+
+ extraCmds = with pkgs; ''
+ export MANPATH=$(ls -d $(echo "$PATH" | tr : \\n | sed -n 's:\(^/nix/store/[^/]\+\).*:\1/share/man:p') 2>/dev/null | tr \\n :)
+ $(grep export ${hsEnv.outPath}/bin/ghc)
+ ${mkExports staticPkgs}
+ '';
+
+ hsEnv = hsPkgs.ghcWithPackages (self: with self;
+ login.nativeBuildInputs ++
+ [
+ cabalInstall
+ dataDefault
+ lens
+ mtl
+ zippers
+
+ #threadscope
+ ]
+ );
+
+ 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 = "${name}-${version}";
+ inherit buildInputs extraCmds;
+}
+# vim: set fdm=marker :