forked from aylac.top/nixcfg
this repo has no description

miniflux and a ton of notifications!

Changed files
+295 -37
hosts
modules
hardware
acer
aspire
nixos
profiles
backups
services
fail2ban
monitoring
snippets
restic
tailnet
+21 -21
flake.lock
···
"nixpkgs": "nixpkgs"
},
"locked": {
-
"lastModified": 1755558529,
-
"narHash": "sha256-Q7eOM63Ky+Mb7HS5+eSxn2UOQSFAK82v2K1pL2pEiIw=",
+
"lastModified": 1755732626,
+
"narHash": "sha256-qLAElW0E2QmcrKAbLPjFdueAOpjp3HmlxaOQf4R4jas=",
"owner": "9001",
"repo": "copyparty",
-
"rev": "c51371c71d0449e3d3b223e7a3425f241065cae5",
+
"rev": "cd8771fa522d1cf645c3c7e0193f07b53d81559c",
"type": "github"
},
"original": {
···
]
},
"locked": {
-
"lastModified": 1755618859,
-
"narHash": "sha256-VGEZMAX/bOKrkg9x5DjXBfjpxm9gvU3kRVps7RKm8mQ=",
+
"lastModified": 1755739851,
+
"narHash": "sha256-SC703bnPGOPWSEdZN2J2MkJWQBcUHV4QzuvFPdSVUME=",
"owner": "nix-community",
"repo": "home-manager",
-
"rev": "0e0a16b342bcd435ad83c62f4794ce1a4ccff0ea",
+
"rev": "3c3510e61ca5c15a0f13d73c2232fa2d5478a86c",
"type": "github"
},
"original": {
···
},
"nixpkgs-unstable": {
"locked": {
-
"lastModified": 1755268003,
-
"narHash": "sha256-nNaeJjo861wFR0tjHDyCnHs1rbRtrMgxAKMoig9Sj/w=",
+
"lastModified": 1755577059,
+
"narHash": "sha256-5hYhxIpco8xR+IpP3uU56+4+Bw7mf7EMyxS/HqUYHQY=",
"owner": "NixOS",
"repo": "nixpkgs",
-
"rev": "32f313e49e42f715491e1ea7b306a87c16fe0388",
+
"rev": "97eb7ee0da337d385ab015a23e15022c865be75c",
"type": "github"
},
"original": {
···
},
"nixpkgs_3": {
"locked": {
-
"lastModified": 1755186698,
-
"narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=",
+
"lastModified": 1755615617,
+
"narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=",
"owner": "NixOS",
"repo": "nixpkgs",
-
"rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c",
+
"rev": "20075955deac2583bb12f07151c2df830ef346b4",
"type": "github"
},
"original": {
···
},
"nixpkgs_4": {
"locked": {
-
"lastModified": 1755186698,
-
"narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=",
+
"lastModified": 1755615617,
+
"narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=",
"owner": "nixos",
"repo": "nixpkgs",
-
"rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c",
+
"rev": "20075955deac2583bb12f07151c2df830ef346b4",
"type": "github"
},
"original": {
···
"nixpkgs": "nixpkgs_4"
},
"locked": {
-
"lastModified": 1755615368,
-
"narHash": "sha256-99dlSdCjn1J1e0115g59nDbjsbGwihJsicjwWmzz0Bo=",
+
"lastModified": 1755729137,
+
"narHash": "sha256-eON36fTYYgAL1J/31FZfSyJzt+T9TFOn5p6P8ddyyqA=",
"owner": "nix-community",
"repo": "NUR",
-
"rev": "03f3f029e496e5e7456f2870557d5f2e5509022b",
+
"rev": "c6508c49a36f20ea2d28920d1b5d55a48d072a4a",
"type": "github"
},
"original": {
···
"secrets": {
"flake": false,
"locked": {
-
"lastModified": 1755717053,
-
"narHash": "sha256-HzMVkR0wKkr9xF1+LdXO6B4Ke+eZn/B3IEK5479I42k=",
+
"lastModified": 1755789931,
+
"narHash": "sha256-4BJKIbWkdajOZxVJhdDROMVtK6WfFbZjNXBt8KRtE18=",
"owner": "ayla6",
"repo": "secrets",
-
"rev": "411c9eb074999219404f7b0a0584a8a31687f8fc",
+
"rev": "145a93b5fd6db45596d4c7607c0ef91a86aee593",
"type": "github"
},
"original": {
+1
hosts/jezebel/secrets.nix
···
tailscaleAuthKey.file = "${self.inputs.secrets}/tailscale/auth.age";
resticPassword.file = "${self.inputs.secrets}/restic-passwd.age";
rclone.file = "${self.inputs.secrets}/rclone.age";
+
ntfyAuto.file = "${self.inputs.secrets}/ntfyAuto.age";
};
}
+4 -4
hosts/morgana/default.nix
···
location = "/data/.swap";
};
-
autoUpgrade = {
-
enable = true;
-
operation = "switch";
-
};
+
#autoUpgrade = {
+
# enable = true;
+
# operation = "switch";
+
#};
};
desktop.gnome.enable = true;
services = {
+1
hosts/morgana/secrets.nix
···
syncthingCert.file = "${self.inputs.secrets}/ayla/syncthing/morgana/cert.age";
syncthingKey.file = "${self.inputs.secrets}/ayla/syncthing/morgana/key.age";
rclone.file = "${self.inputs.secrets}/rclone.age";
+
ntfyAuto.file = "${self.inputs.secrets}/ntfyAuto.age";
};
}
+1 -3
hosts/nanpi/README.md
···
-
nanpi is my lenovo ideapad 320-14IKB, it has replaced the red hp one for it's got better specs reasons
-
-
it might have a curse that makes it kill all hard drives it touches so maybe i'm gonna get into some trouble
+
the third nanpi incarnation
+6 -5
hosts/nanpi/default.nix
···
./secrets.nix
./services.nix
./glance.nix
+
./notifier.nix
self.nixosModules.locale-en-gb
self.diskoConfigurations.luks-btrfs-subvolumes
];
···
networking.hostName = "nanpi";
system.stateVersion = "25.05";
time.timeZone = "America/Sao_Paulo";
-
myHardware.lenovo.ideapad."320-14IKB".enable = true;
+
myHardware.acer.aspire."A315-53".enable = true;
myNixOS = {
programs = {
···
profiles = {
base.enable = true;
server.enable = true;
-
autoUpgrade = {
-
enable = true;
-
operation = "boot";
-
};
+
#autoUpgrade = {
+
# enable = true;
+
# operation = "boot";
+
#};
backups.enable = true;
btrfs = {
enable = true;
+6
hosts/nanpi/glance.nix
···
check-url = "http://${config.mySnippets.tailnet.networkMap.redlib.hostName}:${toString config.mySnippets.tailnet.networkMap.redlib.port}/";
icon = "di:redlib";
}
+
{
+
title = "Miniflux";
+
url = "https://${config.mySnippets.tailnet.networkMap.miniflux.vHost}/";
+
check-url = "http://${config.mySnippets.tailnet.networkMap.miniflux.hostName}:${toString config.mySnippets.tailnet.networkMap.miniflux.port}/";
+
icon = "di:miniflux";
+
}
];
}
];
+28
hosts/nanpi/notifier.nix
···
+
{
+
pkgs,
+
config,
+
...
+
}: let
+
notifyOnUnplugScript = ''
+
#!${pkgs.bash}/bin/bash
+
LOGIN=$(cat "${config.age.secrets.ntfyAuto.path}")
+
+
${pkgs.curl}/bin/curl -u $LOGIN \
+
-H "X-Priority: 5" \
+
-d "ME YOUR CHILD ${config.networking.hostName} WAS UNPLUGGED FROM THE CHARGER HELP ME" \
+
https://${config.mySnippets.aylac-top.networkMap.ntfy.vHost}/network-status
+
'';
+
in {
+
systemd.services.notify-on-unplug = {
+
description = "Sends a notification when the computer is unplugged from the charger.";
+
after = ["network.target"];
+
serviceConfig = {
+
Type = "oneshot";
+
ExecStart = pkgs.writeShellScript "notify-on-unplug" notifyOnUnplugScript;
+
};
+
};
+
+
services.udev.extraRules = ''
+
SUBSYSTEM=="power_supply", ATTR{online}=="0", TAG+="systemd", ENV{SYSTEMD_WANTS}="notify-on-unplug.service"
+
'';
+
}
+2
hosts/nanpi/secrets.nix
···
mode = "0400";
};
autobrr.file = "${self.inputs.secrets}/autobrr.age";
+
ntfyAuto.file = "${self.inputs.secrets}/ntfyAuto.age";
+
miniflux.file = "${self.inputs.secrets}/miniflux.age";
};
}
+21
hosts/nanpi/services.nix
···
reverse_proxy ${config.mySnippets.tailnet.networkMap.redlib.hostName}:${toString config.mySnippets.tailnet.networkMap.redlib.port}
'';
};
+
+
"${config.mySnippets.tailnet.networkMap.miniflux.vHost}" = {
+
extraConfig = ''
+
bind tailscale/miniflux
+
encode zstd gzip
+
reverse_proxy ${config.mySnippets.tailnet.networkMap.miniflux.hostName}:${toString config.mySnippets.tailnet.networkMap.miniflux.port}
+
'';
+
};
};
# it's failing to build because it can't download some stuff
···
ENABLE_RSS = "on";
REDLIB_DEFAULT_SHOW_NSFW = "on";
REDLIB_DEFAULT_USE_HLS = "on";
+
FULL_URL = "https://${config.mySnippets.tailnet.networkMap.redlib.vHost}";
};
};
···
PORT = "7020";
};
environmentFile = config.age.secrets.gemini.path;
+
};
+
+
miniflux = {
+
enable = true;
+
adminCredentialsFile = config.age.secrets.miniflux.path;
+
config = {
+
BATCH_SIZE = 100;
+
CLEANUP_FREQUENCY_HOURS = 48;
+
LISTEN_ADDR = "${config.mySnippets.tailnet.networkMap.miniflux.hostName}:${toString config.mySnippets.tailnet.networkMap.miniflux.port}";
+
BASE_URL = "https://${config.mySnippets.tailnet.networkMap.miniflux.vHost}";
+
WEBAUTHN = "enabled";
+
};
};
ntfy-sh = {
+22
modules/hardware/acer/aspire/A315-53/default.nix
···
+
{
+
config,
+
lib,
+
...
+
}: {
+
options.myHardware.acer.aspire."A315-53".enable =
+
lib.mkEnableOption "Configuration for the Acer Aspire A315-53.";
+
+
config = lib.mkIf config.myHardware.acer.aspire."A315-53".enable {
+
myHardware = {
+
intel = {
+
cpu.enable = true;
+
gpu.enable = true;
+
};
+
+
profiles = {
+
base.enable = true;
+
laptop.enable = true;
+
};
+
};
+
};
+
}
+1
modules/hardware/acer/aspire/default.nix
···
{...}: {
imports = [
./A515-52G
+
./A315-53
];
}
+61 -2
modules/nixos/profiles/backups/default.nix
···
pkgs,
...
}: let
+
# idk how to share this across files :(
+
mkNotify = {
+
message,
+
channel,
+
priority ? 1,
+
}: ''
+
LOGIN=$(cat "${config.age.secrets.ntfyAuto.path}")
+
${pkgs.curl}/bin/curl -u $LOGIN \
+
-H "X-Priority: ${toString priority}" \
+
-d '${message}' \
+
https://${config.mySnippets.aylac-top.networkMap.ntfy.vHost}/${channel}
+
'';
+
backupDestinationA = "rclone:a_gdrive:/backups/${config.networking.hostName}";
mkRepoA = service: "${backupDestinationA}/${service}";
#backupDestinationB = "rclone:b_gdrive:/backups/${config.networking.hostName}";
#mkRepoB = service: "${backupDestinationB}/${service}";
-
stop = service: "${pkgs.systemd}/bin/systemctl stop ${service}";
-
start = service: "${pkgs.systemd}/bin/systemctl start ${service}";
+
+
stop = service: ''
+
#!${pkgs.bash}/bin/bash
+
${mkNotify {
+
message = "Backing up ${service}, stopping service";
+
channel = "network-status";
+
}}
+
${pkgs.systemd}/bin/systemctl stop ${service}
+
'';
+
+
start = service: ''
+
#!${pkgs.bash}/bin/bash
+
${mkNotify {
+
message = "Back up for ${service} was completed (idk if successfully tho), starting service";
+
channel = "network-status";
+
}}
+
${pkgs.systemd}/bin/systemctl start ${service}
+
'';
+
+
prepareNoService = service: ''
+
#!${pkgs.bash}/bin/bash
+
${mkNotify {
+
message = "Backing up ${service}";
+
channel = "network-status";
+
}}
+
'';
+
+
cleanupNoService = service: ''
+
#!${pkgs.bash}/bin/bash
+
${mkNotify {
+
message = "Back up for ${service} was completed (idk if successfully tho)";
+
channel = "network-status";
+
}}
+
'';
in {
options.myNixOS.profiles.backups = {
enable = lib.mkEnableOption "automatically back up enabled services to gdrive";
···
passwords = lib.mkIf (builtins.elem config.networking.hostName config.mySnippets.syncthing.folders."Passwords".devices) (
config.mySnippets.restic
// {
+
backupCleanupCommand = cleanupNoService "passwords";
+
backupPrepareCommand = prepareNoService "passwords";
paths = [config.mySnippets.syncthing.folders."Passwords".path];
repository = mkRepoA "passwords";
}
···
webdav = lib.mkIf config.services.webdav-server-rs.enable (
config.mySnippets.restic
// {
+
backupCleanupCommand = cleanupNoService "webdav";
+
backupPrepareCommand = prepareNoService "webdav";
paths = ["/var/lib/webdav"];
repository = mkRepoA "webdav";
+
}
+
);
+
+
miniflux = lib.mkIf config.services.miniflux.enable (
+
config.mySnippets.restic
+
// {
+
backupCleanupCommand = start "miniflux";
+
backupPrepareCommand = stop "miniflux";
+
paths = ["/var/lib/miniflux"];
+
repository = mkRepoA "miniflux";
}
);
};
+1
modules/nixos/services/default.nix
···
./qbittorrent
./syncthing
./tailscale
+
./monitoring
];
}
+69 -1
modules/nixos/services/fail2ban/default.nix
···
{
config,
lib,
+
pkgs,
...
-
}: {
+
}: let
+
# idk how to share this across files :(
+
mkNotify = {
+
message,
+
channel,
+
priority ? 1,
+
}: ''
+
LOGIN=$(cat "${config.age.secrets.ntfyAuto.path}")
+
${pkgs.curl}/bin/curl -u $LOGIN \
+
-H "X-Priority: ${toString priority}" \
+
-d '${message}' \
+
https://${config.mySnippets.aylac-top.networkMap.ntfy.vHost}/${channel}
+
'';
+
in {
options.myNixOS.services.fail2ban.enable = lib.mkEnableOption "fail2ban";
config = lib.mkIf config.myNixOS.services.fail2ban.enable {
environment.etc = {
+
"fail2ban/action.d/ntfy.conf".text = ''
+
[Definition]
+
actionbanned = ${mkNotify {
+
message = "Banned <ip> from <jail> at ${config.networking.hostName}";
+
channel = "network-status";
+
priority = 3;
+
}}
+
'';
+
"fail2ban/filter.d/forgejo.conf".text = ''
[Definition]
failregex = .*(Failed authentication attempt|invalid credentials|Attempted access of unknown user).* from <HOST>
···
ignoreIP = ["100.64.0.0/10"];
bantime = "24h";
bantime-increment.enable = true;
+
jails = {
+
forgejo.settings = {
+
action = "iptables-allports";
+
bantime = 900;
+
filter = "forgejo";
+
findtime = 3600;
+
maxretry = 4;
+
};
+
+
# HTTP basic-auth failures, 5 tries → 1-day ban
+
nginx-http-auth = {
+
settings = {
+
enabled = true;
+
maxretry = 5;
+
findtime = 300;
+
bantime = "24h";
+
};
+
};
+
+
# Generic scanner / bot patterns (wp-login.php, sqladmin, etc.)
+
nginx-botsearch = {
+
settings = {
+
enabled = true;
+
maxretry = 10;
+
findtime = 300;
+
bantime = "24h";
+
};
+
};
+
+
vaultwarden = ''
+
enabled = true
+
filter = vaultwarden
+
port = 80,443,${toString config.services.vaultwarden.config.ROCKET_PORT}
+
maxretry = 5
+
'';
+
+
vaultwarden-admin = ''
+
enabled = true
+
port = 80,443,${toString config.services.vaultwarden.config.ROCKET_PORT}
+
filter = vaultwarden-admin
+
maxretry = 3
+
bantime = 14400
+
findtime = 14400
+
'';
+
};
};
};
}
+43
modules/nixos/services/monitoring/default.nix
···
+
{
+
config,
+
pkgs,
+
...
+
}: let
+
# idk how to share this across files :(
+
mkNotify = {
+
message,
+
channel,
+
priority ? 1,
+
}: ''
+
LOGIN=$(cat "${config.age.secrets.ntfyAuto.path}")
+
${pkgs.curl}/bin/curl -u $LOGIN \
+
-H "X-Priority: ${toString priority}" \
+
-d '${message}' \
+
https://${config.mySnippets.aylac-top.networkMap.ntfy.vHost}/${channel}
+
'';
+
in {
+
systemd.services.disk-space-check = {
+
description = "Check for low disk space";
+
script = ''
+
#!${pkgs.bash}/bin/bash
+
THRESHOLD=80
+
USAGE=$(df --output=pcent / | tail -n 1 | tr -d ' %')
+
if [ "$USAGE" -gt "$THRESHOLD" ]; then
+
${mkNotify {
+
message = "CRITICAL: Disk space on / is at $USAGE% on ${config.networking.hostName}";
+
channel = "network-status";
+
priority = 5;
+
}}
+
fi
+
'';
+
};
+
+
systemd.timers.disk-space-check = {
+
description = "Run disk space check every hour";
+
wantedBy = ["timers.target"];
+
timerConfig = {
+
OnCalendar = "hourly";
+
Persistent = true;
+
};
+
};
+
}
+1 -1
modules/snippets/restic/default.nix
···
#OnCalendar = "*-*-* 02,14:00:00";
#OnCalendar = "*-*-* 03:14:00";
Persistent = true;
-
RandomizedDelaySec = "600";
+
RandomizedDelaySec = "10";
};
};
};
+6
modules/snippets/tailnet/default.nix
···
port = 6605;
vHost = "redlib.${config.mySnippets.tailnet.name}";
};
+
+
miniflux = {
+
hostName = "nanpi";
+
port = 6540;
+
vHost = "miniflux.${config.mySnippets.tailnet.name}";
+
};
};
};
};