refactor: use mkEnableOption,mkPackageOption where applicable

This commit is contained in:
2024-10-12 19:36:50 +00:00
parent 11b706b132
commit 2edce8e6c8
14 changed files with 17 additions and 73 deletions

View File

@@ -146,10 +146,8 @@ in
default = {};
type = types.attrsOf (types.submodule ({ name, ...}: {
options = {
package = mkOption {
type = types.package;
default = pkgs.firefox-extensions."${name}";
};
enable = mkEnableOption "enable the ${name} Firefox addon";
package = mkPackageOption pkgs.firefox-extensions name {};
nativeMessagingHosts = mkOption {
type = types.listOf types.str;
default = [];
@@ -158,9 +156,6 @@ in
type = types.listOf types.str;
default = [];
};
enable = mkOption {
type = types.bool;
};
};
}));
};

View File

@@ -2,10 +2,7 @@
let
cfg = config.sane.programs.swayidle;
idleAction = with lib; types.submodule ({ config, name, ... }: {
options.enable = mkOption {
type = types.bool;
default = true;
};
options.enable = mkEnableOption "invoke ${name} when sway is idle for so long";
options.command = mkOption {
type = types.str;
default = name;

View File

@@ -5,10 +5,7 @@ let
in
{
options = with lib; {
sane.guest.enable = mkOption {
default = false;
type = types.bool;
};
sane.guest.enable = mkEnableOption "enable guest account, accessible by select authorized ssh keys";
};
config = lib.mkIf cfg.enable {

View File

@@ -21,10 +21,7 @@ let
in
{
options = with lib; {
sane.nixcache.enable = mkOption {
default = false;
type = types.bool;
};
sane.nixcache.enable = mkEnableOption "fetch binaries from and build packages on one of my other machines";
sane.nixcache.enable-trusted-keys = mkOption {
default = config.sane.nixcache.enable;
type = types.bool;

View File

@@ -5,10 +5,7 @@ let
in
{
options.sane.roles.build-machine = with lib; {
enable = mkOption {
type = types.bool;
default = false;
};
enable = mkEnableOption "allow my other machines to dispatch build jobs to this one";
};
config = lib.mkMerge [

View File

@@ -14,10 +14,7 @@ let
in
{
options = with lib; {
sane.services.rsync-net.enable = mkOption {
default = false;
type = types.bool;
};
sane.services.rsync-net.enable = mkEnableOption "periodically backup data to rsync.net";
sane.services.rsync-net.dirs = mkOption {
type = types.listOf types.str;
description = ''

View File

@@ -28,10 +28,7 @@ let
in
{
options = with lib; {
sane.services.wg-home.enable = mkOption {
type = types.bool;
default = false;
};
sane.services.wg-home.enable = mkEnableOption "wireguard VPN connecting my devices to eachother";
sane.services.wg-home.visibleToWan = mkOption {
type = types.bool;
default = false;

View File

@@ -165,10 +165,7 @@ let
in
{
options = {
sane.persist.enable = mkOption {
default = false;
type = types.bool;
};
sane.persist.enable = mkEnableOption "selectively persist data to disk";
sane.persist.sys = mkOption {
description = "directories (or files) to persist to disk, relative to the fs root /";
default = {};

View File

@@ -5,16 +5,8 @@ in
{
options = {
sane.services.dropbear = with lib; {
enable = mkOption {
default = false;
type = types.bool;
};
package = mkOption {
type = types.package;
default = pkgs.dropbear;
defaultText = literalExpression "pkgs.dropbear";
};
enable = mkEnableOption "dropbear SSH server";
package = mkPackageOption pkgs "dropbear" {};
port = mkOption {
type = types.port;

View File

@@ -13,10 +13,7 @@ in
{
options = {
sane.services.dyn-dns = {
enable = mkOption {
default = false;
type = types.bool;
};
enable = mkEnableOption "keep track of the public WAN address of this machine, as viewed externally";
ipPath = mkOption {
default = "/var/lib/uninsane/wan.txt";

View File

@@ -13,10 +13,7 @@ in
{
options.sane.services.eg25-manager = with lib; {
enable = mkEnableOption "Quectel EG25 modem manager service";
package = mkOption {
type = types.package;
default = pkgs.eg25-manager;
};
package = mkPackageOption pkgs "eg25-manager" {};
};
config = lib.mkIf cfg.enable {
# eg25-manager package ships udev rules *and* a systemd service.

View File

@@ -166,10 +166,7 @@ in
{
options = with lib; {
sane.services.hickory-dns = {
enable = mkOption {
default = false;
type = types.bool;
};
enable = mkEnableOption "hickory DNS server";
asSystemResolver = mkOption {
default = false;
type = types.bool;

View File

@@ -7,18 +7,8 @@ in
{
options = {
sane.services.kiwix-serve = {
enable = mkOption {
default = false;
type = types.bool;
};
package = mkOption {
type = types.package;
default = pkgs.kiwix-tools;
defaultText = literalExpression "pkgs.kiwix-tools";
description = lib.mdDoc ''
The package that provides `bin/kiwix-serve`.
'';
};
enable = mkEnableOption "serve .zim files (like Wikipedia archives) with kiwix";
package = mkPackageOption pkgs "kiwix-tools" {};
port = mkOption {
type = types.port;
default = 80;

View File

@@ -117,10 +117,7 @@ let
in
{
options = with lib; {
sane.wowlan.enable = mkOption {
default = false;
type = types.bool;
};
sane.wowlan.enable = mkEnableOption "Wake on Wireless LAN packets";
sane.wowlan.patterns = mkOption {
default = [];
type = types.listOf patternOpts;