diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-17 10:25:39 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-17 10:25:39 +0200 |
commit | a42cbf8834080e44d4ed377cd9c9cc9e161459d6 (patch) | |
tree | b70d7a6fcd086f80556623787934478d43940528 | |
parent | modules/qutebrowser: Correctly quote the statusbar.widgets settings (diff) | |
download | nixos-config-a42cbf8834080e44d4ed377cd9c9cc9e161459d6.zip |
lib/options.mkEnable: Init
This is the first required step into the direction of removing the `modules/common.nix` file.
Diffstat (limited to '')
-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; + }; + }; } |