Use lib.mkEnableOption where possible
This commit is contained in:
parent
e7dddd56f9
commit
99b84bd224
36 changed files with 48 additions and 158 deletions
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.hardware.amdLaptop;
|
||||
in
|
||||
{
|
||||
options.custom.hardware.amdLaptop.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.hardware.amdLaptop.enable = lib.mkEnableOption "AMD laptop hardware configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ zenmonitor ];
|
||||
|
@ -45,8 +42,6 @@ in
|
|||
|
||||
};
|
||||
};
|
||||
|
||||
logind.lidSwitch = if config.boot.resumeDevice != "" then "hibernate" else "suspend";
|
||||
};
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -8,10 +8,8 @@ let
|
|||
cfg = config.custom.hardware.intelLaptop;
|
||||
in
|
||||
{
|
||||
options.custom.hardware.intelLaptop.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.hardware.intelLaptop.enable =
|
||||
lib.mkEnableOption "Intel laptop hardware configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services = {
|
||||
|
@ -35,8 +33,6 @@ in
|
|||
|
||||
};
|
||||
};
|
||||
|
||||
logind.lidSwitch = if config.boot.resumeDevice != "" then "hibernate" else "suspend";
|
||||
};
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.hardware.keychron;
|
||||
in
|
||||
{
|
||||
options.custom.hardware.keychron.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.hardware.keychron.enable = lib.mkEnableOption "Keychron Q11 hardware configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; if config.services.xserver.enable then [ via ] else [ ];
|
||||
|
|
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.hardware.nvidia;
|
||||
in
|
||||
{
|
||||
options.custom.hardware.nvidia.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.hardware.nvidia.enable = lib.mkEnableOption "NVIDIA dGPU hardware configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware = {
|
||||
|
|
|
@ -8,10 +8,8 @@ let
|
|||
cfg = config.custom.hardware.onlykey;
|
||||
in
|
||||
{
|
||||
options.custom.hardware.onlykey.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.hardware.onlykey.enable =
|
||||
lib.mkEnableOption "OnlyKey USB security key hardware configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
|
|
@ -3,10 +3,8 @@ let
|
|||
cfg = config.custom.hardware.trackball;
|
||||
in
|
||||
{
|
||||
options.custom.hardware.trackball.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.hardware.trackball.enable =
|
||||
lib.mkEnableOption "Logitech MX Ergo trackball hardware configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
nixpkgs.overlays = [
|
||||
|
|
|
@ -6,10 +6,7 @@ in
|
|||
{
|
||||
options.custom.networking = {
|
||||
homeWg = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
enable = lib.mkEnableOption "Home WireGuard";
|
||||
guaSuffix = lib.mkOption {
|
||||
type = with lib.types; nullOr (strMatching "^[0-9a-zA-Z:]+$");
|
||||
default = null;
|
||||
|
|
|
@ -3,14 +3,7 @@ let
|
|||
cfg = config.custom.networking.idacloudWg;
|
||||
in
|
||||
{
|
||||
options.custom.networking = {
|
||||
idacloudWg = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
options.custom.networking.idacloudWg.enable = lib.mkEnableOption "Idacloud WireGuard";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops = {
|
||||
|
|
|
@ -6,10 +6,7 @@ in
|
|||
{
|
||||
options.custom.networking = {
|
||||
netflixWg = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
enable = lib.mkEnableOption "Netflix WireGuard";
|
||||
suffix = lib.mkOption {
|
||||
type = with lib.types; nullOr (strMatching "^[0-9.]+$");
|
||||
default = null;
|
||||
|
|
|
@ -4,10 +4,7 @@ let
|
|||
in
|
||||
{
|
||||
options.custom.platform.hetzner = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
enable = lib.mkEnableOption "Hetzner cloud configuration";
|
||||
ipv4Address = lib.mkOption {
|
||||
type = with lib.types; nullOr (strMatching "^[0-9]+.[0-9]+.[0-9]+.[0-9]+/32$");
|
||||
default = null;
|
||||
|
|
|
@ -7,10 +7,7 @@ let
|
|||
cfg = config.custom.platform.vm;
|
||||
in
|
||||
{
|
||||
options.custom.platform.vm.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.platform.vm.enable = lib.mkEnableOption "KVM virtual machine guest configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.qemuGuest.enable = true;
|
||||
|
|
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.programs.bitwarden;
|
||||
in
|
||||
{
|
||||
options.custom.programs.bitwarden.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.programs.bitwarden.enable = lib.mkEnableOption "Bitwarden desktop applications";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
|
|
@ -8,10 +8,8 @@ let
|
|||
cfg = config.custom.programs.communication;
|
||||
in
|
||||
{
|
||||
options.custom.programs.communication.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.programs.communication.enable =
|
||||
lib.mkEnableOption "messaging/communication programs";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
|
|
@ -11,10 +11,7 @@ let
|
|||
};
|
||||
in
|
||||
{
|
||||
options.custom.programs.firefox.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.programs.firefox.enable = lib.mkEnableOption "customized Firefox configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.firefox = {
|
||||
|
|
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.programs.i3;
|
||||
in
|
||||
{
|
||||
options.custom.programs.i3.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.programs.i3.enable = lib.mkEnableOption "i3 window manager";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
|
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.programs.moonlight;
|
||||
in
|
||||
{
|
||||
options.custom.programs.moonlight.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.programs.moonlight.enable = lib.mkEnableOption "Moonlight game streaming client";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
|
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.programs.nvim;
|
||||
in
|
||||
{
|
||||
options.custom.programs.nvim.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.programs.nvim.enable = lib.mkEnableOption "customized nVim configuration";
|
||||
|
||||
imports = [ nixvim.nixosModules.nixvim ];
|
||||
|
||||
|
|
|
@ -3,10 +3,7 @@ let
|
|||
cfg = config.custom.programs.redshift;
|
||||
in
|
||||
{
|
||||
options.custom.programs.redshift.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.programs.redshift.enable = lib.mkEnableOption "redshift blue-light reducer";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.redshift = {
|
||||
|
|
|
@ -3,10 +3,8 @@ let
|
|||
cfg = config.custom.programs.symlinks;
|
||||
in
|
||||
{
|
||||
options.custom.programs.symlinks.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.programs.symlinks.enable =
|
||||
lib.mkEnableOption "automatic symlinks of specific configuration files";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
system.userActivationScripts.mkDesktopSettingsSymlinks.text =
|
||||
|
|
|
@ -3,10 +3,7 @@ let
|
|||
cfg = config.custom.programs.usbAutoMount;
|
||||
in
|
||||
{
|
||||
options.custom.programs.usbAutoMount.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.programs.usbAutoMount.enable = lib.mkEnableOption "auto-mounting of USB storage";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services = {
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
}:
|
||||
{
|
||||
options.custom = {
|
||||
base.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
base.enable = lib.mkEnableOption "base configuration for my hosts";
|
||||
networking.guaPref = lib.mkOption {
|
||||
type = with lib.types; nullOr (strMatching "^[0-9a-zA-Z:]+$");
|
||||
default = "2001:14ba:a090:39";
|
||||
|
@ -19,6 +16,9 @@
|
|||
};
|
||||
|
||||
config = {
|
||||
custom.base.enable = lib.mkDefault true;
|
||||
}
|
||||
// (lib.mkIf config.custom.base.enable {
|
||||
######################################## Packages ###############################################
|
||||
environment.systemPackages = with pkgs; [
|
||||
tmux
|
||||
|
@ -196,5 +196,5 @@
|
|||
efi.canTouchEfiVariables = lib.mkDefault true;
|
||||
timeout = lib.mkDefault 0;
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.roles.desktop;
|
||||
in
|
||||
{
|
||||
options.custom.roles.desktop.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.roles.desktop.enable = lib.mkEnableOption "desktop role";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
custom = {
|
||||
|
@ -20,6 +17,7 @@ in
|
|||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
libreoffice
|
||||
alacritty
|
||||
vlc
|
||||
flameshot
|
||||
|
|
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.roles.development;
|
||||
in
|
||||
{
|
||||
options.custom.roles.development.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.roles.development.enable = lib.mkEnableOption "development role";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
custom.programs.nvim.enable = true;
|
||||
|
|
|
@ -8,14 +8,10 @@ let
|
|||
cfg = config.custom.roles.study;
|
||||
in
|
||||
{
|
||||
options.custom.roles.study.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.roles.study.enable = lib.mkEnableOption "study configuration";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
libreoffice
|
||||
zotero
|
||||
kile
|
||||
texliveFull
|
||||
|
|
|
@ -44,10 +44,7 @@ let
|
|||
'';
|
||||
in
|
||||
{
|
||||
options.custom.services.certStoreServer.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.services.certStoreServer.enable = lib.mkEnableOption "cert-store server";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops = {
|
||||
|
|
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.services.forgejoRunner;
|
||||
in
|
||||
{
|
||||
options.custom.services.forgejoRunner.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.services.forgejoRunner.enable = lib.mkEnableOption "Forgejo actions runner";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops.secrets.forgejo-token = {
|
||||
|
|
|
@ -3,10 +3,7 @@ let
|
|||
cfg = config.custom.services.forgejo;
|
||||
in
|
||||
{
|
||||
options.custom.services.forgejo.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.services.forgejo.enable = lib.mkEnableOption "self-hosted Forgejo instance";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
custom.services = {
|
||||
|
|
|
@ -8,10 +8,7 @@ let
|
|||
cfg = config.custom.services.gamingServer;
|
||||
in
|
||||
{
|
||||
options.custom.services.gamingServer.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.services.gamingServer.enable = lib.mkEnableOption "Game streaming server";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.tmpfiles.settings."vili-home" = {
|
||||
|
|
|
@ -4,10 +4,7 @@ let
|
|||
hydraDomain = "ci.sinerva.eu";
|
||||
in
|
||||
{
|
||||
options.custom.services.hydra.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.services.hydra.enable = lib.mkEnableOption "Hydra continous integration server";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
custom.services = {
|
||||
|
|
|
@ -10,19 +10,13 @@ in
|
|||
{
|
||||
options.custom.services = {
|
||||
nextcloud = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
enable = lib.mkEnableOption "self-hosted Nextcloud instance";
|
||||
domain = lib.mkOption {
|
||||
type = with lib.types; nullOr str;
|
||||
default = null;
|
||||
};
|
||||
collabora = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
enable = lib.mkEnableOption "self-hosted Collabora server alongside Nextcloud";
|
||||
domain = lib.mkOption {
|
||||
type = with lib.types; nullOr str;
|
||||
default = null;
|
||||
|
|
|
@ -3,10 +3,8 @@ let
|
|||
cfg = config.custom.services.siit;
|
||||
in
|
||||
{
|
||||
options.custom.services.siit.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.services.siit.enable =
|
||||
lib.mkEnableOption "IPv4 to IPv6 stateless translator (SIIT-DC)";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
networking = {
|
||||
|
|
|
@ -4,10 +4,7 @@ let
|
|||
in
|
||||
{
|
||||
options = {
|
||||
custom.services.acmeHttpClient.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
custom.services.acmeHttpClient.enable = lib.mkEnableOption "ACME HTTP client";
|
||||
|
||||
services.nginx.virtualHosts = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
|
|
|
@ -4,10 +4,7 @@ let
|
|||
in
|
||||
{
|
||||
options = {
|
||||
custom.services.certStoreClient.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
custom.services.certStoreClient.enable = lib.mkEnableOption "cert-store client";
|
||||
|
||||
services.nginx.virtualHosts = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
|
|
|
@ -4,10 +4,7 @@ let
|
|||
in
|
||||
{
|
||||
options = {
|
||||
custom.services.nginxHttpsServer.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
custom.services.nginxHttpsServer.enable = lib.mkEnableOption "default nginx HTTPS server configuration";
|
||||
|
||||
services.nginx.virtualHosts = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
|
|
|
@ -3,10 +3,7 @@ let
|
|||
cfg = config.custom.services.vaultwarden;
|
||||
in
|
||||
{
|
||||
options.custom.services.vaultwarden.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.services.vaultwarden.enable = lib.mkEnableOption "self-hosted Vaultwarden instance";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
custom.services = {
|
||||
|
|
|
@ -3,10 +3,7 @@ let
|
|||
cfg = config.custom.users.vili;
|
||||
in
|
||||
{
|
||||
options.custom.users.vili.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
options.custom.users.vili.enable = lib.mkEnableOption "user 'vili'";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops.secrets =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue