summaryrefslogtreecommitdiffstats
path: root/krebs/default.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-01-14 16:39:34 +0100
committertv <tv@krebsco.de>2016-01-14 16:39:34 +0100
commit2ae2bdc586177f674a987e354940765ad86cbaa2 (patch)
tree0ba9baf9ff358a9eb2bb1111090d513b93268df7 /krebs/default.nix
parent780ddec4ab268fbfd43ea9bf511ed4b3b0d35783 (diff)
parent49b6fd9c87678893ed47794b116660700994b1bc (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'krebs/default.nix')
-rw-r--r--krebs/default.nix20
1 files changed, 14 insertions, 6 deletions
diff --git a/krebs/default.nix b/krebs/default.nix
index ad0205426..15d0e8e2e 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,9 @@ let out = {
${builtins.readFile ./4lib/infest/install-nix.sh}
''}
+ # Prepare target source via bind-mounting
+
+
(${nixos-install args})
${rootssh target ''
@@ -98,7 +102,7 @@ let out = {
#! /bin/sh
# ${current-date} ${current-user-name}@${current-host-name}
# krebs.nixos-install
- (${populate args})
+ (${populate (args // { root = "/mnt"; })})
${rootssh target ''
export PATH; PATH=/root/.nix-profile/bin:$PATH
@@ -205,6 +209,7 @@ let out = {
populate =
{ system ? current-host-name
, target ? system
+ , root ? ""
}@args:
let out = ''
#! /bin/sh
@@ -217,6 +222,7 @@ let out = {
["dir" "git"])}
'';
+
config = get-config system;
current-host = config.krebs.hosts.${current-host-name};
@@ -225,17 +231,18 @@ let out = {
methods.dir = config:
let
can-push = config.host.name == current-host.name;
+ target-path = root + 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 +251,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 = root + config.target-path;
+ in rootssh target ''
+ mkdir -p ${target-path}
+ cd ${target-path}
if ! test -e .git; then
git init
fi