Run updated nixfmt formatter
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
# Module: base/base
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.base;
|
||||
in {
|
||||
let
|
||||
cfg = config.base;
|
||||
in
|
||||
{
|
||||
options.base = {
|
||||
userSSHKeys = mkOption {
|
||||
type = types.listOf types.str;
|
||||
@@ -23,7 +30,12 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
imports = [ ./grafana-alloy.nix ./network.nix ./qemu.nix ./spice.nix ];
|
||||
imports = [
|
||||
./grafana-alloy.nix
|
||||
./network.nix
|
||||
./qemu.nix
|
||||
./spice.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
networking.hostName = cfg.hostName;
|
||||
@@ -36,7 +48,9 @@ in {
|
||||
useXkbConfig = true;
|
||||
};
|
||||
|
||||
environment.variables = { PAGER = "nvimpager"; };
|
||||
environment.variables = {
|
||||
PAGER = "nvimpager";
|
||||
};
|
||||
|
||||
# Maintenance
|
||||
nix.gc = {
|
||||
|
@@ -1,5 +1,11 @@
|
||||
# Module: base/grafana-alloy
|
||||
{ config, lib, pkgs, options, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [ grafana-alloy ];
|
||||
|
@@ -1,12 +1,21 @@
|
||||
# Module: base/network
|
||||
{ config, lib, pkgs, options, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.network;
|
||||
|
||||
routingTypes = [ "static" "dynamic" ];
|
||||
routingTypes = [
|
||||
"static"
|
||||
"dynamic"
|
||||
];
|
||||
|
||||
# ----- Static config options -----
|
||||
defaultStaticRoutes = [
|
||||
@@ -25,7 +34,8 @@ let
|
||||
];
|
||||
|
||||
defaultTimeServers = [ "time.cloudflare.com" ];
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.network = {
|
||||
routingType = mkOption {
|
||||
type = types.enum routingTypes;
|
||||
@@ -52,7 +62,9 @@ in {
|
||||
type = types.listOf types.attrs;
|
||||
default = defaultStaticRoutes;
|
||||
description = "System DNS servers";
|
||||
example = { Gateway = "fe80::1"; };
|
||||
example = {
|
||||
Gateway = "fe80::1";
|
||||
};
|
||||
};
|
||||
|
||||
dnsServers = mkOption {
|
||||
@@ -89,30 +101,42 @@ in {
|
||||
networking.useNetworkd = true;
|
||||
networking.usePredictableInterfaceNames = false;
|
||||
|
||||
environment.systemPackages = with pkgs; [ chrony tailscale ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
chrony
|
||||
tailscale
|
||||
];
|
||||
|
||||
systemd.network = {
|
||||
enable = true;
|
||||
|
||||
links.eth0 = {
|
||||
matchConfig = { MACAddress = cfg.hardwareAddress; };
|
||||
linkConfig = { Name = "eth0"; };
|
||||
matchConfig = {
|
||||
MACAddress = cfg.hardwareAddress;
|
||||
};
|
||||
linkConfig = {
|
||||
Name = "eth0";
|
||||
};
|
||||
};
|
||||
|
||||
networks."05-eth" = if config.network.routingType == "static" then {
|
||||
matchConfig.Name = "eth0";
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
address = cfg.staticAddresses;
|
||||
routes = cfg.staticRoutes;
|
||||
} else if config.network.routingType == "dynamic" then {
|
||||
matchConfig.Name = "eth0";
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
networkConfig = {
|
||||
DHCP = "yes";
|
||||
IPv6AcceptRA = true;
|
||||
};
|
||||
} else
|
||||
{ };
|
||||
networks."05-eth" =
|
||||
if config.network.routingType == "static" then
|
||||
{
|
||||
matchConfig.Name = "eth0";
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
address = cfg.staticAddresses;
|
||||
routes = cfg.staticRoutes;
|
||||
}
|
||||
else if config.network.routingType == "dynamic" then
|
||||
{
|
||||
matchConfig.Name = "eth0";
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
networkConfig = {
|
||||
DHCP = "yes";
|
||||
IPv6AcceptRA = true;
|
||||
};
|
||||
}
|
||||
else
|
||||
{ };
|
||||
};
|
||||
|
||||
services.tailscale.enable = true;
|
||||
|
@@ -1,10 +1,19 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.qemu;
|
||||
in {
|
||||
options.qemu = { enable = mkEnableOption "Enable QEMU guest setup"; };
|
||||
let
|
||||
cfg = config.qemu;
|
||||
in
|
||||
{
|
||||
options.qemu = {
|
||||
enable = mkEnableOption "Enable QEMU guest setup";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ qemu ];
|
||||
|
@@ -1,10 +1,19 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.spice;
|
||||
in {
|
||||
options.spice = { enable = mkEnableOption "Enable SPICE guest setup"; };
|
||||
let
|
||||
cfg = config.spice;
|
||||
in
|
||||
{
|
||||
options.spice = {
|
||||
enable = mkEnableOption "Enable SPICE guest setup";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ spice ];
|
||||
|
@@ -1,4 +1,9 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
base.hostName = "db-pg17";
|
||||
|
@@ -1,8 +1,17 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
base.hostName = "hel-01";
|
||||
network.routingType = "static";
|
||||
network.hardwareAddress = "96:00:04:60:9d:9c";
|
||||
network.staticAddresses = [ "65.108.93.48/32" "2a01:4f9:c010:ba5e::1/64" ];
|
||||
network.staticAddresses = [
|
||||
"65.108.93.48/32"
|
||||
"2a01:4f9:c010:ba5e::1/64"
|
||||
];
|
||||
qemu.enable = true;
|
||||
spice.enable = true;
|
||||
|
||||
|
@@ -1,8 +1,17 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
base.hostName = "nbg-01";
|
||||
network.routingType = "static";
|
||||
network.hardwareAddress = "96:00:04:60:6e:04";
|
||||
network.staticAddresses = [ "91.99.166.211/32" "2a01:4f8:1c1a:d167::1/64" ];
|
||||
network.staticAddresses = [
|
||||
"91.99.166.211/32"
|
||||
"2a01:4f8:1c1a:d167::1/64"
|
||||
];
|
||||
qemu.enable = true;
|
||||
spice.enable = true;
|
||||
|
||||
|
@@ -1,4 +1,10 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
base.hostName = "print-01";
|
||||
network.routingType = "dynamic";
|
||||
network.hardwareAddress = "bc:24:11:0f:1b:a3";
|
||||
|
@@ -1,4 +1,10 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
base.hostName = "test-nixos";
|
||||
network.routingType = "dynamic";
|
||||
network.hardwareAddress = "bc:24:11:1b:47:af";
|
||||
|
@@ -1,6 +1,11 @@
|
||||
# Module: roles/dbserver-mariadb
|
||||
# Enables a database server running MariaDB
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
@@ -8,7 +13,8 @@ let
|
||||
cfg = config.dbserver-mariadb;
|
||||
defaultDBPackage = pkgs.mariadb;
|
||||
defaultPyMySQLPackage = pkgs.python313Packages.pymysql;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.dbserver-mariadb = {
|
||||
enable = mkEnableOption "Enables dbserver-mariadb role";
|
||||
|
||||
|
@@ -1,6 +1,11 @@
|
||||
# Module: roles/dbserver-postgresql
|
||||
# Enables a database server running PostgreSQL
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
@@ -8,7 +13,8 @@ let
|
||||
cfg = config.dbserver-postgresql;
|
||||
defaultPostgresPackage = pkgs.postgresql;
|
||||
defaultPsycopg2Package = pkgs.python313Packages.psycopg2;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.dbserver-postgresql = {
|
||||
enable = mkEnableOption "Enables dbserver-postgresql role";
|
||||
|
||||
|
@@ -1,15 +1,27 @@
|
||||
# Module: roles/logserver
|
||||
# Enables the usage of a logserver with traefik, loki, and prometheus
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.logserver;
|
||||
in {
|
||||
options.logserver = { enable = mkEnableOption "Enables logserver role"; };
|
||||
let
|
||||
cfg = config.logserver;
|
||||
in
|
||||
{
|
||||
options.logserver = {
|
||||
enable = mkEnableOption "Enables logserver role";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ loki prometheus ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
loki
|
||||
prometheus
|
||||
];
|
||||
|
||||
# Config is generated using Ansible
|
||||
services.loki = {
|
||||
|
@@ -1,11 +1,18 @@
|
||||
# Module: roles/mailserver
|
||||
# Enables a mail server using Stalwart
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.mailserver;
|
||||
in {
|
||||
let
|
||||
cfg = config.mailserver;
|
||||
in
|
||||
{
|
||||
#imports = [ ../apps/stalwart.nix ];
|
||||
|
||||
options.mailserver = {
|
||||
|
@@ -1,11 +1,18 @@
|
||||
# Module: roles/monitorserver
|
||||
# Enables server monitoring using HealthChecks and Uptime Kuma
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.monitorserver;
|
||||
in {
|
||||
let
|
||||
cfg = config.monitorserver;
|
||||
in
|
||||
{
|
||||
#imports = [ ../services/healthchecks.nix ../services/uptime-kuma.nix ];
|
||||
|
||||
options.monitorserver = {
|
||||
|
@@ -1,11 +1,18 @@
|
||||
# Module: roles/printserver
|
||||
# Enables a CUPS print server for sharing connected printers on the network
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.printserver;
|
||||
in {
|
||||
let
|
||||
cfg = config.printserver;
|
||||
in
|
||||
{
|
||||
options.printserver = {
|
||||
enable = mkEnableOption "Enables printserver role";
|
||||
|
||||
@@ -25,7 +32,10 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ cups gutenprint ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
cups
|
||||
gutenprint
|
||||
];
|
||||
|
||||
services.avahi = {
|
||||
enable = true;
|
||||
|
@@ -1,6 +1,12 @@
|
||||
# roles/roles.nix
|
||||
# Entrypoint for all roles files
|
||||
{ lib, pkgs, options, ... }: {
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./dbserver-mariadb.nix
|
||||
./dbserver-postgresql.nix
|
||||
|
@@ -1,11 +1,18 @@
|
||||
# Module: roles/syncthingserver
|
||||
# Enables a syncthing server
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.syncthingserver;
|
||||
in {
|
||||
let
|
||||
cfg = config.syncthingserver;
|
||||
in
|
||||
{
|
||||
options.syncthingserver = {
|
||||
enable = mkEnableOption "Enables syncthingserver role";
|
||||
};
|
||||
|
@@ -1,12 +1,21 @@
|
||||
# Module: roles/webserver
|
||||
# Enables the usage of a webserver with traefik and web services
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.webserver;
|
||||
in {
|
||||
options.webserver = { enable = mkEnableOption "Enables webserver role"; };
|
||||
let
|
||||
cfg = config.webserver;
|
||||
in
|
||||
{
|
||||
options.webserver = {
|
||||
enable = mkEnableOption "Enables webserver role";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable { };
|
||||
}
|
||||
|
@@ -1,8 +1,17 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
base.hostName = "";
|
||||
network.routingType = "";
|
||||
network.hardwareAddress = "";
|
||||
network.staticAddresses = [ "/24" "/64" ];
|
||||
network.staticAddresses = [
|
||||
"/24"
|
||||
"/64"
|
||||
];
|
||||
qemu.enable = true;
|
||||
spice.enable = true;
|
||||
|
||||
|
Reference in New Issue
Block a user