Begin the move to the import all, activate by config model

This commit is contained in:
Jimbo 2024-11-04 22:41:38 -05:00
parent 7397b614de
commit 07cb2d67a2
97 changed files with 776 additions and 633 deletions

View file

@ -1,6 +1,7 @@
{ ... }:
{
imports = [
./keyd
./ssh
];
}

View file

@ -1,8 +1,6 @@
{ ... }:
{
imports = [
./fail2ban
];
imports = [ ./fail2ban ];
services.openssh = {
enable = true;

View file

@ -3,5 +3,6 @@
imports = [
./common
./pc
#./server
];
}

View file

@ -3,9 +3,9 @@
imports = [
./gnome-keyring
./gvfs
./keyd
./libvirtd
./mpd
./polkit
./snapper
./sunshine
];
}

View file

@ -1,4 +1,4 @@
{ ... }:
{ config, ... }:
{
services.gnome.gnome-keyring.enable = true;
services.gnome.gnome-keyring.enable = config.system.desktop.enable;
}

View file

@ -1,7 +1,7 @@
{ ... }:
{ config, ... }:
{
services = {
gvfs.enable = true;
udisks2.enable = true;
gvfs.enable = config.system.desktop.enable;
udisks2.enable = config.system.desktop.enable;
};
}

View file

@ -0,0 +1,46 @@
{ config, lib, pkgs, ... }:
{
options.system.libvirtd = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable libvirtd and such";
};
};
config = lib.mkIf config.system.libvirtd.enable {
virtualisation = {
libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu = {
ovmf = {
enable = true;
packages = [
pkgs.OVMFFull.fd
pkgs.pkgsCross.aarch64-multiplatform.OVMF.fd
];
};
swtpm.enable = true;
};
};
};
environment.systemPackages = with pkgs; [
virt-manager
virtiofsd
dnsmasq
spice-vdagent
looking-glass-client
];
# Needed to make NAT work
networking.firewall.trustedInterfaces = [
"virbr0"
"virbr1"
];
systemd.tmpfiles.rules = [ "f /dev/shm/looking-glass 0660 jimbo libvirtd -" ];
};
}

View file

@ -1,22 +1,24 @@
{ config, ... }:
{ config, lib, ... }:
{
services.mpd = {
enable = true;
user = "jimbo";
group = "users";
musicDirectory = "/home/jimbo/JimboNFS/Music/Synced";
playlistDirectory = "/home/jimbo/JimboNFS/Music/Synced/Playlists";
extraConfig = ''
audio_output {
type "pipewire"
name "Local Pipewire"
}
'';
};
config = lib.mkIf config.system.desktop.enable {
services.mpd = {
enable = true;
user = "jimbo";
group = "users";
musicDirectory = "/home/jimbo/JimboNFS/Music/Synced";
playlistDirectory = "/home/jimbo/JimboNFS/Music/Synced/Playlists";
extraConfig = ''
audio_output {
type "pipewire"
name "Local Pipewire"
}
'';
};
systemd.services.mpd.environment = {
XDG_RUNTIME_DIR = "/run/user/${toString config.users.users.jimbo.uid}";
};
systemd.services.mpd.environment = {
XDG_RUNTIME_DIR = "/run/user/${toString config.users.users.jimbo.uid}";
};
environment.persistence."/persist".directories = [ "/var/lib/mpd" ];
environment.persistence."/persist".directories = [ "/var/lib/mpd" ];
};
}

View file

@ -1,13 +0,0 @@
{ ... }:
{
imports = [
./root
./jimbo
];
services.snapper = {
snapshotInterval = "0/6:00:00";
cleanupInterval = "12:00:00";
persistentTimer = true;
};
}

View file

@ -1,12 +0,0 @@
{ ... }:
{
services.snapper.configs.jimbo = {
SUBVOLUME = "/persist/home/jimbo";
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
TIMELINE_LIMIT_DAILY = 1;
TIMELINE_LIMIT_WEEKLY = 1;
TIMELINE_LIMIT_MONTHLY = 0;
TIMELINE_LIMIT_YEARLY = 0;
};
}

View file

@ -1,12 +0,0 @@
{ ... }:
{
services.snapper.configs.root = {
SUBVOLUME = "/persist";
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
TIMELINE_LIMIT_DAILY = 1;
TIMELINE_LIMIT_WEEKLY = 0;
TIMELINE_LIMIT_MONTHLY = 0;
TIMELINE_LIMIT_YEARLY = 0;
};
}

View file

@ -1,7 +1,7 @@
{ ... }:
{ config, ... }:
{
services.sunshine = {
enable = true;
enable = config.system.desktop.enable;
autoStart = false;
};
}

View file

@ -1,40 +0,0 @@
{ config, pkgs, ... }:
{
virtualisation = {
libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu = {
ovmf = {
enable = true;
packages = [
pkgs.OVMFFull.fd
pkgs.pkgsCross.aarch64-multiplatform.OVMF.fd
];
};
swtpm.enable = true;
};
};
spiceUSBRedirection.enable = true;
};
environment.systemPackages = with pkgs; [
virt-manager
virtiofsd
dnsmasq
spice-vdagent
looking-glass-client
];
# Needed to make NAT work
networking.firewall.trustedInterfaces = [
"virbr0"
"virbr1"
];
# Allow Looking-Glass permissions
systemd.tmpfiles.rules = [
"f /dev/shm/looking-glass 0660 jimbo libvirtd -"
];
}

View file

@ -1,4 +0,0 @@
{ config, lib, ... }:
{
virtualisation.waydroid.enable = true;
}

View file

@ -9,9 +9,9 @@
./minecraft
./misc
./mysql
./nginx
./social
./transmission
./vaultwarden
./webhost
];
}

View file

@ -5,13 +5,11 @@
exports = ''
/export/JimboNFS/Downloads *(rw,sync,no_subtree_check)
/export/JimboNFS/Documents *(rw,sync,no_subtree_check)
/export/JimboNFS/Photos *(rw,sync,no_subtree_check)
/export/JimboNFS/Videos/Random *(rw,sync,no_subtree_check)
/export/JimboNFS/Videos/Media *(rw,sync,no_subtree_check)
/export/JimboNFS/Music/Synced *(rw,sync,no_subtree_check)
/export/JimboNFS/Music/Unsynced *(rw,sync,no_subtree_check)
/export/JimboNFS/Projects *(rw,sync,no_subtree_check)
/export/JimboNFS/School *(rw,sync,no_subtree_check)
/export/JimboNFS/Videos *(rw,sync,no_subtree_check)
/export/JimboNFS/Music *(rw,sync,no_subtree_check)
'';
};
}

View file

@ -1,12 +1,10 @@
{ pkgs, config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services.nextcloud = {
enable = true;
package = pkgs.nextcloud29;
package = pkgs.nextcloud30;
hostName = "cloud.${config.domains.jim1}";
datadir = "/mnt/nextcloud";
https = true;

View file

@ -1,4 +1,4 @@
{ pkgs, config, ... }:
{ config, ... }:
{
services.nginx.virtualHosts."cloud.${config.domains.jim1}" = {
enableACME = true;

View file

@ -1,8 +1,6 @@
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services = {
photoprism = {

View file

@ -1,8 +1,6 @@
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services = {
forgejo = {

View file

@ -30,6 +30,16 @@
<type>application/ogg</type>
<subtype>vorbis</subtype>
</mount>
<mount type="normal">
<mount-name>/jimscrap.opus</mount-name>
<stream-name>Jimbo's Scrap</stream-name>
<stream-description>Music canned from the main radio.</stream-description>
<stream-url>https://icecast.jimbosfiles.com/jimscrap.opus</stream-url>
<genre>Scrapped</genre>
<type>application/ogg</type>
<subtype>vorbis</subtype>
</mount>
'';
};
}

View file

@ -1,30 +1,7 @@
{ pkgs, config, ... }:
{ ... }:
{
services.liquidsoap.streams = {
jimbops = pkgs.writeText "liquidjim" ''
settings.log.stdout.set(true)
settings.init.allow_root.set(true)
settings.scheduler.fast_queues.set(2)
settings.decoder.file_extensions.mp4.set(["m4a", "m4b", "m4p", "m4v", "m4r", "3gp", "mp4"])
# Define the source with random playlist
jimbops = mksafe(playlist(mode='randomize', reload=1, reload_mode="rounds", "/export/JimboNFS/Music/Synced"))
# Ensure the stream never stops
jimbops_fallback = fallback([jimbops, jimbops])
# Output configuration to Icecast
output.icecast(
%ffmpeg(format="ogg", %audio(codec="libvorbis", samplerate=48000, b="256k", channels=2)),
host="127.0.0.1",
port=265,
password="${config.secrets.castSourcePass}",
public=true,
icy_metadata=["artist", "title"],
mount="jimbops.opus",
encoding = "UTF-8",
jimbops_fallback
)
'';
};
imports = [
./jimbops
./jimscrap
];
}

View file

@ -0,0 +1,29 @@
{ pkgs, config, ... }:
{
services.liquidsoap.streams = {
jimbops = pkgs.writeText "liquidjim" ''
settings.log.stdout.set(true)
settings.init.allow_root.set(true)
settings.scheduler.fast_queues.set(2)
# Define the source with random playlist
jimbops = mksafe(playlist(mode='randomize', reload=1, reload_mode="rounds", "/export/JimboNFS/Music/Synced"))
# Ensure the stream never stops
jimbops_fallback = fallback([jimbops, jimbops])
# Output configuration to Icecast
output.icecast(
%ffmpeg(format="ogg", %audio(codec="libvorbis", samplerate=48000, b="256k", channels=2)),
host="127.0.0.1",
port=265,
password="${config.secrets.castSourcePass}",
public=true,
icy_metadata=["artist", "title"],
mount="jimbops.opus",
encoding = "UTF-8",
jimbops_fallback
)
'';
};
}

View file

@ -0,0 +1,29 @@
{ pkgs, config, ... }:
{
services.liquidsoap.streams = {
jimscrap = pkgs.writeText "liquidjim" ''
settings.log.stdout.set(true)
settings.init.allow_root.set(true)
settings.scheduler.fast_queues.set(2)
# Define the source with random playlist
jimscrap = mksafe(playlist(mode='randomize', reload=1, reload_mode="rounds", "/export/JimboNFS/Music/Unsynced"))
# Ensure the stream never stops
jimscrap_fallback = fallback([jimscrap, jimscrap])
# Output configuration to Icecast
output.icecast(
%ffmpeg(format="ogg", %audio(codec="libvorbis", samplerate=48000, b="256k", channels=2)),
host="127.0.0.1",
port=265,
password="${config.secrets.castSourcePass}",
public=true,
icy_metadata=["artist", "title"],
mount="jimscrap.opus",
encoding = "UTF-8",
jimscrap_fallback
)
'';
};
}

View file

@ -1,5 +1,10 @@
{ pkgs, config, ... }:
{
imports = [
./rtmp
./virtualhosts
];
services.nginx = {
enable = true;
recommendedTlsSettings = true;
@ -9,6 +14,7 @@
};
networking.firewall.allowedTCPPorts = [
80 443
80
443
];
}

View file

@ -1,4 +1,4 @@
{ pkgs, config, ... }:
{ config, ... }:
{
services.nginx.virtualHosts = {
"${config.domains.jim1}" = {

View file

@ -1,8 +1,6 @@
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services.lemmy = {
enable = true;

View file

@ -1,8 +1,6 @@
{ pkgs, config, ... }:
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
nixpkgs.config.element-web.conf = {
default_server_config = {

View file

@ -1,8 +1,6 @@
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services = {
coturn = {

View file

@ -6,8 +6,8 @@
SYNCV3_SERVER = "https://matrix.${config.domains.jim1}";
SYNCV3_BINDADDR = "0.0.0.0:8009";
};
environmentFile = "${pkgs.writeText "matrixsecret" ''
environmentFile = pkgs.writeText "matrixsecret" ''
SYNCV3_SECRET=${config.secrets.matrixSecret}
''}";
'';
};
}

View file

@ -1,8 +1,6 @@
{ ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services.owncast = {
enable = true;

View file

@ -1,8 +1,6 @@
{ pkgs, config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services.transmission = {
enable = true;

View file

@ -1,8 +1,6 @@
{ config, ... }:
{
imports = [
./nginx
];
imports = [ ./nginx ];
services.vaultwarden = {
enable = true;

View file

@ -1,7 +0,0 @@
{ ... }:
{
imports = [
./nginx
./virtualhosts
];
}