summaryrefslogtreecommitdiff
path: root/ws2015/ffp/presentation/shell.nix
blob: 7ee088ab91293af0667417a04f5d45c7f52570ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ pkgs ? (import <nixpkgs> {})
, haskellPackages ? (import ./thermoprint.git/default.nix {}).haskellPackages
}:

let
  thermoprintPackages = builtins.attrValues (import ./thermoprint.git/default.nix {});
  ghc = haskellPackages.ghcWithPackages
    (ps: thermoprintPackages ++ utilities ps ++ testDeps ps);
  utilities = (ps: with ps; [ ]);
  testDeps = (ps: with ps; [ ]);
  shell = pkgs.stdenv.mkDerivation {
    name = "shell";
    src = builtins.toFile "shell.sh" ''
      #!/usr/bin/env zsh

      typeset -a args
      args=($@)
      [[ $#@ -eq 0 ]] && args=("-e" "tmux")

      exec urxvt -bg white -fg black -fn "xft:DejaVu Sans Mono:pixelsize=20" $args
    '';
    phases = ["installPhase"];
    installPhase = ''
      mkdir -p $out/bin
      install -m 555 $src $out/bin/shell
    '';
  };
  present = pkgs.stdenv.mkDerivation {
    name = "present";
    src = builtins.toFile "present.sh" ''
      #!/usr/bin/env zsh

      typeset -a args
      args=($@)
      [[ $#@ -eq 0 ]] && args=("presentation.pdf")

      exec pdfpc -g -n right -d 20 $args
    '';
    phases = ["installPhase"];
    installPhase = ''
      mkdir -p $out/bin
      install -m 555 $src $out/bin/present
    '';
  };
in
pkgs.stdenv.mkDerivation rec {
  name = "presentation-env";
  buildInputs = [ shell present ghc ] ++ (with pkgs; [ screen-message pdfpc ]);
  shellHook = ''
    eval $(egrep ^export ${ghc}/bin/ghc)
    export PROMPT_INFO="${name}"
  '';
}