Archived
fix(lxc): clan vars for lxc-tor-relay + sops-reinstall service fix (network.target) #57
+16
-12
@@ -217,28 +217,32 @@ in
|
|||||||
# are permanently absent after the first boot and every service that
|
# are permanently absent after the first boot and every service that
|
||||||
# reads from /run/secrets fails on start.
|
# reads from /run/secrets fails on start.
|
||||||
#
|
#
|
||||||
# wantedBy/before sysinit.target + DefaultDependencies=false mirrors how
|
# wantedBy/before network.target: switch-to-configuration test requires
|
||||||
# the sops-nix module places its own service when it generates one. This
|
# D-Bus to restart systemd targets after running activation scripts. D-Bus
|
||||||
# ensures secrets exist before basic.target (and thus before any user
|
# is available once basic.target completes (the default After=basic.target
|
||||||
# service) starts. DefaultDependencies=false is required to avoid a
|
# that DefaultDependencies would otherwise add). Placing the service before
|
||||||
# circular ordering: without it, systemd would add After=sysinit.target
|
# network.target ensures secrets are ready before any network-dependent
|
||||||
# to a service that is itself part of sysinit.target.
|
# service (including beszel-agent and nix-serve) starts, while running late
|
||||||
|
# enough that D-Bus is already up.
|
||||||
#
|
#
|
||||||
# ConditionPathExists=... skips this service on the genuine first boot
|
# ConditionPathExists=... skips this service on the genuine first boot
|
||||||
# (the marker doesn't exist yet); nixos-lxc-first-boot-activate handles
|
# (the marker doesn't exist yet); nixos-lxc-first-boot-activate handles
|
||||||
# that case. On every subsequent boot the condition passes and secrets
|
# that case. On every subsequent boot the condition passes and secrets
|
||||||
# are reinstalled before user services start.
|
# are reinstalled before user services start.
|
||||||
|
#
|
||||||
|
# SuccessExitStatus=11: switch-to-configuration exits 11 when it cannot
|
||||||
|
# acquire the activation lock (another switch is already in progress).
|
||||||
|
# During a nixos-rebuild switch the activation already installs secrets, so
|
||||||
|
# treating the lock-held case as success is correct.
|
||||||
systemd.services.nixos-lxc-sops-reinstall = {
|
systemd.services.nixos-lxc-sops-reinstall = {
|
||||||
description = "Reinstall sops secrets on each non-first boot (LXC, /run is tmpfs)";
|
description = "Reinstall sops secrets on each non-first boot (LXC, /run is tmpfs)";
|
||||||
wantedBy = [ "sysinit.target" ];
|
wantedBy = [ "network.target" ];
|
||||||
before = [ "sysinit.target" ];
|
before = [ "network.target" ];
|
||||||
unitConfig = {
|
unitConfig.ConditionPathExists = "/var/lib/nixos-lxc-first-boot-activated";
|
||||||
DefaultDependencies = false;
|
|
||||||
ConditionPathExists = "/var/lib/nixos-lxc-first-boot-activated";
|
|
||||||
};
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
|
SuccessExitStatus = "11";
|
||||||
};
|
};
|
||||||
script = ''
|
script = ''
|
||||||
/run/current-system/bin/switch-to-configuration test
|
/run/current-system/bin/switch-to-configuration test
|
||||||
|
|||||||
Reference in New Issue
Block a user