Open source Nest implementation
{ pkgs ? import <nixpkgs> {} }:

  pkgs.mkShell {
    # nativeBuildInputs is usually what you want -- tools you need to run
    nativeBuildInputs = [ 
	# SCM - Pijul :-)
	pkgs.buildPackages.pijul

	# Rust programming
	pkgs.buildPackages.rustc
	pkgs.buildPackages.cargo
	pkgs.buildPackages.rustfmt

        # Database
        pkgs.buildPackages.postgresql
	pkgs.sqlx-cli

	# Compile time requirements
	pkgs.buildPackages.libiconv

        # LibPijul dependencies
	pkgs.buildPackages.xxHash
	pkgs.buildPackages.zstd
  ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin
    (with pkgs.darwin.apple_sdk.frameworks; [
      CoreServices
      Security
      SystemConfiguration
    ]);

  shellHook = ''
    export PGDATA=$PWD/tmp/postgres_data
    export PGHOST=$PWD/tmp/postgres
    export LOG_PATH=$PWD/tmp/postgres/LOG
    export PGDATABASE=postgres
    export DATABASE_URL="postgresql:///postgres?host=$PGHOST"
    if [ ! -d $PGHOST ]; then
      mkdir -p $PGHOST
    fi
    if [ ! -d $PGDATA ]; then
      echo 'Initializing postgresql database...'
      initdb $PGDATA --auth=trust >/dev/null
    fi

    if ! pg_ctl status 1>/dev/null; then
      pg_ctl start -l $LOG_PATH -o "-c listen_addresses= -c unix_socket_directories=$PGHOST"
    fi

    export REPOSITORY_ROOT="$PWD/tmp/repositories"
    if [ ! -d $REPOSITORY_ROOT ]; then
	mkdir $REPOSITORY_ROOT
    fi
  '';
}