diff options
author | tdback <tyler@tdback.net> | 2025-01-16 19:57:13 -0500 |
---|---|---|
committer | tdback <tyler@tdback.net> | 2025-01-16 19:57:13 -0500 |
commit | 88017f5a874478dd82f306a5df88c38a8d06fcb6 (patch) | |
tree | 8806c58c4f21bb6a56d8530df8a93b256d44b4f3 /modules/scripts | |
parent | 01d012473d4311d4f4e5a0831d912bc4b8c61639 (diff) |
fix: format flake with `nixfmt-rfc-style`
Diffstat (limited to 'modules/scripts')
-rw-r--r-- | modules/scripts/motd/default.nix | 19 | ||||
-rw-r--r-- | modules/scripts/pushover/default.nix | 10 | ||||
-rw-r--r-- | modules/scripts/zquota/default.nix | 32 |
3 files changed, 41 insertions, 20 deletions
diff --git a/modules/scripts/motd/default.nix b/modules/scripts/motd/default.nix index c4b0c6b..6d95119 100644 --- a/modules/scripts/motd/default.nix +++ b/modules/scripts/motd/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; let cfg = config.programs.motd; @@ -35,9 +40,12 @@ let printf "\n" printf "''${BOLD}Good $TIME $(whoami), welcome to $(hostname)!$ENDCOLOR\n" printf "\n" - ${strings.concatStrings (lists.forEach cfg.networkInterfaces ( - int: "printf \"$BOLD * %-20s$ENDCOLOR %s\\n\" \"IPv4 ${int}\" \"$(ip -4 addr show ${int} | grep -oP '(?<=inet\\s)\\d+(\\.\\d+){3}')\"\n" - ))} + ${strings.concatStrings ( + lists.forEach cfg.networkInterfaces ( + int: + "printf \"$BOLD * %-20s$ENDCOLOR %s\\n\" \"IPv4 ${int}\" \"$(ip -4 addr show ${int} | grep -oP '(?<=inet\\s)\\d+(\\.\\d+){3}')\"\n" + ) + )} printf "$BOLD * %-20s$ENDCOLOR %s\n" "Release" "$(awk -F= '/PRETTY_NAME/ { print $2 }' /etc/os-release | tr -d '"')" printf "$BOLD * %-20s$ENDCOLOR %s\n" "Kernel" "$(uname -rs)" printf "\n" @@ -68,7 +76,8 @@ let done <<< "$SERVICES" printf "\n" ''; -in { +in +{ options = { programs.motd = { enable = mkEnableOption "motd"; diff --git a/modules/scripts/pushover/default.nix b/modules/scripts/pushover/default.nix index a5644e4..979e96b 100644 --- a/modules/scripts/pushover/default.nix +++ b/modules/scripts/pushover/default.nix @@ -1,4 +1,9 @@ -{ inputs, config, pkgs, ... }: +{ + inputs, + config, + pkgs, + ... +}: let pushover = pkgs.writeShellScriptBin "pushover" '' set -e @@ -35,7 +40,8 @@ let --form-string "message=$MESSAGE" \ https://api.pushover.net/1/messages.json ''; -in { +in +{ age.secrets = { pushoverAppToken.file = "${inputs.self}/secrets/pushoverAppToken.age"; pushoverUserToken.file = "${inputs.self}/secrets/pushoverUserToken.age"; diff --git a/modules/scripts/zquota/default.nix b/modules/scripts/zquota/default.nix index 5741e0e..bd35546 100644 --- a/modules/scripts/zquota/default.nix +++ b/modules/scripts/zquota/default.nix @@ -1,13 +1,19 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; let cfg = config.services.zquota; - zquota = let - bc = getExe pkgs.bc; - zfs = getExe pkgs.zfs; - hostname = config.networking.hostName; - in + zquota = + let + bc = getExe pkgs.bc; + zfs = getExe pkgs.zfs; + hostname = config.networking.hostName; + in pkgs.writeShellScriptBin "zquota" '' set -e @@ -38,7 +44,8 @@ let "dataset $DATASET on ${hostname} has exceeded quota by ''${DIFF}GB" fi ''; -in { +in +{ options = { services.zquota = { enable = mkEnableOption "zquota"; @@ -66,12 +73,11 @@ in { systemd.services."zquota" = { description = "Perform and report scheduled quota checks on ZFS datasets."; serviceConfig.Type = "oneshot"; - script = - strings.concatStringsSep "\n" ( - mapAttrsToList (dataset: quota: - "/run/current-system/sw/bin/zquota ${dataset} ${builtins.toString quota}" - ) cfg.quotas - ); + script = strings.concatStringsSep "\n" ( + mapAttrsToList ( + dataset: quota: "/run/current-system/sw/bin/zquota ${dataset} ${builtins.toString quota}" + ) cfg.quotas + ); }; systemd.timers."zquota" = { wantedBy = [ "timers.target" ]; |