3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules
aszlig 9bfd864c59
Merge reording asserts in NixOS eval (#47293)
Changes the evaluation order in that it evaluates assertions before
warnings, so that eg. the following would work:

  { config, lib, ... }:

  {
    options.foo = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "...";
    };

    options.bar = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "...";
    };

    config = lib.mkMerge [
      (lib.mkIf config.bar {
        system.build.bar = "foobar";
      })
      (lib.mkIf config.foo {
        assertions = lib.singleton {
          assertion = config.bar;
          message = "Bar needs to be enabled";
        };
        systemd.services.foo = {
          description = "Foo";
          serviceConfig.ExecStart = config.system.build.bar;
        };
      })
    ];
  }

This is because the systemd module includes definitions for warnings
that would trigger evaluation of the config.system.build.bar definition.

The original pull request references a breakage due to the following:

  {
    services.nixosManual.enable = false;
    services.nixosManual.showManual = true;
  }

However, changing the eval order between asserts and warnings clearly is
a corner case here and it only happens because of the aforementioned
usage of warnings in the systemd module and needs more discussion.

Nevertheless, this is still useful because it lowers the evaluation time
whenever an assertion is hit, which is a hard failure anyway.
2018-09-26 01:18:41 +02:00
..
config Merge branch 'master' into staging-next 2018-09-13 10:08:53 +02:00
hardware [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00
i18n/input-method nixos docs: more IDs 2018-09-02 15:47:59 -04:00
installer nixos: doc: move non-service parts of service.nixosManual to documentation.nixos 2018-09-23 20:50:47 +00:00
misc nixos: doc: move non-service parts of service.nixosManual to documentation.nixos 2018-09-23 20:50:47 +00:00
profiles nixos: Fix eval error for documentation.nixos 2018-09-25 23:39:44 +02:00
programs nixos/yabar: fix module & test (#46954) 2018-09-20 12:47:46 +02:00
security acme module: fix self-signed cert with openssl 1.1 2018-09-12 13:40:46 +02:00
services nixos: Fix eval error for documentation.nixos 2018-09-25 23:39:44 +02:00
system Merge reording asserts in NixOS eval (#47293) 2018-09-26 01:18:41 +02:00
tasks networking.hostId: fix cmd in description 2018-09-11 11:29:04 +02:00
testing nixos/tests: Set DefaultTimeoutStartSec very high (#44916) 2018-08-29 12:12:12 +02:00
virtualisation Revert "virtualization/qemu-vm: fix and improve virtio/scsi switching" 2018-09-25 11:10:10 +02:00
module-list.nix Merge pull request #46274 from mvnetbiz/libratbag 2018-09-21 22:49:17 +02:00
rename.nix nixos: doc: move non-service parts of service.nixosManual to documentation.nixos 2018-09-23 20:50:47 +00:00