From 464b6a7850f43fd76b9e536f20cbce13308a9f4d Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Tue, 21 Oct 2025 21:10:53 +0200 Subject: [PATCH] Use `lib.singleton` when convenient --- modules/home/programs/git.nix | 20 +++++++++----------- modules/home/services/cliphist.nix | 10 ++++------ modules/system/meta/domains.nix | 10 ++++------ modules/system/web-services/freshrss.nix | 10 ++++------ modules/system/web-services/gatus.nix | 20 +++++++++----------- modules/system/web-services/privatebin.nix | 10 ++++------ 6 files changed, 34 insertions(+), 46 deletions(-) diff --git a/modules/home/programs/git.nix b/modules/home/programs/git.nix index af655bb..c6f7622 100644 --- a/modules/home/programs/git.nix +++ b/modules/home/programs/git.nix @@ -23,18 +23,16 @@ signByDefault = true; }; - includes = [ - { - condition = "gitdir:~/Projects/h-da/**"; - contents = { - user = { - name = "Sebastian Stork"; - email = "sebastian.stork@stud.h-da.de"; - signingkey = config.sops.secrets."ssh-key/code.fbi.h-da.de".path; - }; + includes = lib.singleton { + condition = "gitdir:~/Projects/h-da/**"; + contents = { + user = { + name = "Sebastian Stork"; + email = "sebastian.stork@stud.h-da.de"; + signingkey = config.sops.secrets."ssh-key/code.fbi.h-da.de".path; }; - } - ]; + }; + }; }; ssh = { diff --git a/modules/home/services/cliphist.nix b/modules/home/services/cliphist.nix index 0e83756..43f7baf 100644 --- a/modules/home/services/cliphist.nix +++ b/modules/home/services/cliphist.nix @@ -8,12 +8,10 @@ options.custom.services.cliphist.enable = lib.mkEnableOption ""; config = lib.mkIf config.custom.services.cliphist.enable { - assertions = [ - { - assertion = config.custom.programs.rofi.enable; - message = "Cliphist requires Rofi."; - } - ]; + assertions = lib.singleton { + assertion = config.custom.programs.rofi.enable; + message = "Cliphist requires Rofi."; + }; services.cliphist = { enable = true; diff --git a/modules/system/meta/domains.nix b/modules/system/meta/domains.nix index 186c980..3100168 100644 --- a/modules/system/meta/domains.nix +++ b/modules/system/meta/domains.nix @@ -54,11 +54,9 @@ in ) |> lib.concatStrings; in - [ - { - assertion = duplicateDomains == { }; - message = errorMessage; - } - ]; + lib.singleton { + assertion = duplicateDomains == { }; + message = errorMessage; + }; }; } diff --git a/modules/system/web-services/freshrss.nix b/modules/system/web-services/freshrss.nix index 0a4d020..c27374c 100644 --- a/modules/system/web-services/freshrss.nix +++ b/modules/system/web-services/freshrss.nix @@ -23,12 +23,10 @@ in }; config = lib.mkIf cfg.enable { - assertions = [ - { - assertion = lib'.isTailscaleDomain cfg.domain; - message = "FreshRSS isn't configured with access controll."; - } - ]; + assertions = lib.singleton { + assertion = lib'.isTailscaleDomain cfg.domain; + message = "FreshRSS isn't configured with access controll."; + }; meta = { domains.list = [ cfg.domain ]; diff --git a/modules/system/web-services/gatus.nix b/modules/system/web-services/gatus.nix index 28805f4..91691b3 100644 --- a/modules/system/web-services/gatus.nix +++ b/modules/system/web-services/gatus.nix @@ -159,17 +159,15 @@ in success-threshold = 4; send-on-resolved = true; }; - overrides = [ - { - group = "Monitoring"; - topic = "stork-atlas"; - url = "https://ntfy.sh"; - default-alert = { - failure-threshold = 4; - success-threshold = 2; - }; - } - ]; + overrides = lib.singleton { + group = "Monitoring"; + topic = "stork-atlas"; + url = "https://ntfy.sh"; + default-alert = { + failure-threshold = 4; + success-threshold = 2; + }; + }; }; ui.default-sort-by = "group"; maintenance = { diff --git a/modules/system/web-services/privatebin.nix b/modules/system/web-services/privatebin.nix index ca2e90c..2a6db96 100644 --- a/modules/system/web-services/privatebin.nix +++ b/modules/system/web-services/privatebin.nix @@ -47,12 +47,10 @@ in }; }; - nginx.virtualHosts.privatebin.listen = [ - { - addr = "localhost"; - inherit (cfg) port; - } - ]; + nginx.virtualHosts.privatebin.listen = lib.singleton { + addr = "localhost"; + inherit (cfg) port; + }; }; custom.persist.directories = [ config.services.privatebin.dataDir ];