fix references

This commit is contained in:
Noah Masur 2025-02-17 14:05:23 -05:00
parent 7de88ba2b6
commit ebd7b88909
No known key found for this signature in database
54 changed files with 272 additions and 216 deletions

View File

@ -5,6 +5,8 @@
lib.pipe (lib.filesystem.listFilesRecursive ./.) [ lib.pipe (lib.filesystem.listFilesRecursive ./.) [
# Get only files ending in default.nix # Get only files ending in default.nix
(builtins.filter (name: lib.hasSuffix "default.nix" name)) (builtins.filter (name: lib.hasSuffix "default.nix" name))
# Remove this file
(builtins.filter (name: name != ./default.nix))
# Import each host function # Import each host function
map map
(file: { (file: {

View File

@ -9,6 +9,8 @@ in
lib.pipe (lib.filesystem.listFilesRecursive ./.) [ lib.pipe (lib.filesystem.listFilesRecursive ./.) [
# Get only files ending in default.nix # Get only files ending in default.nix
(builtins.filter (name: lib.hasSuffix "default.nix" name)) (builtins.filter (name: lib.hasSuffix "default.nix" name))
# Remove this file
(builtins.filter (name: name != ./default.nix))
# Import each host function # Import each host function
map map
(file: { (file: {

View File

@ -9,6 +9,8 @@ in
lib.pipe (lib.filesystem.listFilesRecursive ./.) [ lib.pipe (lib.filesystem.listFilesRecursive ./.) [
# Get only files ending in default.nix # Get only files ending in default.nix
(builtins.filter (name: lib.hasSuffix "default.nix" name)) (builtins.filter (name: lib.hasSuffix "default.nix" name))
# Remove this file
(builtins.filter (name: name != ./default.nix))
# Import each host function # Import each host function
map map
(file: { (file: {

View File

@ -13,13 +13,14 @@ rec {
in in
{ {
audiobooks = "read.${baseName}"; audiobooks = "read.${baseName}";
books = "books.${baseName}";
content = "cloud.${baseName}";
download = "download.${baseName}";
files = "files.${baseName}"; files = "files.${baseName}";
paperless = "paper.${baseName}"; paperless = "paper.${baseName}";
photos = "photos.${baseName}"; photos = "photos.${baseName}";
prometheus = "prom.${baseName}";
stream = "stream.${baseName}"; stream = "stream.${baseName}";
content = "cloud.${baseName}";
books = "books.${baseName}";
download = "download.${baseName}";
}; };
}; };

View File

@ -8,6 +8,13 @@ rec {
nmasur.settings = { nmasur.settings = {
username = "noah"; username = "noah";
fullName = "Noah Masur"; fullName = "Noah Masur";
hostnames =
let
baseName = "masu.rs";
in
{
prometheus = "prom.${baseName}";
};
}; };
nmasur.profiles = { nmasur.profiles = {

View File

@ -0,0 +1,31 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.aws;
in
{
options.aws.enable = lib.mkEnableOption "AWS EC2";
config = lib.mkIf cfg.enable {
# AWS settings require this
permitRootLogin = "prohibit-password";
# Make sure disk size is large enough
# https://github.com/nix-community/nixos-generators/issues/150
amazonImage.sizeMB = 16 * 1024;
boot.kernelPackages = pkgs.legacyPackages.x86_64-linux.linuxKernel.packages.linux_6_6;
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.efi.canTouchEfiVariables = lib.mkForce false;
services.amazon-ssm-agent.enable = true;
users.users.ssm-user.extraGroups = [ "wheel" ];
};
}

View File

@ -0,0 +1,9 @@
{ lib, ... }:
{
imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [
# Get only files ending in .nix
(builtins.filter (name: lib.hasSuffix ".nix" name))
# Remove this file
(builtins.filter (name: name != ./default.nix))
];
}

View File

@ -3,5 +3,7 @@
imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [ imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [
# Get only files ending in .nix # Get only files ending in .nix
(builtins.filter (name: lib.hasSuffix ".nix" name)) (builtins.filter (name: lib.hasSuffix ".nix" name))
# Remove this file
(builtins.filter (name: name != ./default.nix))
]; ];
} }

View File

@ -15,12 +15,12 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Alias sudo to doas for convenience # Alias sudo to doas for convenience
fish.shellAliases = { programs.fish.shellAliases = {
sudo = "doas"; sudo = "doas";
}; };
# Disable overriding our sudo alias with a TERMINFO alias # Disable overriding our sudo alias with a TERMINFO alias
kitty.settings.shell_integration = "no-sudo"; programs.kitty.settings.shell_integration = "no-sudo";
}; };
} }

View File

@ -12,7 +12,7 @@ in
# Allows me to make sure I can work on my dotfiles locally # Allows me to make sure I can work on my dotfiles locally
options.nmasur.preset.programs.dotfiles = { options.nmasur.presets.programs.dotfiles = {
enable = lib.mkEnableOption "Clone dotfiles repository"; enable = lib.mkEnableOption "Clone dotfiles repository";
repo = lib.mkOption { repo = lib.mkOption {
type = lib.types.str; type = lib.types.str;

View File

@ -21,7 +21,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
cfg.fish_user_key_bindings = # fish nmasur.presets.programs.fish.fish_user_key_bindings = # fish
'' ''
# Shift-Enter (defined by terminal) # Shift-Enter (defined by terminal)
bind -M insert \x1F accept-autosuggestion bind -M insert \x1F accept-autosuggestion

View File

@ -13,6 +13,7 @@ in
options.nmasur.presets.programs.jujutsu.enable = lib.mkEnableOption "Jujutsu version control"; options.nmasur.presets.programs.jujutsu.enable = lib.mkEnableOption "Jujutsu version control";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.jujutsu = {
enable = true; enable = true;
# https://github.com/martinvonz/jj/blob/main/docs/config.md # https://github.com/martinvonz/jj/blob/main/docs/config.md
@ -22,6 +23,7 @@ in
email = config.programs.git.userEmail; email = config.programs.git.userEmail;
}; };
}; };
};
}; };
} }

View File

@ -6,12 +6,12 @@
}: }:
let let
cfg = config.nmasur.presets.programs.alacritty; cfg = config.nmasur.presets.programs.mpv;
in in
{ {
options.nmasur.presets.programs.alacritty.enable = lib.mkEnableOption "Alacritty terminal"; options.nmasur.presets.programs.mpv.enable = lib.mkEnableOption "mpv video player";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Video player # Video player

View File

@ -28,7 +28,7 @@ in
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
cfg.package = lib.mkDefault pkgs.nmasur-neovim.override { nmasur.presets.programs.neovim.package = lib.mkDefault pkgs.nmasur-neovim.override {
colors = cfg.colors; colors = cfg.colors;
github = cfg.github.enable; github = cfg.github.enable;
terraform = cfg.terraform.enable; terraform = cfg.terraform.enable;

View File

@ -6,7 +6,6 @@
}: }:
let let
inherit (config.nmasur.settings) username;
cfg = config.nmasur.presets.programs.nixpkgs; cfg = config.nmasur.presets.programs.nixpkgs;
in in
@ -110,13 +109,6 @@ in
'' ''
); );
# Set automatic generation cleanup for home-manager
nix.gc = {
automatic = config.nix.gc.automatic;
options = config.nix.gc.options;
};
};
nix = { nix = {
# Set channel to flake packages, used for nix-shell commands # Set channel to flake packages, used for nix-shell commands
@ -134,6 +126,7 @@ in
warn-dirty = false warn-dirty = false
''; '';
# Set automatic generation cleanup for home-manager
gc = { gc = {
automatic = true; automatic = true;
options = "--delete-older-than 10d"; options = "--delete-older-than 10d";
@ -157,4 +150,6 @@ in
}; };
}; };
};
} }

View File

@ -13,8 +13,12 @@ in
# Adapted from: # Adapted from:
# A rofi powered menu to execute brightness choices. # A rofi powered menu to execute brightness choices.
config.brightnessCommand = lib.mkIf config.nmasur.presets.programs.rofi.enable builtins.toString ( config.nmasur.presets.services.i3.commands.brightness =
pkgs.writeShellScript "brightness" '' lib.mkIf config.nmasur.presets.programs.rofi.enable
(
builtins.toString (
pkgs.writeShellScript "brightness" # bash
''
dimmer="󰃝" dimmer="󰃝"
medium="󰃟" medium="󰃟"
@ -51,5 +55,6 @@ in
esac esac
'' ''
)
); );
} }

View File

@ -38,7 +38,7 @@ in
{ {
launcher = ''${lib.getExe rofi} -modes drun -show drun -theme-str '@import "launcher.rasi"' ''; launcher = ''${lib.getExe rofi} -modes drun -show drun -theme-str '@import "launcher.rasi"' '';
systemdSearch = lib.getExe pkgs.rofi-systemd; systemdSearch = lib.getExe pkgs.rofi-systemd;
altTab = "${lib.getExe rofi} -show window -modi window"; applicationSwitch = "${lib.getExe rofi} -show window -modi window";
calculator = "${lib.getExe rofi} -modes calc -show calc"; calculator = "${lib.getExe rofi} -modes calc -show calc";
audioSwitch = lib.getExe ( audioSwitch = lib.getExe (
pkgs.writeShellApplication { pkgs.writeShellApplication {

View File

@ -13,6 +13,7 @@ in
options.nmasur.presets.services.dunst.enable = lib.mkEnableOption "Dunst notification system"; options.nmasur.presets.services.dunst.enable = lib.mkEnableOption "Dunst notification system";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.dunst = {
enable = false; enable = false;
settings = { settings = {
global = { global = {
@ -32,6 +33,7 @@ in
timeout = 10; timeout = 10;
}; };
}; };
};
}; };
} }

View File

@ -190,7 +190,9 @@ in
lib.mkIf cfg.commands.systemdSearch != null "exec --no-startup-id ${cfg.commands.systemdSearch}"; lib.mkIf cfg.commands.systemdSearch != null "exec --no-startup-id ${cfg.commands.systemdSearch}";
"${modifier}+Shift+a" = "${modifier}+Shift+a" =
lib.mkIf cfg.commands.audioSwitch != null "exec --no-startup-id ${cfg.commands.audioSwitch}"; lib.mkIf cfg.commands.audioSwitch != null "exec --no-startup-id ${cfg.commands.audioSwitch}";
"Mod1+Tab" = lib.mkIf cfg.commands.altTab != null "exec --no-startup-id ${cfg.commands.altTab}"; "Mod1+Tab" =
lib.mkIf cfg.commands.applicationSwitch
!= null "exec --no-startup-id ${cfg.commands.applicationSwitch}";
"${modifier}+Shift+period" = "${modifier}+Shift+period" =
lib.mkIf cfg.commands.power != null "exec --no-startup-id ${cfg.commands.power}"; lib.mkIf cfg.commands.power != null "exec --no-startup-id ${cfg.commands.power}";
"${modifier}+Shift+m" = "${modifier}+Shift+m" =

View File

@ -12,7 +12,7 @@ in
{ {
options.nmasur.preset.services.mbsync = { options.nmasur.presets.services.mbsync = {
enable = lib.mkEnableOption "Mail service."; enable = lib.mkEnableOption "Mail service.";
user = lib.mkOption { user = lib.mkOption {
type = lib.types.str; type = lib.types.str;

View File

@ -14,8 +14,8 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
nmasur.gtk.enable = lib.mkDefault true;
nmasur.presets = { nmasur.presets = {
gtk.enable = lib.mkDefault true;
programs = { programs = {
_1password.enable = lib.mkDefault true; _1password.enable = lib.mkDefault true;
aerc.enable = lib.mkDefault true; aerc.enable = lib.mkDefault true;

View File

@ -0,0 +1,19 @@
{ lib, ... }:
{
options.nmasur.settings = {
username = lib.mkOption {
type = lib.types.str;
description = "Primary username for the system";
};
fullName = lib.mkOption {
type = lib.types.str;
description = "Human readable name of the user";
};
hostnames = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
description = "Map of service names to FQDNs";
default = { };
};
};
}

View File

@ -3,5 +3,7 @@
imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [ imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [
# Get only files ending in .nix # Get only files ending in .nix
(builtins.filter (name: lib.hasSuffix ".nix" name)) (builtins.filter (name: lib.hasSuffix ".nix" name))
# Remove this file
(builtins.filter (name: name != ./default.nix))
]; ];
} }

View File

@ -3,5 +3,7 @@
imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [ imports = lib.pipe (lib.filesystem.listFilesRecursive ./.) [
# Get only files ending in .nix # Get only files ending in .nix
(builtins.filter (name: lib.hasSuffix ".nix" name)) (builtins.filter (name: lib.hasSuffix ".nix" name))
# Remove this file
(builtins.filter (name: name != ./default.nix))
]; ];
} }

View File

@ -59,7 +59,7 @@ in
}; };
# Allow web traffic to Caddy # Allow web traffic to Caddy
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.budget ]; } ]; match = [ { host = [ hostnames.budget ]; } ];
handle = [ handle = [

View File

@ -8,7 +8,7 @@
let let
inherit (config.nmasur.settings) hostnames; inherit (config.nmasur.settings) hostnames;
cfg = config.nmasur.presets.services.actualbudget; cfg = config.nmasur.presets.services.arrs;
# This config specifies ports for Prometheus to scrape information # This config specifies ports for Prometheus to scrape information
arrConfig = { arrConfig = {
@ -46,7 +46,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Required # Required
config.nmasur.profiles.shared-media.enable = true; # Shared user for multiple services nmasur.profiles.shared-media.enable = true; # Shared user for multiple services
# # Broken on 2024-12-07 # # Broken on 2024-12-07
# # https://discourse.nixos.org/t/solved-sonarr-is-broken-in-24-11-unstable-aka-how-the-hell-do-i-use-nixpkgs-config-permittedinsecurepackages/ # # https://discourse.nixos.org/t/solved-sonarr-is-broken-in-24-11-unstable-aka-how-the-hell-do-i-use-nixpkgs-config-permittedinsecurepackages/
@ -92,7 +92,7 @@ in
# Requires updating the base_url config value in each service # Requires updating the base_url config value in each service
# If you try to rewrite the URL, the service won't redirect properly # If you try to rewrite the URL, the service won't redirect properly
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
# Group means that routes with the same name are mutually exclusive, # Group means that routes with the same name are mutually exclusive,
# so they are split between the appropriate services. # so they are split between the appropriate services.
@ -276,7 +276,7 @@ in
}; };
# Prometheus scrape targets (expose Exportarr to Prometheus) # Prometheus scrape targets (expose Exportarr to Prometheus)
prometheus.scrapeTargets = map ( nmasur.presets.services.prometheus-exporters.scrapeTargets = map (
key: key:
"127.0.0.1:${ "127.0.0.1:${
lib.attrsets.getAttrFromPath [ lib.attrsets.getAttrFromPath [

View File

@ -28,7 +28,7 @@ in
}; };
# Allow web traffic to Caddy # Allow web traffic to Caddy
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ globals.hostnames.audiobooks ]; } ]; match = [ { host = [ globals.hostnames.audiobooks ]; } ];
handle = [ handle = [

View File

@ -43,15 +43,15 @@ in
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
description = "CIDR blocks to allow for requests"; description = "CIDR blocks to allow for requests";
default = [ ]; default = [ ];
merge = lib.mkMerge; # Ensure that values are merged from default # merge = lib.mkMerge; # Ensure that values are merged from default
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Force Caddy to 403 if not coming from allowlisted source # Force Caddy to 403 if not coming from allowlisted source
cfg.cidrAllowlist = lib.mkDefault [ "127.0.0.1/32" ]; nmasur.presets.services.caddy.cidrAllowlist = lib.mkDefault [ "127.0.0.1/32" ];
cfg.routes = lib.mkBefore [ nmasur.presets.services.caddy.routes = lib.mkBefore [
{ {
match = [ { not = [ { remote_ip.ranges = cfg.cidrAllowlist; } ]; } ]; match = [ { not = [ { remote_ip.ranges = cfg.cidrAllowlist; } ]; } ];
handle = [ handle = [
@ -72,7 +72,7 @@ in
getHostnameFromRoute = getHostnameFromRoute =
route: route:
if (lib.hasAttr "match" route) then (lib.concatMap getHostnameFromMatch route.match) else [ ]; if (lib.hasAttr "match" route) then (lib.concatMap getHostnameFromMatch route.match) else [ ];
hostnames_non_unique = lib.concatMap getHostnameFromRoute config.caddy.routes; hostnames_non_unique = lib.concatMap getHostnameFromRoute cfg.routes;
hostnames = lib.unique hostnames_non_unique; hostnames = lib.unique hostnames_non_unique;
# Create attrset of subdomains to their fqdns # Create attrset of subdomains to their fqdns
hostname_map = builtins.listToAttrs ( hostname_map = builtins.listToAttrs (
@ -90,8 +90,8 @@ in
listen = [ ":443" ]; listen = [ ":443" ];
# These routes are pulled from the rest of this repo # These routes are pulled from the rest of this repo
routes = config.caddy.routes; routes = cfg.routes;
errors.routes = config.caddy.blocks; errors.routes = cfg.blocks;
# Uncommenting collects access logs # Uncommenting collects access logs
logs = { logs = {
@ -104,7 +104,7 @@ in
}; };
}; };
apps.http.servers.metrics = { }; # Enables Prometheus metrics apps.http.servers.metrics = { }; # Enables Prometheus metrics
apps.tls.automation.policies = config.caddy.tlsPolicies; apps.tls.automation.policies = cfg.tlsPolicies;
# Setup logging to journal and files # Setup logging to journal and files
logging.logs = logging.logs =
@ -223,6 +223,6 @@ in
# Caddy exposes Prometheus metrics with the admin API # Caddy exposes Prometheus metrics with the admin API
# https://caddyserver.com/docs/api # https://caddyserver.com/docs/api
prometheus.scrapeTargets = [ "127.0.0.1:2019" ]; nmasur.presets.services.prometheus-exporters.scrapeTargets = [ "127.0.0.1:2019" ];
}; };
} }

View File

@ -37,7 +37,7 @@ in
}; };
# Allow web traffic to Caddy # Allow web traffic to Caddy
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.books ]; } ]; match = [ { host = [ hostnames.books ]; } ];
handle = [ handle = [

View File

@ -70,7 +70,7 @@ in
plugins = [ "github.com/caddy-dns/cloudflare@master" ]; plugins = [ "github.com/caddy-dns/cloudflare@master" ];
hash = "sha256-C7JOGd4sXsRZL561oP84V2/pTg7szEgF4OFOw35yS1s="; hash = "sha256-C7JOGd4sXsRZL561oP84V2/pTg7szEgF4OFOw35yS1s=";
}; };
caddy.tlsPolicies = [ nmasur.presets.services.caddy.tlsPolicies = [
{ {
issuers = [ issuers = [
{ {

View File

@ -16,10 +16,10 @@ in
services.filebrowser = { services.filebrowser = {
enable = true; enable = true;
# Generate password: htpasswd -nBC 10 "" | tr -d ':\n' # Generate password: htpasswd -nBC 10 "" | tr -d ':\n'
password = "$2y$10$ze1cMob0k6pnXRjLowYfZOVZWg4G.dsPtH3TohbUeEbI0sdkG9.za"; passwordHash = "$2y$10$ze1cMob0k6pnXRjLowYfZOVZWg4G.dsPtH3TohbUeEbI0sdkG9.za";
}; };
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.files ]; } ]; match = [ { host = [ hostnames.files ]; } ];
handle = [ handle = [

View File

@ -61,7 +61,7 @@ in
users.users.${username}.extraGroups = [ "gitea" ]; users.users.${username}.extraGroups = [ "gitea" ];
caddy.routes = [ nmasur.presets.services.caddy.routes = [
# Prevent public access to Prometheus metrics. # Prevent public access to Prometheus metrics.
{ {
match = [ match = [
@ -95,7 +95,7 @@ in
services.cloudflare-dyndns.domains = [ hostnames.git ]; services.cloudflare-dyndns.domains = [ hostnames.git ];
# Scrape the metrics endpoint for Prometheus. # Scrape the metrics endpoint for Prometheus.
prometheus.scrapeTargets = [ nmasur.presets.services.prometheus-exporters.scrapeTargets = [
"127.0.0.1:${builtins.toString config.services.gitea.settings.server.HTTP_PORT}" "127.0.0.1:${builtins.toString config.services.gitea.settings.server.HTTP_PORT}"
]; ];

View File

@ -2561,7 +2561,7 @@ in
}; };
}; };
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.metrics ]; } ]; match = [ { host = [ hostnames.metrics ]; } ];
handle = [ handle = [

View File

@ -29,7 +29,7 @@ in
}; };
}; };
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.photos ]; } ]; match = [ { host = [ hostnames.photos ]; } ];
handle = [ handle = [

View File

@ -55,7 +55,7 @@ in
before = [ "influxdb2.service" ]; before = [ "influxdb2.service" ];
}; };
caddy.routes = lib.mkIf config.services.influxdb2.enable [ nmasur.presets.services.caddy.routes = lib.mkIf config.services.influxdb2.enable [
{ {
match = [ { host = [ hostnames.influxdb ]; } ]; match = [ { host = [ hostnames.influxdb ]; } ];
handle = [ handle = [

View File

@ -14,6 +14,8 @@ let
in in
{ {
options.nmasur.presets.services.jellyfin.enable = lib.mkEnableOption "Jellyfin video streaming";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.jellyfin.group = lib.mkIf config.nmasur.profiles.shared-media.enable "shared"; services.jellyfin.group = lib.mkIf config.nmasur.profiles.shared-media.enable "shared";
@ -21,7 +23,7 @@ in
isSystemUser = true; isSystemUser = true;
}; };
caddy.routes = [ nmasur.presets.services.caddy.routes = [
# Prevent public access to Prometheus metrics. # Prevent public access to Prometheus metrics.
{ {
match = [ match = [
@ -79,6 +81,6 @@ in
systemd.services.jellyfin.serviceConfig.UMask = lib.mkForce "0007"; systemd.services.jellyfin.serviceConfig.UMask = lib.mkForce "0007";
# Requires MetricsEnable is true in /var/lib/jellyfin/config/system.xml # Requires MetricsEnable is true in /var/lib/jellyfin/config/system.xml
prometheus.scrapeTargets = [ "127.0.0.1:8096" ]; nmasur.presets.services.prometheus-exporters.scrapeTargets = [ "127.0.0.1:8096" ];
}; };
} }

View File

@ -55,7 +55,7 @@ in
# Broken on 2024-08-23 # Broken on 2024-08-23
# https://github.com/NixOS/nixpkgs/commit/0875d0ce1c778f344cd2377a5337a45385d6ffa0 # https://github.com/NixOS/nixpkgs/commit/0875d0ce1c778f344cd2377a5337a45385d6ffa0
insecurePackages = [ "litestream-0.3.13" ]; allowInsecurePackages = [ "litestream-0.3.13" ];
# Wait for secret to exist # Wait for secret to exist
systemd.services.litestream = { systemd.services.litestream = {

View File

@ -53,7 +53,7 @@ in
networking.firewall.allowedTCPPorts = [ publicPort ]; networking.firewall.allowedTCPPorts = [ publicPort ];
cloudflare.noProxyDomains = [ hostnames.minecraft ]; nmasur.presets.services.cloudflare.noProxyDomains = [ hostnames.minecraft ];
## Automatically start and stop Minecraft server based on player connections ## Automatically start and stop Minecraft server based on player connections

View File

@ -33,7 +33,7 @@ in
services.cloudflare-dyndns.domains = [ hostnames.n8n ]; services.cloudflare-dyndns.domains = [ hostnames.n8n ];
# Allow web traffic to Caddy # Allow web traffic to Caddy
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.n8n ]; } ]; match = [ { host = [ hostnames.n8n ]; } ];
handle = [ handle = [

View File

@ -63,7 +63,7 @@ in
users.users.caddy.extraGroups = [ "nextcloud" ]; users.users.caddy.extraGroups = [ "nextcloud" ];
# Point Caddy to Nginx # Point Caddy to Nginx
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.content ]; } ]; match = [ { host = [ hostnames.content ]; } ];
handle = [ handle = [
@ -225,7 +225,7 @@ in
url = "https://${hostnames.content}"; url = "https://${hostnames.content}";
passwordFile = config.services.nextcloud.config.adminpassFile; passwordFile = config.services.nextcloud.config.adminpassFile;
}; };
prometheus.scrapeTargets = [ nmasur.presets.services.prometheus-exporters.scrapeTargets = [
"127.0.0.1:${builtins.toString config.services.prometheus.exporters.nextcloud.port}" "127.0.0.1:${builtins.toString config.services.prometheus.exporters.nextcloud.port}"
]; ];
# Allows nextcloud-exporter to read passwordFile # Allows nextcloud-exporter to read passwordFile

View File

@ -21,7 +21,7 @@ in
}; };
}; };
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.notifications ]; } ]; match = [ { host = [ hostnames.notifications ]; } ];
handle = [ handle = [

View File

@ -30,7 +30,7 @@ in
users.users.nextcloud.extraGroups = lib.mkIf config.services.nextcloud.enable [ "paperless" ]; users.users.nextcloud.extraGroups = lib.mkIf config.services.nextcloud.enable [ "paperless" ];
users.users.${username}.extraGroups = [ "paperless" ]; users.users.${username}.extraGroups = [ "paperless" ];
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ match = [
{ {

View File

@ -12,8 +12,8 @@ in
{ {
options.nmasur.presets.services.postgresql.enable = lib.mkEnableOption "Postgresql database"; options.nmasur.presets.services.postgresql.enable = lib.mkEnableOption "Postgresql database";
config = lib.mkIf cfg.enable {
services.postgresql = lib.mkIf cfg.enable { services.postgresql = {
enable = true; enable = true;
package = pkgs.postgresql_15; package = pkgs.postgresql_15;
settings = { }; settings = { };
@ -37,5 +37,6 @@ in
} }
]; ];
}; };
};
} }

View File

@ -27,7 +27,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Default scrape the basic host information # Default scrape the basic host information
cfg.scrapeTargets = [ nmasur.presets.services.prometheus-exporters.scrapeTargets = [
"127.0.0.1:${builtins.toString config.services.prometheus.exporters.node.port}" "127.0.0.1:${builtins.toString config.services.prometheus.exporters.node.port}"
"127.0.0.1:${builtins.toString config.services.prometheus.exporters.systemd.port}" "127.0.0.1:${builtins.toString config.services.prometheus.exporters.systemd.port}"
"127.0.0.1:${builtins.toString config.services.prometheus.exporters.process.port}" "127.0.0.1:${builtins.toString config.services.prometheus.exporters.process.port}"

View File

@ -1,18 +0,0 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.nmasur.presets.services.;
in
{
options.nmasur.presets.services..enable = lib.mkEnableOption "";
config = lib.mkIf cfg.enable {
};
}

View File

@ -5,6 +5,8 @@ let
in in
{ {
options.nmasur.presets.services.thelounge.enable = lib.mkEnableOption "TheLounge IRC chat service";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.thelounge = { services.thelounge = {
@ -21,7 +23,7 @@ in
# sudo su - thelounge -s /bin/sh -c "thelounge add myuser" # sudo su - thelounge -s /bin/sh -c "thelounge add myuser"
# Allow web traffic to Caddy # Allow web traffic to Caddy
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.irc ]; } ]; match = [ { host = [ hostnames.irc ]; } ];
handle = [ handle = [

View File

@ -64,7 +64,7 @@ in
}; };
# Create reverse proxy for web UI # Create reverse proxy for web UI
caddy.routes = nmasur.presets.services.caddy.routes =
let let
# Set if the download domain is the same as the Transmission domain # Set if the download domain is the same as the Transmission domain
useDownloadDomain = hostnames.download == hostnames.transmission; useDownloadDomain = hostnames.download == hostnames.transmission;

View File

@ -19,7 +19,7 @@ in
}; };
# Allow web traffic to Caddy # Allow web traffic to Caddy
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.status ]; } ]; match = [ { host = [ hostnames.status ]; } ];
handle = [ handle = [

View File

@ -51,7 +51,7 @@ in
networking.firewall.allowedTCPPorts = [ 3012 ]; networking.firewall.allowedTCPPorts = [ 3012 ];
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.secrets ]; } ]; match = [ { host = [ hostnames.secrets ]; } ];
handle = [ handle = [

View File

@ -20,7 +20,9 @@ let
{ {
job_name = config.networking.hostName; job_name = config.networking.hostName;
stream_parse = true; stream_parse = true;
static_configs = [ { targets = config.prometheus.scrapeTargets; } ]; static_configs = [
{ targets = config.nmasur.presets.services.prometheus-exporters.scrapeTargets; }
];
} }
]; ];
}; };
@ -78,7 +80,7 @@ in
before = [ "vmauth.service" ]; before = [ "vmauth.service" ];
}; };
caddy.routes = [ nmasur.presets.services.caddy.routes = [
{ {
match = [ { host = [ hostnames.prometheus ]; } ]; match = [ { host = [ hostnames.prometheus ]; } ];
handle = [ handle = [

View File

@ -20,7 +20,9 @@ let
{ {
job_name = config.networking.hostName; job_name = config.networking.hostName;
stream_parse = true; stream_parse = true;
static_configs = [ { targets = config.prometheus.scrapeTargets; } ]; static_configs = [
{ targets = config.nmasur.presets.services.prometheus-exporters.scrapeTargets; }
];
} }
]; ];
}; };

View File

@ -20,7 +20,7 @@ in
boot.kernelParams = [ "nohibernate" ]; # ZFS does not work with hibernation boot.kernelParams = [ "nohibernate" ]; # ZFS does not work with hibernation
boot.supportedFilesystems = [ "zfs" ]; boot.supportedFilesystems = [ "zfs" ];
services.prometheus.exporters.zfs.enable = config.prometheus.exporters.enable; services.prometheus.exporters.zfs.enable = config.prometheus.exporters.enable;
prometheus.scrapeTargets = [ nmasur.presets.services.prometheus-exporters.scrapeTargets = [
"127.0.0.1:${builtins.toString config.services.prometheus.exporters.zfs.port}" "127.0.0.1:${builtins.toString config.services.prometheus.exporters.zfs.port}"
]; ];

View File

@ -1,20 +0,0 @@
{ config, lib, ... }:
let
cfg = config.nmasur.profiles.aws;
in
{
options.nmasur.profiles.aws.enable = lib.mkEnableOption "AWS EC2";
config = lib.mkIf cfg.enable {
# AWS settings require this
permitRootLogin = "prohibit-password";
# Make sure disk size is large enough
# https://github.com/nix-community/nixos-generators/issues/150
amazonImage.sizeMB = 16 * 1024;
};
}

View File

@ -20,7 +20,7 @@ in
msmtp.enable = lib.mkDefault true; msmtp.enable = lib.mkDefault true;
}; };
services = { services = {
arr.enable = lib.mkDefault true; arrs.enable = lib.mkDefault true;
audiobookshelf.enable = lib.mkDefault true; audiobookshelf.enable = lib.mkDefault true;
bind.enable = lib.mkDefault true; bind.enable = lib.mkDefault true;
caddy.enable = lib.mkDefault true; caddy.enable = lib.mkDefault true;