about summary refs log tree commit diff
path: root/lib/kernel.nix
blob: 5923011774b153961c9ac55a419fe17fa9de5538 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{ lib, version }:

with lib;
rec {
  # Common patterns/legacy
  whenAtLeast = ver: mkIf (versionAtLeast version ver);
  whenOlder   = ver: mkIf (versionOlder version ver);
  # range is (inclusive, exclusive)
  whenBetween = verLow: verHigh: mkIf (versionAtLeast version verLow && versionOlder version verHigh);


  # Keeping these around in case we decide to change this horrible implementation :)
  option = x:
      x // { optional = true; };

  yes      = { tristate    = "y"; };
  no       = { tristate    = "n"; };
  module   = { tristate    = "m"; };
  freeform = x: { freeform = x; };

}