<commit_before>{pkgs, config, ...}:

let
  inherit (pkgs.lib) mkOption;
  inherit (builtins) head tail;

  obsolete = what: f:
    if builtins ? trace then
      builtins.trace "Obsolete ${what}." f
    else f;

  obsoleteMerge =
    obsolete "option" pkgs.lib.mergeDefaultOption;

  # temporary modifications.
  # backward here means that expression could either be a value or a
  # function which expects to have a pkgs argument.
  optionalPkgs = x:
    if builtins.isFunction x
    then obsolete "notation" (x pkgs)
    else x;

  backwardPkgsFunListMerge = list:
    pkgs.lib.concatMap optionalPkgs list;

  backwardPkgsFunMerge = list:
    if list != [] && tail list == []
    then optionalPkgs (head list)
    else abort "Defined at least twice.";

in

{

  time = {

    timeZone = mkOption {
      default = "CET";
      example = "America/New_York";
      description = "The time zone used when displaying times and dates.";
    };

  };

  
  boot = {

    isLiveCD = mkOption {
      default = false;
      description = "
        If set to true, the root device will be mounted read-only and
        a ramdisk will be mounted on top of it using unionfs to
        provide a writable root.  This is used for the NixOS
        Live-CD/DVD.
      ";
    };

    grubDevice = mkOption {
      default = "";
      example = "/dev/hda";
      description = "
        The device on which the boot loader, Grub, will be installed.
        If empty, Grub won't be installed and it's your responsibility
        to make the system bootable.
      ";
    };

    bootMount = mkOption {
      default = "";
      example = "(hd0,0)";
      description = "
        If the system partition may be wiped on reinstall, it is better
        to have /boot on a small partition. To do it, we need to explain
        to GRUB where the kernels live. Specify the partition here (in 
        GRUB notation.
      ";
    };

    resumeDevice = mkOption {
      default = "";
      example = "0:0";
      description = "
        Device for manual resume attempt during boot. Looks like 
        major:minor .
      ";
    };

    kernelPackages = mkOption {
      default = pkgs.kernelPackages;
      example = pkgs.kernelPackages_2_6_25;
      merge = backwardPkgsFunMerge;
      description = "
        This option allows you to override the Linux kernel used by
        NixOS.  Since things like external kernel module packages are
        tied to the kernel you're using, it also overrides those.
        This option is a function that takes Nixpkgs as an argument
        (as a convenience), and returns an attribute set containing at
        the very least an attribute <varname>kernel</varname>.
        Additional attributes may be needed depending on your
        configuration.  For instance, if you use the NVIDIA X driver,
        then it also needs to contain an attribute
        <varname>nvidiaDrivers</varname>.
      ";<commit_msg>added hint about how to get the swap partion kernel node numbers<commit_after>{pkgs, config, ...}:

let
  inherit (pkgs.lib) mkOption;
  inherit (builtins) head tail;

  obsolete = what: f:
    if builtins ? trace then
      builtins.trace "Obsolete ${what}." f
    else f;

  obsoleteMerge =
    obsolete "option" pkgs.lib.mergeDefaultOption;

  # temporary modifications.
  # backward here means that expression could either be a value or a
  # function which expects to have a pkgs argument.
  optionalPkgs = x:
    if builtins.isFunction x
    then obsolete "notation" (x pkgs)
    else x;

  backwardPkgsFunListMerge = list:
    pkgs.lib.concatMap optionalPkgs list;

  backwardPkgsFunMerge = list:
    if list != [] && tail list == []
    then optionalPkgs (head list)
    else abort "Defined at least twice.";

in

{

  time = {

    timeZone = mkOption {
      default = "CET";
      example = "America/New_York";
      description = "The time zone used when displaying times and dates.";
    };

  };

  
  boot = {

    isLiveCD = mkOption {
      default = false;
      description = "
        If set to true, the root device will be mounted read-only and
        a ramdisk will be mounted on top of it using unionfs to
        provide a writable root.  This is used for the NixOS
        Live-CD/DVD.
      ";
    };

    grubDevice = mkOption {
      default = "";
      example = "/dev/hda";
      description = "
        The device on which the boot loader, Grub, will be installed.
        If empty, Grub won't be installed and it's your responsibility
        to make the system bootable.
      ";
    };

    bootMount = mkOption {
      default = "";
      example = "(hd0,0)";
      description = "
        If the system partition may be wiped on reinstall, it is better
        to have /boot on a small partition. To do it, we need to explain
        to GRUB where the kernels live. Specify the partition here (in 
        GRUB notation.
      ";
    };

    resumeDevice = mkOption {
      default = "";
      example = "0:0";
      description = "
        Device for manual resume attempt during boot. Looks like 
        major:minor. ls -l /dev/SWAP_PARTION shows them.
      ";
    };

    kernelPackages = mkOption {
      default = pkgs.kernelPackages;
      example = pkgs.kernelPackages_2_6_25;
      merge = backwardPkgsFunMerge;
      description = "
        This option allows you to override the Linux kernel used by
        NixOS.  Since things like external kernel module packages are
        tied to the kernel you're using, it also overrides those.
        This option is a function that takes Nixpkgs as an argument
        (as a convenience), and returns an attribute set containing at
        the very least an attribute <varname>kernel</varname>.
        Additional attributes may be needed depending on your
        configuration.  For instance, if you use the NVIDIA X driver,
        then it also needs to contain an attribute
        <varname>nvidiaDrivers</varname>.
      ";
{'fraction_non_alphanumeric': 0.0745466756212223, 'fraction_numerical': 0.002686366689053056, 'mean_word_length': 2.276677667766777, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4379029', 'n_tokens_mistral': 1712, 'n_tokens_neox': 1650, 'n_words': 670}