refactor: use mkEnableOption,mkPackageOption where applicable
This commit is contained in:
@@ -146,10 +146,8 @@ in
|
|||||||
default = {};
|
default = {};
|
||||||
type = types.attrsOf (types.submodule ({ name, ...}: {
|
type = types.attrsOf (types.submodule ({ name, ...}: {
|
||||||
options = {
|
options = {
|
||||||
package = mkOption {
|
enable = mkEnableOption "enable the ${name} Firefox addon";
|
||||||
type = types.package;
|
package = mkPackageOption pkgs.firefox-extensions name {};
|
||||||
default = pkgs.firefox-extensions."${name}";
|
|
||||||
};
|
|
||||||
nativeMessagingHosts = mkOption {
|
nativeMessagingHosts = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
@@ -158,9 +156,6 @@ in
|
|||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
enable = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
@@ -2,10 +2,7 @@
|
|||||||
let
|
let
|
||||||
cfg = config.sane.programs.swayidle;
|
cfg = config.sane.programs.swayidle;
|
||||||
idleAction = with lib; types.submodule ({ config, name, ... }: {
|
idleAction = with lib; types.submodule ({ config, name, ... }: {
|
||||||
options.enable = mkOption {
|
options.enable = mkEnableOption "invoke ${name} when sway is idle for so long";
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
options.command = mkOption {
|
options.command = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = name;
|
default = name;
|
||||||
|
@@ -5,10 +5,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = with lib; {
|
options = with lib; {
|
||||||
sane.guest.enable = mkOption {
|
sane.guest.enable = mkEnableOption "enable guest account, accessible by select authorized ssh keys";
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
@@ -21,10 +21,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = with lib; {
|
options = with lib; {
|
||||||
sane.nixcache.enable = mkOption {
|
sane.nixcache.enable = mkEnableOption "fetch binaries from and build packages on one of my other machines";
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
sane.nixcache.enable-trusted-keys = mkOption {
|
sane.nixcache.enable-trusted-keys = mkOption {
|
||||||
default = config.sane.nixcache.enable;
|
default = config.sane.nixcache.enable;
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
@@ -5,10 +5,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.sane.roles.build-machine = with lib; {
|
options.sane.roles.build-machine = with lib; {
|
||||||
enable = mkOption {
|
enable = mkEnableOption "allow my other machines to dispatch build jobs to this one";
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
|
@@ -14,10 +14,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = with lib; {
|
options = with lib; {
|
||||||
sane.services.rsync-net.enable = mkOption {
|
sane.services.rsync-net.enable = mkEnableOption "periodically backup data to rsync.net";
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
sane.services.rsync-net.dirs = mkOption {
|
sane.services.rsync-net.dirs = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
description = ''
|
description = ''
|
||||||
|
@@ -28,10 +28,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = with lib; {
|
options = with lib; {
|
||||||
sane.services.wg-home.enable = mkOption {
|
sane.services.wg-home.enable = mkEnableOption "wireguard VPN connecting my devices to eachother";
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
sane.services.wg-home.visibleToWan = mkOption {
|
sane.services.wg-home.visibleToWan = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@@ -165,10 +165,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
sane.persist.enable = mkOption {
|
sane.persist.enable = mkEnableOption "selectively persist data to disk";
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
sane.persist.sys = mkOption {
|
sane.persist.sys = mkOption {
|
||||||
description = "directories (or files) to persist to disk, relative to the fs root /";
|
description = "directories (or files) to persist to disk, relative to the fs root /";
|
||||||
default = {};
|
default = {};
|
||||||
|
@@ -5,16 +5,8 @@ in
|
|||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
sane.services.dropbear = with lib; {
|
sane.services.dropbear = with lib; {
|
||||||
enable = mkOption {
|
enable = mkEnableOption "dropbear SSH server";
|
||||||
default = false;
|
package = mkPackageOption pkgs "dropbear" {};
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
|
|
||||||
package = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
default = pkgs.dropbear;
|
|
||||||
defaultText = literalExpression "pkgs.dropbear";
|
|
||||||
};
|
|
||||||
|
|
||||||
port = mkOption {
|
port = mkOption {
|
||||||
type = types.port;
|
type = types.port;
|
||||||
|
@@ -13,10 +13,7 @@ in
|
|||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
sane.services.dyn-dns = {
|
sane.services.dyn-dns = {
|
||||||
enable = mkOption {
|
enable = mkEnableOption "keep track of the public WAN address of this machine, as viewed externally";
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
|
|
||||||
ipPath = mkOption {
|
ipPath = mkOption {
|
||||||
default = "/var/lib/uninsane/wan.txt";
|
default = "/var/lib/uninsane/wan.txt";
|
||||||
|
@@ -13,10 +13,7 @@ in
|
|||||||
{
|
{
|
||||||
options.sane.services.eg25-manager = with lib; {
|
options.sane.services.eg25-manager = with lib; {
|
||||||
enable = mkEnableOption "Quectel EG25 modem manager service";
|
enable = mkEnableOption "Quectel EG25 modem manager service";
|
||||||
package = mkOption {
|
package = mkPackageOption pkgs "eg25-manager" {};
|
||||||
type = types.package;
|
|
||||||
default = pkgs.eg25-manager;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
# eg25-manager package ships udev rules *and* a systemd service.
|
# eg25-manager package ships udev rules *and* a systemd service.
|
||||||
|
@@ -166,10 +166,7 @@ in
|
|||||||
{
|
{
|
||||||
options = with lib; {
|
options = with lib; {
|
||||||
sane.services.hickory-dns = {
|
sane.services.hickory-dns = {
|
||||||
enable = mkOption {
|
enable = mkEnableOption "hickory DNS server";
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
asSystemResolver = mkOption {
|
asSystemResolver = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
@@ -7,18 +7,8 @@ in
|
|||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
sane.services.kiwix-serve = {
|
sane.services.kiwix-serve = {
|
||||||
enable = mkOption {
|
enable = mkEnableOption "serve .zim files (like Wikipedia archives) with kiwix";
|
||||||
default = false;
|
package = mkPackageOption pkgs "kiwix-tools" {};
|
||||||
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`.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
port = mkOption {
|
port = mkOption {
|
||||||
type = types.port;
|
type = types.port;
|
||||||
default = 80;
|
default = 80;
|
||||||
|
@@ -117,10 +117,7 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = with lib; {
|
options = with lib; {
|
||||||
sane.wowlan.enable = mkOption {
|
sane.wowlan.enable = mkEnableOption "Wake on Wireless LAN packets";
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
sane.wowlan.patterns = mkOption {
|
sane.wowlan.patterns = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
type = types.listOf patternOpts;
|
type = types.listOf patternOpts;
|
||||||
|
Reference in New Issue
Block a user