urchin/environments/nixos-container/run.sh

37 lines
702 B
Bash
Raw Normal View History

2016-04-11 13:40:50 -04:00
#!/bin/sh
set -e
# Create the container.
if ! nixos-container list | grep ^urchin$ > /dev/null; then
sudo nixos-container create urchin
fi
# Configure the container.
sudo cp configuration.nix \
/var/lib/containers/urchin/etc/nixos/configuration.nix
2016-04-11 13:44:14 -04:00
sudo nixos-container update urchin
2016-04-11 14:42:39 -04:00
sudo nixos-container start urchin
2016-04-11 13:40:50 -04:00
# Create the git repository.
host="tlevine@$(nixos-container show-ip urchin)"
2016-04-11 14:42:39 -04:00
ssh "${host}" 'if mkdir urchin 2> /dev/null; then
2016-04-11 13:40:50 -04:00
cd urchin
git init
git config --add receive.denyCurrentBranch ignore
fi
'
# Push to the git repository
git push "${host}":urchin
# Print information
echo "Log in:
ssh ${host}
Add git remote
git remote add ${host} container
"