summaryrefslogtreecommitdiffstats
path: root/lass
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2018-11-20 01:13:48 +0100
committerlassulus <lassulus@lassul.us>2018-11-20 01:13:48 +0100
commit5e3955c79a0e33a379795be787f5a3496191d35b (patch)
tree6e507e4ff718227dc36bd9b9d782a7f9e2f07bbd /lass
parent0328c75a12bd29c93f1a9e1c62c51e1be39701ba (diff)
l blue-host: add start/stop scripts
Diffstat (limited to 'lass')
-rw-r--r--lass/2configs/blue-host.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/lass/2configs/blue-host.nix b/lass/2configs/blue-host.nix
index 83c235f3e..a40685775 100644
--- a/lass/2configs/blue-host.nix
+++ b/lass/2configs/blue-host.nix
@@ -20,4 +20,23 @@ with import <stockholm/lib>;
hostAddress = "10.233.2.9";
localAddress = "10.233.2.10";
};
+ environment.systemPackages = [
+ (pkgs.writeDashBin "start-blue" ''
+ set -ef
+ if ping -c1 blue.r; then
+ echo 'blue is already running. bailing out'
+ exit 23
+ fi
+ if ! $(mount | ${pkgs.gnugrep}/bin/grep -qi '^encfs on /var/lib/containers/blue'); then
+ ${pkgs.encfs}/bin/encfs --public /var/lib/containers/.blue /var/lib/containers/blue
+ fi
+ nixos-container start blue
+ nixos-container run blue -- nixos-rebuild -I /var/src switch
+ '')
+ (pkgs.writeDashBin "stop-blue" ''
+ set -ef
+ nixos-container stop blue
+ fusermount -u /var/lib/containers/blue
+ '')
+ ];
}