about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2023-12-30 10:38:31 -0500
committerGitHub <noreply@github.com>2023-12-30 10:38:31 -0500
commitcd1eb6feaa9225cc0e623acc2629f13562ee4776 (patch)
tree563b3b5136120acdf07d625713b44c2ababf6a14 /nixos
parent46b98a1d2ff95cf44cc21361d9b20d1268a3902c (diff)
parent58d434d6a2bd1d2d73f1e87a53353b0194a0cfb5 (diff)
Merge pull request #272458 from NixOS/backport-268303-to-release-23.11
[Backport release-23.11] nixos/harmonia: test if extra-allowed-users works
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/harmonia.nix6
-rw-r--r--nixos/tests/harmonia.nix3
2 files changed, 8 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/harmonia.nix b/nixos/modules/services/networking/harmonia.nix
index 4733165cf7d19..2bf912cb1a362 100644
--- a/nixos/modules/services/networking/harmonia.nix
+++ b/nixos/modules/services/networking/harmonia.nix
@@ -29,6 +29,11 @@ in
 
   config = lib.mkIf cfg.enable {
     nix.settings.extra-allowed-users = [ "harmonia" ];
+    users.users.harmonia = {
+      isSystemUser = true;
+      group = "harmonia";
+    };
+    users.groups.harmonia = { };
 
     systemd.services.harmonia = {
       description = "harmonia binary cache service";
@@ -50,7 +55,6 @@ in
         ExecStart = lib.getExe cfg.package;
         User = "harmonia";
         Group = "harmonia";
-        DynamicUser = true;
         PrivateUsers = true;
         DeviceAllow = [ "" ];
         UMask = "0066";
diff --git a/nixos/tests/harmonia.nix b/nixos/tests/harmonia.nix
index 6cf9ad4d23358..a9beac82f8e12 100644
--- a/nixos/tests/harmonia.nix
+++ b/nixos/tests/harmonia.nix
@@ -13,6 +13,9 @@
 
       networking.firewall.allowedTCPPorts = [ 5000 ];
       system.extraDependencies = [ pkgs.emptyFile ];
+
+      # check that extra-allowed-users is effective for harmonia
+      nix.settings.allowed-users = [];
     };
 
     client01 = {