summary refs log blame commit diff
path: root/lib/kernel.nix
blob: 2ce19f8cb68c051e834b50acc5f3ec8c0b74d23b (plain) (tree)
1
2
3
4
5
6
7
8
9
        

         
 
 
 


                                                                                    
 



                                    
 









                                                                                                        
 
{ lib }:

with lib;
{


  # 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; };

  /*
    Common patterns/legacy used in common-config/hardened-config.nix
   */
  whenHelpers = version: {
    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);
  };

}