summaryrefslogtreecommitdiffstats
path: root/lass/krops.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-11-21 13:44:39 +0100
committertv <tv@krebsco.de>2021-11-21 13:44:39 +0100
commite250f858382a1c830a55a7243a80e1fbd2d1b15d (patch)
tree0dd30c66ddc473112f1f1fcbf0c80ad896a38204 /lass/krops.nix
parenta752af84bedc24fdc32004a8760532b3206c0421 (diff)
parentb0f39ae34d1f248a4c1b92946a42418779f69490 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'lass/krops.nix')
-rw-r--r--lass/krops.nix20
1 files changed, 17 insertions, 3 deletions
diff --git a/lass/krops.nix b/lass/krops.nix
index 128c9ee0..76911270 100644
--- a/lass/krops.nix
+++ b/lass/krops.nix
@@ -24,7 +24,7 @@
};
};
}
- (if (lib.pathExists (./. + "/1systems/${name}/source.nix")) && (! test) then
+ (if lib.pathExists (./. + "/1systems/${name}/source.nix") then
import (./. + "/1systems/${name}/source.nix") { inherit lib pkgs test; }
else
{}
@@ -33,9 +33,23 @@
in {
- # usage: $(nix-build --no-out-link --argstr name HOSTNAME -A deploy)
- deploy = { target ? "root@${name}/var/src" }: pkgs.krops.writeDeploy "${name}-deploy" {
+ deploy = { target ? "root@${name}/var/src" }: pkgs.krops.writeCommand "deploy" {
+ command = targetPath: ''
+
+ set -fu
+
+ outDir=$(mktemp -d)
+ trap "rm -rf $outDir;" INT TERM EXIT
+
+ nix build \
+ -I "${targetPath}" \
+ -f '<nixpkgs/nixos>' config.system.build.toplevel \
+ -o "$outDir/out"
+
+ $outDir/out/bin/switch-to-configuration switch
+ '';
source = source { test = false; };
+ allocateTTY = true;
inherit target;
};