1
0
Fork 0

chore: cleanup old and/or unused stuff

This commit is contained in:
Aires 2024-10-25 19:53:50 -04:00
parent 776ee79f4f
commit 6d7026d08b
8 changed files with 9 additions and 213 deletions

View file

@ -112,11 +112,6 @@ in
home = "${services-root}/forgejo";
url = config.secrets.services.forgejo.url;
};
home-assistant = {
enable = false;
home = "${services-root}/home-assistant";
url = config.secrets.services.home-assistant.url;
};
jellyfin = {
enable = true;
home = "${services-root}/jellyfin";

View file

@ -48,12 +48,6 @@
# Install ZSH for all users
zsh.enable = true;
# Enable NH, an alternative nixos-rebuild frontend.
# https://github.com/viperML/nh
nh = {
enable = true;
flake = "${config.secrets.nixConfigFolder}";
};
# Configure nano
nano.nanorc = ''
set tabsize 4

Binary file not shown.

View file

@ -1,71 +0,0 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.aux.system.services.airsonic;
in
{
options = {
aux.system.services.airsonic = {
enable = lib.mkEnableOption "Enables Airsonic Advanced media streaming service.";
home = lib.mkOption {
default = "/var/lib/airsonic";
type = lib.types.str;
description = "Where to store Airsonic's files";
};
url = lib.mkOption {
default = "";
type = lib.types.str;
description = "The complete URL where Airsonic is hosted.";
example = "https://forgejo.example.com";
};
};
};
config = lib.mkIf cfg.enable {
aux.system.users.media.enable = true;
users.users.airsonic.extraGroups = [ "media" ];
services = {
nginx.virtualHosts."${cfg.url}" = {
useACMEHost = pkgs.util.getDomainFromURL cfg.url;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:4040";
proxyWebsockets = true;
extraConfig = ''
# Taken from https://airsonic.github.io/docs/proxy/nginx/
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $host;
proxy_max_temp_file_size 0;
proxy_ssl_server_name on;
'';
};
};
airsonic = {
enable = true;
war = "${
(pkgs.callPackage ../../packages/airsonic-advanced.nix { inherit lib; })
}/webapps/airsonic.war";
port = 4040;
jre = pkgs.jdk17;
jvmOptions = [
"-Dserver.use-forward-headers=true"
"-Xmx4G" # Increase Java heap size to 4GB
];
} // lib.optionalAttrs (cfg.home != "") { home = cfg.home; };
};
systemd.services = {
airsonic.unitConfig.RequiresMountsFor = cfg.home;
nginx.wants = [ config.systemd.services.airsonic.name ];
};
};
}

View file

@ -1,83 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.aux.system.services.home-assistant;
in
{
options = {
aux.system.services.home-assistant = {
enable = lib.mkEnableOption "Enables Home Assistant.";
home = lib.mkOption {
default = "/etc/home-assistant";
type = lib.types.str;
description = "Where to store Home Assistant's files";
example = "/home/home-assistant";
};
url = lib.mkOption {
default = "";
type = lib.types.str;
description = "The complete URL where Home Assistant is hosted.";
example = "https://home-assistant.example.com";
};
};
};
config = lib.mkIf cfg.enable {
services = {
home-assistant = {
enable = true;
# opt-out from declarative configuration management
lovelaceConfig = null;
# configure the path to your config directory
configDir = cfg.home;
# specify list of components required by your configuration
extraComponents = [
"default_config"
"esphome"
"eufy"
"govee_light_local"
"met"
"radio_browser"
"tplink"
];
extraPackages = python3Packages: with python3Packages; [ numpy ];
config.http = {
server_host = "::1";
trusted_proxies = [ "::1" ];
use_x_forwarded_for = true;
};
};
nginx.virtualHosts."${cfg.url}" = {
useACMEHost = pkgs.util.getDomainFromURL cfg.url;
forceSSL = true;
locations."/" = {
proxyPass = "http://[::1]:8123";
proxyWebsockets = true;
extraConfig = ''
# Security / XSS Mitigation Headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
proxy_ssl_server_name on;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering off;
'';
};
};
};
systemd.services = {
home-assistant.unitConfig.RequiresMountsFor = cfg.home;
nginx.wants = [ config.systemd.services.home-assistant.name ];
};
};
}

View file

@ -76,8 +76,12 @@ in
userName = config.secrets.users.aires.firstName;
userEmail = config.secrets.users.aires.email;
extraConfig = {
safe.directory = "${config.secrets.nixConfigFolder}/.git";
core.editor = config.aux.system.editor;
merge.conflictStyle = "zdiff3";
pull.ff = "only";
push.autoSetupRemote = "true";
safe.directory = "${config.secrets.nixConfigFolder}/.git";
submodule.recurse = true;
};
};

View file

@ -1,20 +1,10 @@
{ config, lib, ... }:
{ ... }:
{
# Give root user access to run remote builds
home-manager.users.root = {
home.stateVersion = "24.05";
programs = {
git.extraConfig = {
safe.directory = "${config.secrets.nixConfigFolder}/.git";
};
ssh = {
enable = true;
matchBlocks = config.secrets.users.root.sshConfig;
};
zsh = {
oh-my-zsh.theme = "kardan";
shellAliases.nos = "nixos-operations-script";
};
programs.zsh = {
oh-my-zsh.theme = "kardan";
shellAliases.nos = "nixos-operations-script";
};
};
}

View file

@ -1,33 +0,0 @@
{
lib,
stdenv,
fetchurl,
nixosTests,
}:
stdenv.mkDerivation rec {
pname = "airsonic-advanced";
version = "11.1.4-SNAPSHOT.20240628143437";
src = fetchurl {
url = "https://github.com/kagemomiji/airsonic-advanced/releases/download/${version}/airsonic.war";
sha256 = "fde2c921e26cf536405118c5114a2f42fe87ff0a019852f21c80f4c68a2431ee";
};
buildCommand = ''
mkdir -p "$out/webapps"
cp "$src" "$out/webapps/airsonic.war"
'';
passthru.tests = {
airsonic-starts = nixosTests.airsonic;
};
meta = {
description = "Free, web-based media streamer providing ubiquitous access to your music.";
homepage = "https://github.com/kagemomiji/airsonic-advanced/";
sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
license = lib.licenses.gpl3;
platforms = lib.platforms.all;
};
}