Skip to content

Commit

Permalink
nvidia-x11: add an assert that useSettings implies more than `libsO…
Browse files Browse the repository at this point in the history
…nly`

Without the change `primusLib.glvnd.settings` fails the eval without a
chance of recovery (uncatchable error):

    $ NIXPKGS_ALLOW_UNFREE=1 nix build --no-link -f. primusLib.glvnd.settings
    error:
       … while calling the 'derivationStrict' builtin

         at /derivation-internal.nix:9:12:

            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'nvidia-settings-545.29.06'
         whose name attribute is located at pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'postPatch' of derivation 'nvidia-settings-545.29.06'

         at pkgs/os-specific/linux/nvidia-x11/settings.nix:81:3:

           80|
           81|   postPatch = lib.optionalString nvidia_x11.useProfiles ''
             |   ^
           82|     sed -i 's,/usr/share/nvidia/,${nvidia_x11.bin}/share/nvidia/,g' src/gtk+-2.x/ctkappprofile.c

       error: attribute 'bin' missing

       at pkgs/os-specific/linux/nvidia-x11/settings.nix:82:36:

           81|   postPatch = lib.optionalString nvidia_x11.useProfiles ''
           82|     sed -i 's,/usr/share/nvidia/,${nvidia_x11.bin}/share/nvidia/,g' src/gtk+-2.x/ctkappprofile.c
             |                                    ^
           83|   '';

After the change `builtins.tryEval` can catch errors thrown by `assert`.
  • Loading branch information
trofi committed Jan 5, 2024
1 parent 12f69cd commit 9c51fb0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkgs/os-specific/linux/nvidia-x11/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@

with lib;

assert useSettings -> !libsOnly;
assert !libsOnly -> kernel != null;
assert versionOlder version "391" -> sha256_32bit != null;
assert useSettings -> settingsSha256 != null;
Expand Down

0 comments on commit 9c51fb0

Please sign in to comment.