summary refs log tree commit diff
path: root/nixos/tests/common
diff options
context:
space:
mode:
authorLucas Savva <lucas@m1cr0man.com>2020-02-09 16:31:07 +0000
committerLucas Savva <lucas@m1cr0man.com>2020-02-09 16:31:07 +0000
commit75fa8027ebbfaa31e67bf2e931b8b3d428494692 (patch)
tree3b6939b1bfc774c78ac47b3befe690a70c3ea582 /nixos/tests/common
parentd8e697b4fcfd929d05221ac3e67b9c04ac69df86 (diff)
parenta8f3903ba5ac2899d059b7586f1f047df23b25b5 (diff)
downloadnixpkgs-75fa8027ebbfaa31e67bf2e931b8b3d428494692.tar
nixpkgs-75fa8027ebbfaa31e67bf2e931b8b3d428494692.tar.gz
nixpkgs-75fa8027ebbfaa31e67bf2e931b8b3d428494692.tar.bz2
nixpkgs-75fa8027ebbfaa31e67bf2e931b8b3d428494692.tar.lz
nixpkgs-75fa8027ebbfaa31e67bf2e931b8b3d428494692.tar.xz
nixpkgs-75fa8027ebbfaa31e67bf2e931b8b3d428494692.tar.zst
nixpkgs-75fa8027ebbfaa31e67bf2e931b8b3d428494692.zip
nixos/acme: Update release note, remove redundant requires
Merge remote-tracking branch 'remotes/upstream/master'
Diffstat (limited to 'nixos/tests/common')
-rw-r--r--nixos/tests/common/auto.nix68
-rw-r--r--nixos/tests/common/ec2.nix4
-rw-r--r--nixos/tests/common/x11.nix9
3 files changed, 77 insertions, 4 deletions
diff --git a/nixos/tests/common/auto.nix b/nixos/tests/common/auto.nix
new file mode 100644
index 00000000000..2c21a8d5167
--- /dev/null
+++ b/nixos/tests/common/auto.nix
@@ -0,0 +1,68 @@
+{ config, lib, ... }:
+
+with lib;
+
+let
+
+  dmcfg = config.services.xserver.displayManager;
+  cfg = config.test-support.displayManager.auto;
+
+in
+
+{
+
+  ###### interface
+
+  options = {
+
+    test-support.displayManager.auto = {
+
+      enable = mkOption {
+        default = false;
+        description = ''
+          Whether to enable the fake "auto" display manager, which
+          automatically logs in the user specified in the
+          <option>user</option> option.  This is mostly useful for
+          automated tests.
+        '';
+      };
+
+      user = mkOption {
+        default = "root";
+        description = "The user account to login automatically.";
+      };
+
+    };
+
+  };
+
+
+  ###### implementation
+
+  config = mkIf cfg.enable {
+
+    services.xserver.displayManager.lightdm = {
+      enable = true;
+      autoLogin = {
+        enable = true;
+        user = cfg.user;
+      };
+    };
+
+    # lightdm by default doesn't allow auto login for root, which is
+    # required by some nixos tests. Override it here.
+    security.pam.services.lightdm-autologin.text = lib.mkForce ''
+        auth     requisite pam_nologin.so
+        auth     required  pam_succeed_if.so quiet
+        auth     required  pam_permit.so
+
+        account  include   lightdm
+
+        password include   lightdm
+
+        session  include   lightdm
+    '';
+
+  };
+
+}
diff --git a/nixos/tests/common/ec2.nix b/nixos/tests/common/ec2.nix
index 1e69b63191a..ba087bb6009 100644
--- a/nixos/tests/common/ec2.nix
+++ b/nixos/tests/common/ec2.nix
@@ -25,7 +25,7 @@ with pkgs.lib;
           my $imageDir = ($ENV{'TMPDIR'} // "/tmp") . "/vm-state-machine";
           mkdir $imageDir, 0700;
           my $diskImage = "$imageDir/machine.qcow2";
-          system("qemu-img create -f qcow2 -o backing_file=${image}/nixos.qcow2 $diskImage") == 0 or die;
+          system("qemu-img create -f qcow2 -o backing_file=${image} $diskImage") == 0 or die;
           system("qemu-img resize $diskImage 10G") == 0 or die;
 
           # Note: we use net=169.0.0.0/8 rather than
@@ -35,7 +35,7 @@ with pkgs.lib;
           # again when it deletes link-local addresses.) Ideally we'd
           # turn off the DHCP server, but qemu does not have an option
           # to do that.
-          my $startCommand = "qemu-kvm -m 768";
+          my $startCommand = "qemu-kvm -m 1024";
           $startCommand .= " -device virtio-net-pci,netdev=vlan0";
           $startCommand .= " -netdev 'user,id=vlan0,net=169.0.0.0/8,guestfwd=tcp:169.254.169.254:80-cmd:${pkgs.micro-httpd}/bin/micro_httpd ${metaData}'";
           $startCommand .= " -drive file=$diskImage,if=virtio,werror=report";
diff --git a/nixos/tests/common/x11.nix b/nixos/tests/common/x11.nix
index 5ad0ac20fac..0d76a0e972f 100644
--- a/nixos/tests/common/x11.nix
+++ b/nixos/tests/common/x11.nix
@@ -1,9 +1,14 @@
 { lib, ... }:
 
-{ services.xserver.enable = true;
+{
+  imports = [
+    ./auto.nix
+  ];
+
+  services.xserver.enable = true;
 
   # Automatically log in.
-  services.xserver.displayManager.auto.enable = true;
+  test-support.displayManager.auto.enable = true;
 
   # Use IceWM as the window manager.
   # Don't use a desktop manager.