summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2021-07-26 09:19:44 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2021-07-26 09:19:44 +0200
commit62370fb59a2b1f232d34539d48ee63a3e6af7026 (patch)
treea71f7ab1b079100f091965d95fbb0f763b66d2be /nixos
parentfef9719a58f7e52c8c3346fa5ceacff0b456d5b9 (diff)
parentb9a3c230bdf5729c95f99a5aae44bc5b71fe8dab (diff)
downloadnixpkgs-62370fb59a2b1f232d34539d48ee63a3e6af7026.tar
nixpkgs-62370fb59a2b1f232d34539d48ee63a3e6af7026.tar.gz
nixpkgs-62370fb59a2b1f232d34539d48ee63a3e6af7026.tar.bz2
nixpkgs-62370fb59a2b1f232d34539d48ee63a3e6af7026.tar.lz
nixpkgs-62370fb59a2b1f232d34539d48ee63a3e6af7026.tar.xz
nixpkgs-62370fb59a2b1f232d34539d48ee63a3e6af7026.tar.zst
nixpkgs-62370fb59a2b1f232d34539d48ee63a3e6af7026.zip
Merge remote-tracking branch 'upstream/master' into staging-next
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/tasks/filesystems.nix25
-rw-r--r--nixos/tests/chromium.nix16
2 files changed, 26 insertions, 15 deletions
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index 2f17608560f..d9f7ce5d2c3 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -324,28 +324,33 @@ in
       in listToAttrs (map formatDevice (filter (fs: fs.autoFormat) fileSystems)) // {
     # Mount /sys/fs/pstore for evacuating panic logs and crashdumps from persistent storage onto the disk using systemd-pstore.
     # This cannot be done with the other special filesystems because the pstore module (which creates the mount point) is not loaded then.
-    # Since the pstore filesystem is usually empty right after mounting because the backend isn't registered yet, and a path unit cannot detect files inside of it, the same service waits for that to happen. systemd's restart mechanism can't be used here because the first failure also fails all dependent units.
         "mount-pstore" = {
           serviceConfig = {
             Type = "oneshot";
-            ExecStart = "${pkgs.util-linux}/bin/mount -t pstore -o nosuid,noexec,nodev pstore /sys/fs/pstore";
-            ExecStartPost = pkgs.writeShellScript "wait-for-pstore.sh" ''
+            # skip on kernels without the pstore module
+            ExecCondition = "${pkgs.kmod}/bin/modprobe -b pstore";
+            ExecStart = pkgs.writeShellScript "mount-pstore.sh" ''
               set -eu
-              TRIES=0
-              while [ $TRIES -lt 20 ] && [ "$(cat /sys/module/pstore/parameters/backend)" = "(null)" ]; do
-                sleep 0.1
-                TRIES=$((TRIES+1))
+              # if the pstore module is builtin it will have mounted the persistent store automatically. it may also be already mounted for other reasons.
+              ${pkgs.util-linux}/bin/mountpoint -q /sys/fs/pstore || ${pkgs.util-linux}/bin/mount -t pstore -o nosuid,noexec,nodev pstore /sys/fs/pstore
+              # wait up to five seconds (arbitrary, happened within one in testing) for the backend to be registered and the files to appear. a systemd path unit cannot detect this happening; and succeeding after a restart would not start dependent units.
+              TRIES=50
+              while [ "$(cat /sys/module/pstore/parameters/backend)" = "(null)" ]; do
+                if (( $TRIES )); then
+                  sleep 0.1
+                  TRIES=$((TRIES-1))
+                else
+                  echo "Persistent Storage backend was not registered in time." >&2
+                  exit 1
+                fi
               done
             '';
             RemainAfterExit = true;
           };
           unitConfig = {
-            ConditionPathIsMountPoint = "!/sys/fs/pstore";
             ConditionVirtualization = "!container";
             DefaultDependencies = false; # needed to prevent a cycle
           };
-          after = [ "modprobe@pstore.service" ];
-          requires = [ "modprobe@pstore.service" ];
           before = [ "systemd-pstore.service" ];
           wantedBy = [ "systemd-pstore.service" ];
         };
diff --git a/nixos/tests/chromium.nix b/nixos/tests/chromium.nix
index 0c85b2d2199..ea9e19cefbc 100644
--- a/nixos/tests/chromium.nix
+++ b/nixos/tests/chromium.nix
@@ -80,12 +80,8 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
             binary = pname
         # Add optional CLI options:
         options = []
-        major_version = "${versions.major (getVersion chromiumPkg.name)}"
-        if major_version > "91" and pname.startswith("google-chrome"):
-            # To avoid a GPU crash:
-            options += ["--use-gl=angle", "--use-angle=swiftshader"]
-        options.append("file://${startupHTML}")
         # Launch the process:
+        options.append("file://${startupHTML}")
         machine.succeed(ru(f'ulimit -c unlimited; {binary} {shlex.join(options)} & disown'))
         if binary.startswith("google-chrome"):
             # Need to click away the first window:
@@ -243,6 +239,16 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
         machine.wait_for_text("Graphics Feature Status")
 
 
+    with test_new_win("version_info", "chrome://version", "About Version") as clipboard:
+        filters = [
+            r"${chromiumPkg.version} \(Official Build",
+        ]
+        if not all(
+            re.search(filter, clipboard) for filter in filters
+        ):
+            assert False, "Version info not correct."
+
+
     machine.shutdown()
   '';
 }) channelMap