add a per-agent nix builds mode, host or none, carried like privateUsers
This commit is contained in:
parent
b9484e62a0
commit
5485151ba6
1 changed files with 618 additions and 58 deletions
|
|
@ -22,11 +22,20 @@ let
|
|||
;
|
||||
|
||||
# A named agent, so the rendered script carries a name no default supplies.
|
||||
migrate =
|
||||
(agentWith { services.hyperhive.agent.user.name = "iris"; })
|
||||
.system.activationScripts.hive-agent-user-migrate.text;
|
||||
iris = agentWith { services.hyperhive.agent.user.name = "iris"; };
|
||||
migrate = iris.system.activationScripts.hive-agent-user-migrate.text;
|
||||
# The tmpfiles rules of the same named agent.
|
||||
rules = (agentWith { services.hyperhive.agent.user.name = "iris"; }).systemd.tmpfiles.rules;
|
||||
rules = iris.systemd.tmpfiles.rules;
|
||||
# The same agent with its nix builds switched off, and one asking for a mode
|
||||
# the option does not have.
|
||||
noBuilds = agentWith {
|
||||
services.hyperhive.agent.user.name = "iris";
|
||||
services.hyperhive.agent.nixBuilds = "none";
|
||||
};
|
||||
unknownBuilds = agentWith {
|
||||
services.hyperhive.agent.user.name = "iris";
|
||||
services.hyperhive.agent.nixBuilds = "container";
|
||||
};
|
||||
# `privateUsers` with the given pins; the agent name is the one the cases
|
||||
# above use, so only the pins differ.
|
||||
withUsers =
|
||||
|
|
@ -113,6 +122,18 @@ let
|
|||
&& lib.elem "L /home/iris/.local/state/nix - - - - /nix/var/nix/profiles/per-user/iris" rules
|
||||
&& lib.elem "L /home/iris/.nix-profile - - - - /home/iris/.local/state/nix/profiles/profile" rules;
|
||||
}
|
||||
{
|
||||
# The option defaults to host builds, accepts `none`, and refuses a mode
|
||||
# it does not declare. The default and `none` arms are each other's
|
||||
# control; `none` leaves the in-container routing alone, because the
|
||||
# error an agent gets then comes from the missing socket.
|
||||
name = "nixBuilds defaults to host, takes none and refuses a mode it does not declare";
|
||||
ok =
|
||||
iris.services.hyperhive.agent.nixBuilds == "host"
|
||||
&& noBuilds.services.hyperhive.agent.nixBuilds == "none"
|
||||
&& noBuilds.systemd.globalEnvironment.NIX_REMOTE == "daemon"
|
||||
&& !(builtins.tryEval unknownBuilds.services.hyperhive.agent.nixBuilds).success;
|
||||
}
|
||||
];
|
||||
in
|
||||
runGroup "agent-user" cases
|
||||
|
|
|
|||
Loading…
Reference in a new issue