finally fixing the ups, plus tons of formatting

This commit is contained in:
mjallen18
2024-08-23 12:00:51 -05:00
parent a8dfd2b7da
commit cd809e4156
59 changed files with 321 additions and 641 deletions

View File

@@ -1,17 +1,10 @@
{
inputs,
outputs,
config,
lib,
pkgs,
...
}:
{ config, ... }:
{
nas-apps = {
beszel.enable = true;
beszel-agent.enable = true;
collabora = {
enable = true;
environmentFiles = [ config.sops.secrets."jallen-nas/collabora".path ];
@@ -27,10 +20,10 @@
mariadb = {
enable = true;
environmentFiles = [
environmentFiles = [
config.sops.secrets."jallen-nas/mariadb/db_pass".path
config.sops.secrets."jallen-nas/mariadb/root_pass".path
];
];
};
mealie = {

View File

@@ -1,11 +1,4 @@
{
inputs,
outputs,
config,
lib,
pkgs,
...
}:
{ pkgs, ... }:
let
configLimit = 5;
kernel = pkgs.linuxPackages_latest;

View File

@@ -3,10 +3,8 @@
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{
inputs,
outputs,
config,
lib,
pkgs,
...
}:
@@ -62,10 +60,6 @@ in
# Configure environment
environment = {
# etc."nut/upsd.conf".source = /home/matt/upsd.conf;
# etc."nut/upsd.users".source = /home/matt/upsd.users;
# etc."nut/upsmon.conf".source = /home/matt/upsmon.conf;
etc.crypttab.text = ''
ssd1 UUID=eff4b19c-aba7-41ab-b452-a8c6654d8754 none tpm2-device=auto
ssd2 UUID=c8640e19-6cd9-49d0-a355-bac09d17ea0d none tpm2-device=auto
@@ -79,7 +73,7 @@ in
# List packages installed in system profile. To search, run:
# $ nix search wget
sessionVariables = rec {
sessionVariables = {
CACHIX_AGENT_TOKEN = "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJlY2RjYjJiNi05YWQ4LTRiYmMtYWEwYS1mNGU5Yzk1ODM2OTMiLCJzY29wZXMiOiJhZ2VudCJ9.8SENqsNZ-UIFV4atm-cZnMT6LR08Iz_raAZi5QVsppo";
};

View File

@@ -1,159 +1,102 @@
{
inputs,
config,
lib,
outputs,
pkgs,
...
}:
{ ... }:
let
defaultOptions = [
"compress=zstd"
];
defaultOptions = [ "compress=zstd" ];
in
{
fileSystems."/media/nas/ssd/nix-app-data" = {
device = "/dev/disk/by-uuid/09ac8b6b-e553-4cd8-ae62-8d8c17fe8b0c";
fsType = "btrfs";
options = [
"subvol=nix-app-data"
]
++ defaultOptions;
options = [ "subvol=nix-app-data" ] ++ defaultOptions;
};
fileSystems."/media/nas/ssd/ssd_app_data" = {
device = "/dev/disk/by-uuid/09ac8b6b-e553-4cd8-ae62-8d8c17fe8b0c";
fsType = "btrfs";
options = [
"subvol=ssd_app_data"
]
++ defaultOptions;
options = [ "subvol=ssd_app_data" ] ++ defaultOptions;
};
fileSystems."/media/nas/ssd/mariadb" = {
device = "/dev/disk/by-uuid/09ac8b6b-e553-4cd8-ae62-8d8c17fe8b0c";
fsType = "btrfs";
options = [
"subvol=mariadb"
]
++ defaultOptions;
options = [ "subvol=mariadb" ] ++ defaultOptions;
};
fileSystems."/media/nas/ssd/VMs" = {
device = "/dev/disk/by-uuid/09ac8b6b-e553-4cd8-ae62-8d8c17fe8b0c";
fsType = "btrfs";
options = [
"subvol=VMs"
]
++ defaultOptions;
options = [ "subvol=VMs" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/3d_printer" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=3d_printer"
]
++ defaultOptions;
options = [ "subvol=3d_printer" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/backup" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=backup"
]
++ defaultOptions;
options = [ "subvol=backup" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/books" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=books"
]
++ defaultOptions;
options = [ "subvol=books" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/documents" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=documents"
]
++ defaultOptions;
options = [ "subvol=documents" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/homeassistant" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=homeassistant"
]
++ defaultOptions;
options = [ "subvol=homeassistant" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/isos" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=isos"
]
++ defaultOptions;
options = [ "subvol=isos" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/movies" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=movies"
]
++ defaultOptions;
options = [ "subvol=movies" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/nextcloud" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=nextcloud"
]
++ defaultOptions;
options = [ "subvol=nextcloud" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/photos" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=photos"
]
++ defaultOptions;
options = [ "subvol=photos" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/switch" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=switch"
]
++ defaultOptions;
options = [ "subvol=switch" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/tv" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=tv"
]
++ defaultOptions;
options = [ "subvol=tv" ] ++ defaultOptions;
};
fileSystems."/media/nas/main/timemachine" = {
device = "/dev/disk/by-uuid/76e7cd98-3145-4cff-b78d-bab0206aae28";
fsType = "btrfs";
options = [
"subvol=timemachine"
]
++ defaultOptions;
options = [ "subvol=timemachine" ] ++ defaultOptions;
};
# fileSystems."/media/nas/junk/nextcloud-backup" = {

View File

@@ -4,7 +4,6 @@
{
config,
lib,
pkgs,
modulesPath,
...
}:
@@ -88,15 +87,15 @@
];
};
swapDevices = [
{
device = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_500GB_S3Z1NW0KA10457X-part2";
swapDevices = [
{
device = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_500GB_S3Z1NW0KA10457X-part2";
randomEncryption.enable = true;
}
{
device = "/dev/disk/by-id/ata-SSD2SC240G1SA754D117-820_PNY29140000558890457";
{
device = "/dev/disk/by-id/ata-SSD2SC240G1SA754D117-820_PNY29140000558890457";
randomEncryption.enable = true;
}
}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking

View File

@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ ... }:
{
home.username = "admin";
@@ -46,33 +46,4 @@
};
programs.command-not-found.enable = true;
home.packages = with pkgs; [
# homepage-dashboard
];
# # Configure homepage-dashboard
# home.file.".homepage-dashboard/config.json".text = ''
# {
# "modules": [
# {
# "type": "greeting",
# "config": {
# "greetings": [
# "Welcome to My Dashboard!"
# ]
# }
# },
# {
# "type": "clock"
# },
# {
# "type": "weather",
# "config": {
# "location": "St. Paul, MN"
# }
# }
# ]
# }
# '';
}

View File

@@ -1,12 +1,4 @@
{
pkgs,
lib,
LT,
config,
utils,
inputs,
...
}@args:
{ ... }@args:
{
# Set up impernance configuration for things like bluetooth
# In this configuration with /etc and /var/log being persistent, only directories outside of that need to be done here. See hardware configuration for all mountpoints.

View File

@@ -1,11 +1,4 @@
{
inputs,
outputs,
config,
lib,
pkgs,
...
}:
{ config, ... }:
let
hostname = "jallen-nas";
ipAddress = "10.0.1.18";
@@ -65,7 +58,7 @@ in
enable = true;
environmentFile = config.sops.secrets."wifi".path;
networks = {
"Joey's Jungle 5G" = {
"Joey's Jungle 5G" = {
psk = "@PSK@";
};
};

View File

@@ -1,11 +1,4 @@
{
inputs,
outputs,
config,
lib,
pkgs,
...
}:
{ ... }:
{
nas-samba = {
enable = true;

View File

@@ -1,11 +1,4 @@
{
inputs,
outputs,
config,
lib,
pkgs,
...
}:
{ config, pkgs, ... }:
let
enableDisplayManager = false;
hostname = "jallen-nas";
@@ -195,7 +188,10 @@ in
description = "Protonmail Bridge";
enable = true;
script = "${pkgs.protonmail-bridge}/bin/protonmail-bridge --noninteractive";
path = [ pkgs.pass pkgs.protonmail-bridge ];
path = [
pkgs.pass
pkgs.protonmail-bridge
];
wantedBy = [ "multi-user.target" ];
partOf = [ "multi-user.target" ];
};
@@ -204,7 +200,10 @@ in
systemd.services = {
rsync-ssd = {
path = [ pkgs.bash pkgs.rsync ];
path = [
pkgs.bash
pkgs.rsync
];
script = ''
rsync -rtpogvPlHzs --ignore-existing /media/nas/ssd /media/nas/main/backup/ssd
'';

View File

@@ -1,14 +1,16 @@
{
config, ...
}:
{ config, ... }:
{
sops.defaultSopsFile = ../../secrets/secrets.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.secrets."jallen-nas/admin_password" = {};
sops.secrets."jallen-nas/admin_password" = { };
sops.secrets."jallen-nas/admin_password".neededForUsers = true;
sops.secrets."wifi" = {};
sops.secrets."wifi" = { };
sops.secrets."jallen-nas/ups_password" = {
# restartUnits = [ "ups stuff lol" ];
};
sops.secrets."jallen-nas/collabora" = {
restartUnits = [ "podman-collabora.service" ];
@@ -60,4 +62,4 @@
sops.secrets."jallen-nas/nextcloud/smtppassword".mode = "0777";
# sops.secrets."jallen-nas/nextcloud/smtppassword".owner = config.users.users.nix-apps.name;
# sops.secrets."jallen-nas/nextcloud/smtppassword".group = config.users.users.jallen-nas.group;
}
}

View File

@@ -1,59 +1,46 @@
{
inputs,
outputs,
config,
lib,
pkgs,
...
}:
{ config, ... }:
let
enableUps = true;
upsmonCmd = "nasups@localhost 1 upsuser BogieDudie1 primary";
upsName = "nasups";
upsName = "nas-ups";
upsUser = "nas-admin";
in
{
power.ups = {
enable = enableUps;
openFirewall = enableUps;
mode = "netserver";
ups = {
enable = enableUps;
mode = "netserver";
ups.upsName = {
"${upsName}" = {
description = "NAS UPS";
driver = "usbhid-ups";
port = "auto";
description = "NAS UPS";
};
upsmon = {
monitor = upsmonCmd;
};
upsd = {
enable = enableUps;
listen = {
address = 0.0 0.0 0.0;
port = 3493;
};
};
# users = {
# actions = [ "SET" ];
# instcmds = [ "ALL" ];
##* upsmon = "primary";
# passwordFile = "/home/matt/ups.conf";
# };
};
# Add UPS monitoring service
users."${upsUser}" = {
passwordFile = config.sops.secrets."jallen-nas/ups_password".path;
actions = [ "ALL" ];
instcmds = [ "ALL" ];
upsmon = "primary";
};
upsmon = {
enable = true;
# Configure UPS device
device = "/dev/usb/hiddev1"; # Change this to your UPS device
driver = "usbhid-ups"; # Change this if your UPS uses a different driver
# Set UPS monitoring options
options = {
# NOTIFYCMD = "/path/to/notify-script.sh"; # Path to your notification script
POLLFREQ = 5;
POLLFREQALERT = 5;
HOSTSYNC = "on";
DEADTIME = 15;
FINALDELAY = 5;
enable = enableUps;
monitor."${upsName}" = {
passwordFile = config.sops.secrets."jallen-nas/ups_password".path;
user = upsUser;
};
};
upsd = {
enable = enableUps;
listen = [
{
address = "0.0.0.0";
port = 3493;
}
];
};
};
}