Merge branch 'master' of ssh://git.nx2.site:20022/nx2/dotfiles
This commit is contained in:
@@ -9,7 +9,10 @@
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
# services.pcscd.enable = true;
|
# services.pcscd.enable = true;
|
||||||
services.gpg-agent = {
|
services.gpg-agent =
|
||||||
|
let
|
||||||
|
min2sec = min: (min * 60);
|
||||||
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
verbose = true;
|
verbose = true;
|
||||||
sshKeys = [
|
sshKeys = [
|
||||||
@@ -17,6 +20,8 @@
|
|||||||
];
|
];
|
||||||
enableSshSupport = true;
|
enableSshSupport = true;
|
||||||
enableFishIntegration = true;
|
enableFishIntegration = true;
|
||||||
|
defaultCacheTtlSsh = min2sec 60;
|
||||||
|
defaultCacheTtl = min2sec 30;
|
||||||
# pinentryPackage = pkgs.pinentry-gtk2;
|
# pinentryPackage = pkgs.pinentry-gtk2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ let
|
|||||||
name = "HDMI-A-1";
|
name = "HDMI-A-1";
|
||||||
resolution = "3840x2160";
|
resolution = "3840x2160";
|
||||||
position = "0x0";
|
position = "0x0";
|
||||||
scale = "1.0";
|
scale = "2.0";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ let
|
|||||||
in
|
in
|
||||||
lib.mkIf (user != "tv")
|
lib.mkIf (user != "tv")
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [
|
home.packages =
|
||||||
(pkgs.writeShellScriptBin "waybar_mode" ''
|
let
|
||||||
#!/usr/bin/env bash
|
waybar_mode_script = /*bash*/ ''
|
||||||
print_help() {
|
print_help() {
|
||||||
echo "Usage: waybar_mode {set <string>|unset}"
|
echo "Usage: waybar_mode {set <string>|unset}"
|
||||||
}
|
}
|
||||||
@@ -36,18 +36,19 @@ lib.mkIf (user != "tv")
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
exit 0
|
exit 0
|
||||||
'')
|
'';
|
||||||
(pkgs.writeShellScriptBin "cclock" ''
|
cclock_script = /*bash*/ ''
|
||||||
#!/bin/bash
|
|
||||||
#ord=$(date +"%e" | awk '{printf("%d%s\n", $1, substr("thstndrd", ($1%100-20)%10*2+1, 2))}')
|
|
||||||
ord=$(date +"%e" | awk '{printf("%d%s\n", $1, ($1==11||$1==12||$1==13)?"th":((($1%10)==1)?"st":((($1%10)==2)?"nd":((($1%10)==3)?"rd":"th"))))}')
|
ord=$(date +"%e" | awk '{printf("%d%s\n", $1, ($1==11||$1==12||$1==13)?"th":((($1%10)==1)?"st":((($1%10)==2)?"nd":((($1%10)==3)?"rd":"th"))))}')
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo "${sep}$(date +'%A the')" "$ord" "of" "$(date +'%B')" " ${sep}$(date +'%R')"
|
echo "${sep}$(date +'%A the')" "$ord" "of" "$(date +'%B')" " ${sep}$(date +'%R')"
|
||||||
elif [ "$1" = "--no-icons" ]; then
|
elif [ "$1" = "--no-icons" ]; then
|
||||||
echo "$(date +'%A the')" "$ord" "of" "$(date +'%B')" "$(date +'%R')"
|
echo "$(date +'%A the')" "$ord" "of" "$(date +'%B')" "$(date +'%R')"
|
||||||
fi
|
fi
|
||||||
'')
|
'';
|
||||||
|
in
|
||||||
|
with pkgs; [
|
||||||
|
(writeShellApplication "waybar_mode" waybar_mode_script)
|
||||||
|
(writeShellApplication "cclock" cclock_script)
|
||||||
] ++ [ pkgs-unstable.waybar ];
|
] ++ [ pkgs-unstable.waybar ];
|
||||||
|
|
||||||
programs.waybar = {
|
programs.waybar = {
|
||||||
|
|||||||
@@ -57,17 +57,15 @@ in
|
|||||||
extraModprobeConfig = ''options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1'';
|
extraModprobeConfig = ''options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1'';
|
||||||
};
|
};
|
||||||
} else { # NxACE
|
} else { # NxACE
|
||||||
kernelPackages = pkgs.linuxPackages_latest;
|
boot = {
|
||||||
extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
|
loader = {
|
||||||
boot.loader.grub = {
|
efi.canTouchEfiVariables = true;
|
||||||
enable = true;
|
grub = {
|
||||||
configurationLimit = 30;
|
enable = true;
|
||||||
device = "nodev";
|
device = "nodev";
|
||||||
# useOSProber = true;
|
efiSupport = true;
|
||||||
efiSupport = true;
|
};
|
||||||
fontSize = 50;
|
};
|
||||||
efi.canTouchEfiVariables = true;
|
|
||||||
splashImage = null;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,40 +13,45 @@ lib.mkIf (host != "NxACE")
|
|||||||
|
|
||||||
systemd.services."health_reminder" =
|
systemd.services."health_reminder" =
|
||||||
let
|
let
|
||||||
hm = pkgs.writeScriptBin "health_reminder" ''
|
hm =
|
||||||
|
let p = /*python*/ ''
|
||||||
#!${pkgs.python3}/bin/python3
|
#!${pkgs.python3}/bin/python3
|
||||||
import random
|
import random
|
||||||
|
import re
|
||||||
|
|
||||||
class Action:
|
class Action:
|
||||||
def __init__(self, actionA: str, actionB: str, likelihood: int, options: str):
|
def __init__(self, action: str, likelihood: int, options: list[str] = None):
|
||||||
self.actionA = actionA
|
self.action = action
|
||||||
self.actionB = actionB
|
|
||||||
self.likelihood = likelihood
|
self.likelihood = likelihood
|
||||||
self.options = options
|
self.options = options if options is not None else []
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self.options:
|
try:
|
||||||
return f"{self.actionA}{random.choice(self.options)}{self.actionB}"
|
choice = random.choice(self.options)
|
||||||
else:
|
except IndexError:
|
||||||
return self.actionA
|
choice = ""
|
||||||
|
|
||||||
|
action = re.sub("%o", choice, self.action)
|
||||||
|
return action
|
||||||
|
|
||||||
actions = [
|
actions = [
|
||||||
Action("look away for 20 Seconds!", "", 300, ""),
|
Action("look away for %o Seconds!",300, ["10", "15"] ),
|
||||||
Action("Shrimp 3000!", "", 90, ""),
|
Action("Posture Check!", 90 ),
|
||||||
Action("Do ", " Biceps curls with each Arm! ", 5, ["50", "10", "20"]),
|
Action("Do %o Biceps curls!", 5, ["50", "100", "150"] ),
|
||||||
Action("Do ", " Shourlder thingees", 5, ["30", "50", "20"]),
|
Action("Do %o Shourlder thingees", 5, ["40 + 40", "50", "60"]),
|
||||||
Action("Plank for ", " senonds!", 5, ["60", "60", "70"]),
|
Action("Plank for %o senonds!", 5, ["60", "60", "70"] ),
|
||||||
Action("Strech your upper body!", "", 10, ""),
|
Action("Strech your upper body!", 20 ),
|
||||||
Action("Strech your core!", "", 5, ""),
|
Action("Strech your core!", 10 ),
|
||||||
Action("Strech your legs!", "", 5, ""),
|
Action("Strech your legs!", 10 ),
|
||||||
Action("Make Tea!", "", 5, ""),
|
Action("Make Tea!", 5 ),
|
||||||
|
Action("Touch Grass!", 5 )
|
||||||
]
|
]
|
||||||
|
|
||||||
total_likelihood = sum(a.likelihood for a in actions)
|
total_likelihood = sum(a.likelihood for a in actions)
|
||||||
random_action = random.choices(actions, [a.likelihood for a in actions], k=1)[0]
|
random_action = random.choices(actions, [a.likelihood for a in actions], k=1)[0]
|
||||||
print(random_action)
|
print(random_action)
|
||||||
'';
|
'';
|
||||||
|
in pkgs.writeScriptBin "health_reminder" p;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
script = ''
|
script = ''
|
||||||
|
|||||||
@@ -1,27 +1,54 @@
|
|||||||
{ config, pkgs, lib, user, host, ... }:
|
{ pkgs, lib, user, host, ... }:
|
||||||
|
lib.mkIf (host == "NxACE")
|
||||||
{
|
{
|
||||||
imports = if host == "NxACE" then [
|
systemd = {
|
||||||
|
timers."namecheap-dynamic-dns" = {
|
||||||
] else [];
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
config = lib.mkIf (host == "NxACE") {
|
OnBootSec = "2m";
|
||||||
systemd = {
|
OnUnitActiveSec = "10m";
|
||||||
timers."namecheap-dynamic-dns" = {
|
Unit = "namecheap-dynamic-dns.service";
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
timerConfig = {
|
|
||||||
OnBootSec = "2m";
|
|
||||||
OnUnitActiveSec = "10m";
|
|
||||||
Unit = "namecheap-dynamic-dns.service";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
services."namecheap-dynamic-dns" = {
|
};
|
||||||
script = ''
|
services."namecheap-dynamic-dns" =
|
||||||
/home/nx2/nx2site/domain/update-namecheap.sh
|
let
|
||||||
'';
|
u = pkgs.writeScriptBin "update_namecheap" ''
|
||||||
serviceConfig = {
|
my_ip=$(${pkgs.curl}/bin/curl -s https://ipinfo.io/ip)
|
||||||
Type = "oneshot";
|
dns_ip=$(${pkgs.dig}/bin/nslookup nx2.site | grep -E "Address: [0-9]" | cut -c 10-)
|
||||||
User = "nx2";
|
fdc="/home/nx2/nx2site/domain/count.txt"
|
||||||
};
|
|
||||||
|
force_update=false
|
||||||
|
|
||||||
|
while getopts "f" opt; do
|
||||||
|
case $opt in
|
||||||
|
f)
|
||||||
|
force_update=true
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$force_update" == true ] || [ "$my_ip" != "$dns_ip" ]; then
|
||||||
|
count=$(<$fdc)
|
||||||
|
echo [ $count times ] $(date) from $dns_ip to $my_ip >> /home/nx2/nx2site/domain/updates.log
|
||||||
|
pw=$(cat /home/nx2/nx2site/domain/pw.txt)
|
||||||
|
${pkgs.curl}/bin/curl -s "https://dynamicdns.park-your-domain.com/update?host=@&domain=nx2.site&password=$pw&ip=$my_ip"
|
||||||
|
${pkgs.curl}/bin/curl -s "https://dynamicdns.park-your-domain.com/update?host=*&domain=nx2.site&password=$pw&ip=$my_ip"
|
||||||
|
echo 0 > $fdc
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
script = ''
|
||||||
|
set -eu
|
||||||
|
${u}/bin/update_namecheap
|
||||||
|
'';
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
User = "nx2";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user