mirror of
https://github.com/TheWanderingCrow/CrOS.git
synced 2026-01-11 01:34:08 -05:00
add lib extensions from other repo
This commit is contained in:
parent
c3de531219
commit
fae3e9ef1f
2 changed files with 55 additions and 1 deletions
|
|
@ -10,6 +10,6 @@
|
|||
sops-nix.url = "github:Mic92/sops-nix";
|
||||
|
||||
# CrOS inputs
|
||||
nix-secrets = "github:TheWanderingCrow/nix-secrets";
|
||||
nix-secrets.url = "github:TheWanderingCrow/nix-secrets";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
54
lib/default.nix
Normal file
54
lib/default.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{lib, ...}:
|
||||
# Credit: @JakeHamilton
|
||||
# https://github.com/jakehamilton/config/blob/bf8411ec6b636f887dac45970864e09ba3ebf816/lib/module/default.nix
|
||||
with lib; {
|
||||
## 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 NixOS module option with no default
|
||||
##
|
||||
## ```nix
|
||||
## lib.mkOpt_ types.path "Description of my option"
|
||||
## ```
|
||||
##
|
||||
#@ Type -> Any -> String
|
||||
mkOpt_ = type: description: mkOption {inherit type description;};
|
||||
|
||||
enabled = {
|
||||
## Quickly enable an option.
|
||||
##
|
||||
## ```nix
|
||||
## services.nginx = enabled;
|
||||
## ```
|
||||
##
|
||||
#@ true
|
||||
enable = true;
|
||||
};
|
||||
|
||||
disabled = {
|
||||
## Quickly disable an option.
|
||||
##
|
||||
## ```nix
|
||||
## services.nginx = disabled;
|
||||
## ```
|
||||
##
|
||||
#@ false
|
||||
enable = false;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue