summaryrefslogtreecommitdiff
path: root/hosts/ahmed/remote-builder/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/ahmed/remote-builder/default.nix')
-rw-r--r--hosts/ahmed/remote-builder/default.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/hosts/ahmed/remote-builder/default.nix b/hosts/ahmed/remote-builder/default.nix
new file mode 100644
index 0000000..1432b11
--- /dev/null
+++ b/hosts/ahmed/remote-builder/default.nix
@@ -0,0 +1,23 @@
+{
+ pkgs,
+ metadata,
+ ...
+}: {
+ # Create a user for remote builds.
+ users.users.remotebuilder = {
+ isNormalUser = true;
+ createHome = false;
+ group = "remotebuilder";
+
+ # Allow SSH connections by the Nix client.
+ # This is matched with the ssh config IdentityFile on the client-side.
+ openssh.authorizedKeys.keys = [metadata.hosts.muhammed.sshPubKey];
+ };
+ users.groups.remotebuilder = {};
+
+ # This is indirectly equivalent to giving root as it allows this user to
+ # replace store artifacts.
+ #
+ # See: https://nix.dev/manual/nix/2.25/command-ref/conf-file?highlight=system-features#conf-trusted-users
+ nix.settings.trusted-users = ["remotebuilder"];
+}