formatting

This commit is contained in:
mjallen18
2024-05-31 16:11:42 -05:00
parent 4aead74c7f
commit 29ec754b2f
82 changed files with 1521 additions and 974 deletions

View File

@@ -2,18 +2,31 @@
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ inputs, outputs, config, lib, pkgs, ... }:
{
inputs,
outputs,
config,
lib,
pkgs,
...
}:
let
user = "admin";
password =
"$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06";
hostname = "jallen-nas";
allowedPorts = [ 2342 3493 61208 9090 ];
allowedPorts = [
2342
3493
61208
9090
];
enableDisplayManager = false;
# adding a flag cause nixos cant figure itself out and broke shit that cant be fixed
enableUps = true;
in {
imports = [ # Include the results of the hardware scan.
in
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
../default.nix
];
@@ -60,10 +73,10 @@ in {
httpsPort = "9443";
};
# ollama.enable = true;
# ollama.enable = true;
open-webui.enable = true;
# open-webui.port = "3000";
# open-webui.port = "3000";
orca-slicer.enable = true;
@@ -138,7 +151,10 @@ in {
# Override kernel to latest
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
kernelParams = [ "nohibernate" "amd_pstate=active" ];
kernelParams = [
"nohibernate"
"amd_pstate=active"
];
consoleLogLevel = 3;
bootspec.enable = true;
@@ -186,7 +202,8 @@ in {
userServices = true;
workstation = true;
};
extraServiceFiles = { # TODO is this needed?
extraServiceFiles = {
# TODO is this needed?
smb = ''
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
@@ -204,7 +221,7 @@ in {
apcupsd = {
enable = true;
};
grafana = {
enable = true;
settings.server = {
@@ -222,7 +239,10 @@ in {
exporters = {
node = {
enable = true;
enabledCollectors = [ "diskstats" "systemd" ];
enabledCollectors = [
"diskstats"
"systemd"
];
port = 9002;
};
smartctl = {
@@ -244,23 +264,28 @@ in {
};
};
scrapeConfigs = [{
job_name = hostname;
static_configs = [{
targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
"127.0.0.1:${
toString config.services.prometheus.exporters.smartctl.port
}"
scrapeConfigs = [
{
job_name = hostname;
static_configs = [
{
targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
"127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}"
];
}
];
}];
}];
}
];
};
};
systemd.services = {
nas-mounts = {
path = [ pkgs.zfs pkgs.bash ];
path = [
pkgs.zfs
pkgs.bash
];
script = ''
if test -d /mnt/ssd/ssd_app_data; then
echo "NAS ZFS Pools Mounted."
@@ -277,7 +302,10 @@ in {
};
glances-server = {
path = [ pkgs.bash pkgs.glances ];
path = [
pkgs.bash
pkgs.glances
];
script = ''
#!/user/bin/env bash
glances -w
@@ -298,8 +326,7 @@ in {
firewall = {
enable = true;
allowPing = true;
extraCommands =
"iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns"; # TODO is this needed?
extraCommands = "iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns"; # TODO is this needed?
allowedTCPPorts = allowedPorts;
allowedUDPPorts = allowedPorts;
};
@@ -307,9 +334,9 @@ in {
# Configure environment
environment = {
# etc."nut/upsd.conf".source = ./upsd.conf;
# etc."nut/upsd.users".source = ./upsd.users;
# etc."nut/upsmon.conf".source = ./upsmon.conf;
# etc."nut/upsd.conf".source = ./upsd.conf;
# etc."nut/upsd.users".source = ./upsd.users;
# etc."nut/upsmon.conf".source = ./upsmon.conf;
# List packages installed in system profile. To search, run:
# $ nix search wget
@@ -355,7 +382,7 @@ in {
virt-manager.enable = true;
nix-ld.enable = true;
};
power.ups.ups = {
enable = enableUps;
mode = "netserver";
@@ -370,7 +397,7 @@ in {
upsd = {
enable = true;
listen = {
address = 0.0.0.0;
address = 0.0 0.0 0.0;
port = 3493;
};
};
@@ -383,27 +410,25 @@ in {
};
# Add UPS monitoring service
# power.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;
# };
# };
# power.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;
# };
# };
# Configure nixpkgs
nixpkgs = {
overlays = [
outputs.overlays.nixpkgs-unstable
];
overlays = [ outputs.overlays.nixpkgs-unstable ];
config = {
# Enable non free
@@ -462,11 +487,11 @@ in {
isSystemUser = true;
uid = 911;
group = "jallen-nas";
extraGroups = [
extraGroups = [
"jallen-nas"
"docker"
"podman"
]; # Enable sudo for the user.
]; # Enable sudo for the user.
hashedPassword = password;
};
@@ -508,5 +533,4 @@ in {
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}