summaryrefslogtreecommitdiffstats
path: root/krebs/default.nix
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-12-29 19:24:01 +0100
committerlassulus <lass@aidsballs.de>2015-12-29 19:24:01 +0100
commit42380546976c15d99dc0e9a65607ba4aafb31590 (patch)
tree4b0ae218de102219e9865ae4da65cef8490fafaa /krebs/default.nix
parentf22fe4e5d97237dbe76bc856909950487634c7be (diff)
parent676d0f748138f0e1fa3cb2177b5a08a857f17fac (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'krebs/default.nix')
-rw-r--r--krebs/default.nix21
1 files changed, 15 insertions, 6 deletions
diff --git a/krebs/default.nix b/krebs/default.nix
index ad0205426..81ddd3ea6 100644
--- a/krebs/default.nix
+++ b/krebs/default.nix
@@ -36,6 +36,7 @@ let out = {
{ system ? current-host-name
, target ? system
}@args: let
+ config = get-config system;
in ''
#! /bin/sh
# ${current-date} ${current-user-name}@${current-host-name}
@@ -47,6 +48,10 @@ let out = {
${builtins.readFile ./4lib/infest/install-nix.sh}
''}
+ # Prepare target source via bind-mounting
+
+ (${populate (args // { infesting = true;}) })
+
(${nixos-install args})
${rootssh target ''
@@ -98,7 +103,6 @@ let out = {
#! /bin/sh
# ${current-date} ${current-user-name}@${current-host-name}
# krebs.nixos-install
- (${populate args})
${rootssh target ''
export PATH; PATH=/root/.nix-profile/bin:$PATH
@@ -205,6 +209,7 @@ let out = {
populate =
{ system ? current-host-name
, target ? system
+ , infesting ? false
}@args:
let out = ''
#! /bin/sh
@@ -217,6 +222,8 @@ let out = {
["dir" "git"])}
'';
+
+ target_prefix=lib.optionalString infesting "/mnt";
config = get-config system;
current-host = config.krebs.hosts.${current-host-name};
@@ -225,17 +232,18 @@ let out = {
methods.dir = config:
let
can-push = config.host.name == current-host.name;
+ target-path = target_prefix + config.target-path;
push-method = ''
rsync \
--exclude .git \
--exclude .graveyard \
--exclude old \
--exclude tmp \
- --rsync-path='mkdir -p ${config.target-path} && rsync' \
+ --rsync-path='mkdir -p ${target-path} && rsync' \
--delete-excluded \
-vrLptgoD \
${config.path}/ \
- root@${target}:${config.target-path}
+ root@${target}:${target-path}
'';
in
if can-push then push-method else
@@ -244,9 +252,10 @@ let out = {
throw "No way to push ${dir} from ${current-host.name} to ${target}";
methods.git = config:
- rootssh target ''
- mkdir -p ${config.target-path}
- cd ${config.target-path}
+ let target-path = target_prefix + config.target-path;
+ in rootssh target ''
+ mkdir -p ${target-path}
+ cd ${target-path}
if ! test -e .git; then
git init
fi