aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-14 04:18:14 +0000
committertv <tv@krebsco.de>2026-11-14 04:18:14 +0000
commit2ddbb18906c19d351274b68e182839f1801f4ce9 (patch)
tree606ddcc87eaddb1dfcac37d14dd52c6e3cb68a09 /README.md
parentee3a91eada2e863a192980df1f15dedd9f397f1c (diff)
krops: leave targets to populate, also in pure evaluation
writeDeploy, writeCommand, and writeTest pass target strings to pkgs.populate as they are, so populate fills in what they leave out, and decides whether the target is local, when it runs. runShell runs populate shell, which decides that for running nixos-rebuild and writeCommand's commands, so rebuild's unbuffer for local targets with allocateTTY depends on $1, and runShell returns shell code, also for remote targets. Target attribute sets get mkTarget's defaults and whether they're local during evaluation, as before, unless that's pure: then mkTarget leaves the user and the host null, instead of reading /etc/hostname, which pure evaluation pretends doesn't exist, and pkgs.populate and populate shell leave them, and whether the target is local, to populate, which also refuses copying flakes to targets using sudo then. writeTest checks that its target is local during evaluation, unless that's pure, and with populate shell --local-only before populating. writeDeploy needs a target's host for a separate buildTarget in pure evaluation. pkgs/krops/target.nix has what pkgs.populate and pkgs.krops need of targets. pkgs.populate's derivations stay the same, for strings and attribute sets. The deploy scenarios get target strings too, for the local and the remote target, and so does the allocateTTY scenario.
Diffstat (limited to 'README.md')
-rw-r--r--README.md15
1 files changed, 13 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2fb83b5..a4b5d92 100644
--- a/README.md
+++ b/README.md
@@ -102,8 +102,17 @@ taking nixpkgs' lib:
}
```
-krops evaluates environment variables and `/etc/hostname`, which pure
-evaluation doesn't allow, so deploy with `nix run --impure .#deploy`.
+Deploy with `nix run .#deploy`. A target string goes to populate as it
+is, which fills in what it leaves out, and decides whether the target is
+local, when it runs, and so does `populate shell`, which runs
+`nixos-rebuild`, and the commands of `writeCommand`, on targets. A target
+attribute set gets `mkTarget`'s defaults, and whether it's local, during
+evaluation, unless that's pure, as flakes evaluate by default, which can't
+tell the user running krops, the machine's name, and whether a target is
+local. Then `mkTarget` leaves the user and the host null, and populate
+decides when it runs. It also refuses to copy flakes to targets using
+sudo then, which krops otherwise refuses during evaluation, and
+`writeDeploy` needs a target's host for a separate `buildTarget`.
`pkgs.krops` provides the following functions.
@@ -252,6 +261,8 @@ activating it.
This basically makes the sources available on the target machine
below `/var/src`, and executes `NIX_PATH=/var/src nix-build -A system '<nixpkgs/nixos>'`.
+The target must be the machine krops runs on, which `writeTest` checks
+during evaluation, or, if that's pure, before populating.
### `target`