mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
tests/nix-daemon-unprivileged: Add test for non-root nix daemon
This commit is contained in:
@@ -1099,6 +1099,7 @@ in
|
||||
nix-channel = pkgs.callPackage ../modules/config/nix-channel/test.nix { };
|
||||
nix-config = runTest ./nix-config.nix;
|
||||
nix-daemon-firewall = runTest ./nix-daemon-firewall.nix;
|
||||
nix-daemon-unprivileged = runTest ./nix-daemon-unprivileged.nix;
|
||||
nix-ld = runTest ./nix-ld.nix;
|
||||
nix-misc = handleTest ./nix/misc.nix { };
|
||||
nix-required-mounts = runTest ./nix-required-mounts;
|
||||
|
||||
38
nixos/tests/nix-daemon-unprivileged.nix
Normal file
38
nixos/tests/nix-daemon-unprivileged.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
name = "nix-daemon-unprivileged";
|
||||
meta.maintainers = with lib.maintainers; [ artemist ];
|
||||
|
||||
nodes.machine = {
|
||||
users.groups.nix-daemon = { };
|
||||
users.users.nix-daemon = {
|
||||
isSystemUser = true;
|
||||
group = "nix-daemon";
|
||||
};
|
||||
|
||||
nix = {
|
||||
package = pkgs.nixVersions.git;
|
||||
daemonUser = "nix-daemon";
|
||||
daemonGroup = "nix-daemon";
|
||||
settings.experimental-features = [
|
||||
"local-overlay-store"
|
||||
"auto-allocate-uids"
|
||||
];
|
||||
};
|
||||
|
||||
# Easiest way to get a file onto the machine
|
||||
environment.etc."test.nix".text = ''
|
||||
derivation {
|
||||
name = "test";
|
||||
builder = "/bin/sh";
|
||||
args = [ "-c" "echo succeeded > $out" ];
|
||||
system = "${pkgs.stdenv.hostPlatform.system}";
|
||||
}
|
||||
'';
|
||||
};
|
||||
testScript = ''
|
||||
start_all()
|
||||
machine.wait_for_unit("sockets.target")
|
||||
machine.succeed("NIX_REMOTE=daemon nix-build /etc/test.nix")
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user