diff options
Diffstat (limited to 'lib/default.nix')
-rw-r--r-- | lib/default.nix | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/default.nix b/lib/default.nix index d84ac5e2..1cdbf936 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -7,7 +7,7 @@ # # You should have received a copy of the License along with this program. # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{lib}: let +{lib}: rec { /* Converts `number` from a binary number to a decimal one. @@ -101,6 +101,26 @@ else if power > 0 then (base * (pow base (power - 1))) else builtins.throw "Negative powers are not supported"; -in { - inherit binaryToDecimal idFromString pow; + + options = { + /* + Generate an enable option definition, that defaults to true. + + This conveniently allows the composition of a “common” module set. + + # Type + + mkEnable :: String -> AttrSet + + # Arguments + + name + : The name to use in the option description. + */ + mkEnable = name: + (lib.mkEnableOption name) + // { + default = true; + }; + }; } |