packer-nixos/scripts/postinstall.sh

24 lines
592 B
Bash
Raw Normal View History

#!/bin/sh
2014-01-31 03:28:11 -08:00
set -e
2014-01-30 14:00:41 -08:00
# Checkout our nixpkg tree
2014-01-31 03:28:11 -08:00
git config --global http.sslVerify false
NIXREPO=/etc/nixos
# (cd $NIXREPO && git clone http://github.com/oxdi/nixpkgs.git)
2014-01-30 14:00:41 -08:00
# Update and initialize our new configuration
2014-01-31 03:28:11 -08:00
# nixos-rebuild -I nixos=$NIXREPO/nixpkgs/nixos -I nixpkgs=$NIXREPO/nixpkgs switch
nixos-rebuild switch
# Cleanup any previous generations and delete old packages that can be
# pruned.
for x in `seq 0 2` ; do
nix-env --delete-generations old
nix-collect-garbage -d
done
# Zero out the disk (for better compression)
2014-01-31 03:28:11 -08:00
# dd if=/dev/zero of=/EMPTY bs=1M
# rm -rf /EMPTY