-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
41 lines (35 loc) · 1.23 KB
/
default.nix
File metadata and controls
41 lines (35 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ self, ... }:
{
libAttrs.test = {
mkTest =
originalPkgs: module:
let
nixpkgs = self.lib.nixpkgs.patch originalPkgs;
pkgs = import nixpkgs {
system = originalPkgs.stdenv.hostPlatform.system;
};
mkTest =
{ withSshBackdoor }:
pkgs.testers.runNixOSTest {
imports = [ module ] ++ (builtins.attrValues self.lib.test.modules);
sshBackdoor.enable = withSshBackdoor;
# NOTE: needed to set nixpkgs config
node.pkgsReadOnly = false;
defaults =
{ lib, ... }:
{
imports =
(builtins.attrValues (
lib.filterAttrs (name: _: lib.hasPrefix "capabilities" name) self.nixosModules
))
++ (builtins.attrValues self.lib.test.nixosModules);
services.openssh.settings.PermitRootLogin = lib.mkForce "yes";
services.openssh.settings.PasswordAuthentication = lib.mkForce true;
};
};
original = mkTest { withSshBackdoor = false; };
withSshBackdoor = mkTest { withSshBackdoor = true; };
in
original // { inherit withSshBackdoor; };
};
}