refactor
This commit is contained in:
parent
66c05f9093
commit
45d6f4b0f3
205 changed files with 9040 additions and 342 deletions
62
lib/module/default.nix
Normal file
62
lib/module/default.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{ lib, ... }:
|
||||
|
||||
with lib; rec {
|
||||
## Create a NixOS module option.
|
||||
##
|
||||
## ```nix
|
||||
## lib.mkOpt nixpkgs.lib.types.str "My default" "Description of my option."
|
||||
## ```
|
||||
##
|
||||
#@ Type -> Any -> String
|
||||
mkOpt = type: default: description:
|
||||
mkOption { inherit type default description; };
|
||||
|
||||
## Create a NixOS module option without a description.
|
||||
##
|
||||
## ```nix
|
||||
## lib.mkOpt' nixpkgs.lib.types.str "My default"
|
||||
## ```
|
||||
##
|
||||
#@ Type -> Any -> String
|
||||
mkOpt' = type: default: mkOpt type default null;
|
||||
|
||||
## Create a boolean NixOS module option.
|
||||
##
|
||||
## ```nix
|
||||
## lib.mkBoolOpt true "Description of my option."
|
||||
## ```
|
||||
##
|
||||
#@ Type -> Any -> String
|
||||
mkBoolOpt = mkOpt types.bool;
|
||||
|
||||
## Create a boolean NixOS module option without a description.
|
||||
##
|
||||
## ```nix
|
||||
## lib.mkBoolOpt true
|
||||
## ```
|
||||
##
|
||||
#@ Type -> Any -> String
|
||||
mkBoolOpt' = mkOpt' types.bool;
|
||||
|
||||
enabled = {
|
||||
## Quickly enable an option.
|
||||
##
|
||||
## ```nix
|
||||
## services.nginx = enabled;
|
||||
## ```
|
||||
##
|
||||
#@ true
|
||||
enable = true;
|
||||
};
|
||||
|
||||
disabled = {
|
||||
## Quickly disable an option.
|
||||
##
|
||||
## ```nix
|
||||
## services.nginx = enabled;
|
||||
## ```
|
||||
##
|
||||
#@ false
|
||||
enable = false;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue