Eric Rasmussen / @theerasmas
January 19, 2015
there's just one problem
(via http://xkcd.com/927/)
40 + 2 =
       = new log file with debug output
       = database calls
       = HTTP service calls...
       = 42, maybe?
/nix/store/r8vvq9kq18pz08v249h8my6r9vs7s0n3-gcc-4.3.6/
{ stdenv, fetchurl, fetchgit, openssl, zlib, pcre, libxml2, libxslt, expat }:
stdenv.mkDerivation rec {
  name = "nginx-${version}";
  version = "1.4.4";
  src = fetchurl {
    url = "http://nginx.org/download/nginx-${version}.tar.gz";
    sha256 = "1f82845mpgmhvm151fhn2cnqjggw9w7cvsqbva9rb320wmc9m63w";
  };
  buildInputs = [ openssl zlib pcre libxml2 libxslt ];
  configureFlags = [ "--with-http_spdy_module" ];
  postInstall = "mv $out/sbin $out/bin";
  meta = with stdenv.lib; {
    description = "A reverse proxy and lightweight webserver";
    maintainers = [ maintainers.iElectric ];
    platforms = platforms.all;
    license = licenses.bsd2;
  };
$ curl -L http://git.io/nix-install.sh | bash
$ source ~/.nix-profile/etc/profile.d/nix.sh
$ nix-env -i nginx
# ~/.nixpkgs/config.nix
{
   packageOverrides = pkgs : with pkgs; {
     pyred2 = pkgs.myEnvFun {
         name = "pyred2";
         buildInputs = [ python27Full redis ];
     };
     pyred3 = pkgs.myEnvFun {
         name = "pyred3";
         buildInputs = [ python3 redis ];
     };
   };
}
Using myEnvFun
$ nix-env -i env-pyred2
$ load-env-pyred2
env-pyred2 loaded
pyred2:[eric@nixos:~]$ python
python            python2.7         python2-config
python2           python2.7-config  python-config
$ rm -rf /nix
$ rm -rf ~/nix-profile/
{ config, pkgs, ... }: with pkgs;
  {
    networking.firewall.allowedTCPPorts = [ 8000 ];
    services.postgresql = {
      enable = true;
      package = pkgs.postgresql93;
      authentication = pkgs.lib.mkOverride 10 ''
          local postgres root ident
          host myuser myuser 127.0.0.1/32 password
          local all all ident
      '';
      initialScript = "bootstrap_or_something.sql";
    };
    environment.systemPackages = [ emacs24-nox git tmux ghc.ghc783 ];
  }
}
# configuration.nix
# will extend /etc/hosts
networking.extraHosts = ''
  some_ip some_host
  some_ip2 some_host2
'';