diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/hosts/lolcathost/default.nix b/hosts/lolcathost/default.nix index 599e295..a90cfbd 100755 --- a/hosts/lolcathost/default.nix +++ b/hosts/lolcathost/default.nix @@ -6,7 +6,7 @@ }: let home-manager = builtins.fetchTarball { url = "https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz"; - sha256 = "1kk5qzfb87mkgy6vzm7x8z8akxr3k8k7839yjdy48z034pvidhsr"; + sha256 = "0z94i2ig7wcm63fp1wkpp6r4458g2bj3r7ijlfapxihqybpgvng5"; }; in { imports = [ diff --git a/hosts/myputer/default.nix b/hosts/myputer/default.nix index bd85eb5..1143a0d 100755 --- a/hosts/myputer/default.nix +++ b/hosts/myputer/default.nix @@ -7,7 +7,7 @@ }: let home-manager = builtins.fetchTarball { url = "https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz"; - sha256 = "1kk5qzfb87mkgy6vzm7x8z8akxr3k8k7839yjdy48z034pvidhsr"; + sha256 = "0z94i2ig7wcm63fp1wkpp6r4458g2bj3r7ijlfapxihqybpgvng5"; }; in { imports = [ diff --git a/scripts/nix-list-installed b/scripts/nix-list-installed deleted file mode 100755 index 5a253b9..0000000 --- a/scripts/nix-list-installed +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh -nix-store -q --references /var/run/current-system/sw \ - | cut -d'-' -f2- diff --git a/scripts/openport b/scripts/openport deleted file mode 100755 index dd6222f..0000000 --- a/scripts/openport +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash -# Credit: u/boxofrox https://discourse.nixos.org/u/boxofrox -# Ref: https://discourse.nixos.org/t/how-to-temporarily-open-a-tcp-port-in-nixos/12306/3 -USAGE="[Usage] sudo withport " - -set -ueo pipefail - -open-port() { - local port=$1 - iptables -A INPUT -p tcp --dport $port -j ACCEPT -} - -close-port() { - local port=${1:-0} - iptables -D INPUT -p tcp --dport $port -j ACCEPT -} - -PORT=$1 -if [[ -z "$PORT" ]]; then - echo -e "[!] Port not given\n$USAGE" >&2 - exit 1 -fi -shift; # Drop port argument - -if [[ 0 -eq $# ]]; then - echo -e "[!] Command not given\n$USAGE" >&2 - exit 1 -fi - -open-port $PORT -# Ensure port closes if error occurs. -trap "close-port $PORT" EXIT -# Run the command as user, not root. -runuser -u $SUDO_USER -- "$@" -# Trap will close port. diff --git a/scripts/testvps b/scripts/testvps deleted file mode 100755 index 4382b7d..0000000 --- a/scripts/testvps +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash -# Requires: systemctl - -set -u - -function match { - [[ "$1" =~ $2 ]] -} - -function padlen { - local MAX=0 - for KEY in "$@"; do - local LEN=${#KEY} - ((LEN > MAX)) && MAX=$LEN - done - echo $MAX -} - -function pad { - local PAD="$1" - if [ -z "$PAD" ]; then - exit 1 - fi - - for ((i=0; i/dev/null) - if [ -z "$STAT" ]; then - fmt_print "$SERVICE" "$LPAD" "NOTFOUND" - exit 1 - fi - - local STAT_LOADED=$(head -n2 <<< "$STAT" | tail -n1) - # NOTE: "active " intentionally contains right padding - local ENABLED=$(match "$STAT_LOADED" "^\s*Loaded: loaded \(.*; enabled; .*\)" && echo "enabled" || echo "disabled") - local ACTIVE=$(match "$STAT" "\s*Active: active \(running\)" && echo "active " || echo "inactive") - fmt_print "$SERVICE" "$LPAD" "$ACTIVE" "$ENABLED" -) - -function test_services { - local PAD_ALIGN=$(padlen $@) - # fmt_test_service - for SERVICE in "$@"; do - local LPAD=$((PAD_ALIGN - ${#SERVICE})) - fmt_test_service "$SERVICE" $LPAD - done -} - -test_services nginx forgejo vaultwarden