container

This commit is contained in:
Thomas Levine 2016-04-11 17:40:50 +00:00
parent aedaaa3a05
commit 3d5b5ede46
2 changed files with 37 additions and 2 deletions

View File

@ -16,8 +16,7 @@ with lib;
# busybox # busybox
# Other # Other
vim vim git rsync
]; ];
services.openssh = { services.openssh = {
enable = true; enable = true;

36
packages/nixos-container.sh Executable file
View File

@ -0,0 +1,36 @@
#!/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
nixos-container update urchin
# Create the git repository.
host="tlevine@$(nixos-container show-ip urchin)"
ssh "${host}" '
if mkdir urchin 2> /dev/null; then
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
"