Compare commits
6 commits
86c585111c
...
7b9b394ad2
Author | SHA1 | Date | |
---|---|---|---|
|
7b9b394ad2 | ||
|
1e98b54454 | ||
|
f5c67b812f | ||
|
0e5d8e3335 | ||
|
9715517af6 | ||
|
99e57603c7 |
|
@ -76,7 +76,6 @@ in {
|
||||||
# system tools
|
# system tools
|
||||||
protonvpn-gui
|
protonvpn-gui
|
||||||
openvpn
|
openvpn
|
||||||
nextcloud-client
|
|
||||||
noisetorch
|
noisetorch
|
||||||
|
|
||||||
# hardware managment tools
|
# hardware managment tools
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
folder = "leyla";
|
folder = "leyla";
|
||||||
user = "leyla";
|
user = "leyla";
|
||||||
group = "leyla";
|
group = "leyla";
|
||||||
|
bind = "/home/leyla/documents";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
folder = "eve";
|
folder = "eve";
|
||||||
|
@ -69,6 +70,12 @@
|
||||||
user = "root";
|
user = "root";
|
||||||
group = "users";
|
group = "users";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
folder = "media";
|
||||||
|
user = "jellyfin";
|
||||||
|
group = "jellyfin_media";
|
||||||
|
bind = config.host.jellyfin.media_directory;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
nfs = {
|
nfs = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -108,7 +115,7 @@
|
||||||
enable = false;
|
enable = false;
|
||||||
};
|
};
|
||||||
nextcloud = {
|
nextcloud = {
|
||||||
enable = true;
|
enable = false;
|
||||||
subdomain = "drive";
|
subdomain = "drive";
|
||||||
};
|
};
|
||||||
sync = {
|
sync = {
|
||||||
|
|
|
@ -38,40 +38,28 @@
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
"/mnt/new_leyla_home" = {
|
"/mnt/leyla_documents" = {
|
||||||
device = "defiant:/exports/leyla";
|
device = "defiant:/exports/leyla";
|
||||||
fsType = "nfs";
|
fsType = "nfs";
|
||||||
options = ["x-systemd.automount" "user" "noatime" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
options = ["x-systemd.automount" "user" "noatime" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
||||||
};
|
};
|
||||||
|
|
||||||
"/mnt/new_eve_home" = {
|
"/mnt/eve_documents" = {
|
||||||
device = "defiant:/exports/eve";
|
device = "defiant:/exports/eve";
|
||||||
fsType = "nfs";
|
fsType = "nfs";
|
||||||
options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
||||||
};
|
};
|
||||||
|
|
||||||
"/mnt/new_users_home" = {
|
"/mnt/users_documents" = {
|
||||||
device = "defiant:/exports/users";
|
device = "defiant:/exports/users";
|
||||||
fsType = "nfs";
|
fsType = "nfs";
|
||||||
options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
||||||
};
|
};
|
||||||
|
|
||||||
"/mnt/leyla_home" = {
|
"/mnt/media" = {
|
||||||
device = "server.arpa:/home/leyla";
|
device = "defiant:/exports/media";
|
||||||
fsType = "nfs";
|
fsType = "nfs";
|
||||||
options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
options = ["x-systemd.automount" "noauto" "user" "noatime" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
||||||
};
|
|
||||||
|
|
||||||
"/mnt/share_home" = {
|
|
||||||
device = "server.arpa:/home/share";
|
|
||||||
fsType = "nfs";
|
|
||||||
options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
|
||||||
};
|
|
||||||
|
|
||||||
"/mnt/docker_home" = {
|
|
||||||
device = "server.arpa:/home/docker";
|
|
||||||
fsType = "nfs";
|
|
||||||
options = ["x-systemd.automount" "noauto" "x-systemd.idle-timeout=600"];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,22 +47,22 @@
|
||||||
options = ["fmask=0022" "dmask=0022"];
|
options = ["fmask=0022" "dmask=0022"];
|
||||||
};
|
};
|
||||||
|
|
||||||
"/mnt/leyla_home" = {
|
"/mnt/leyla_documents" = {
|
||||||
device = "server.arpa:/home/leyla";
|
device = "defiant:/exports/leyla";
|
||||||
fsType = "nfs";
|
fsType = "nfs";
|
||||||
options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
||||||
};
|
};
|
||||||
|
|
||||||
"/mnt/share_home" = {
|
"/mnt/users_documents" = {
|
||||||
device = "server.arpa:/home/share";
|
device = "defiant:/exports/users";
|
||||||
fsType = "nfs";
|
fsType = "nfs";
|
||||||
options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
options = ["x-systemd.automount" "user" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
||||||
};
|
};
|
||||||
|
|
||||||
"/mnt/docker_home" = {
|
"/mnt/media" = {
|
||||||
device = "server.arpa:/home/docker";
|
device = "defiant:/exports/media";
|
||||||
fsType = "nfs";
|
fsType = "nfs";
|
||||||
options = ["x-systemd.automount" "noauto" "x-systemd.idle-timeout=600"];
|
options = ["x-systemd.automount" "noauto" "user" "noatime" "nofail" "soft" "x-systemd.idle-timeout=600" "fsc"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
configDir = "/var/lib/hass";
|
configDir = "/var/lib/hass";
|
||||||
|
db_user = "hass";
|
||||||
in {
|
in {
|
||||||
options.host.home-assistant = {
|
options.host.home-assistant = {
|
||||||
enable = lib.mkEnableOption "should home-assistant be enabled on this computer";
|
enable = lib.mkEnableOption "should home-assistant be enabled on this computer";
|
||||||
|
@ -16,27 +18,57 @@ in {
|
||||||
|
|
||||||
config = lib.mkIf config.host.home-assistant.enable (lib.mkMerge [
|
config = lib.mkIf config.host.home-assistant.enable (lib.mkMerge [
|
||||||
{
|
{
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"f ${config.services.home-assistant.configDir}/automations.yaml 0755 hass hass"
|
||||||
|
];
|
||||||
services.home-assistant = {
|
services.home-assistant = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package =
|
||||||
|
(pkgs.home-assistant.override {
|
||||||
|
extraPackages = py: with py; [psycopg2];
|
||||||
|
})
|
||||||
|
.overrideAttrs (oldAttrs: {
|
||||||
|
doInstallCheck = false;
|
||||||
|
});
|
||||||
|
configDir = configDir;
|
||||||
extraComponents = [
|
extraComponents = [
|
||||||
"esphome"
|
|
||||||
"met"
|
"met"
|
||||||
"radio_browser"
|
"radio_browser"
|
||||||
"isal"
|
"isal"
|
||||||
|
"zha"
|
||||||
|
"jellyfin"
|
||||||
|
"webostv"
|
||||||
|
"tailscale"
|
||||||
|
"syncthing"
|
||||||
|
"sonos"
|
||||||
|
"analytics_insights"
|
||||||
|
"unifi"
|
||||||
|
"minecraft_server"
|
||||||
|
"openweathermap"
|
||||||
];
|
];
|
||||||
config.http = {
|
config = {
|
||||||
|
http = {
|
||||||
server_port = 8082;
|
server_port = 8082;
|
||||||
use_x_forwarded_for = true;
|
use_x_forwarded_for = true;
|
||||||
trusted_proxies = ["127.0.0.1" "::1"];
|
trusted_proxies = ["127.0.0.1" "::1"];
|
||||||
ip_ban_enabled = true;
|
ip_ban_enabled = true;
|
||||||
login_attempts_threshold = 10;
|
login_attempts_threshold = 10;
|
||||||
};
|
};
|
||||||
|
recorder.db_url = "postgresql://@/${db_user}";
|
||||||
|
"automation manual" = [];
|
||||||
|
"automation ui" = "!include automations.yaml";
|
||||||
|
};
|
||||||
extraPackages = python3Packages:
|
extraPackages = python3Packages:
|
||||||
with python3Packages; [
|
with python3Packages; [
|
||||||
numpy
|
numpy
|
||||||
gtts
|
gtts
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
systemd.services.home-assistant = {
|
||||||
|
requires = [
|
||||||
|
"postgresql.service"
|
||||||
|
];
|
||||||
|
};
|
||||||
host = {
|
host = {
|
||||||
reverse_proxy.subdomains.${config.host.home-assistant.subdomain} = {
|
reverse_proxy.subdomains.${config.host.home-assistant.subdomain} = {
|
||||||
target = "http://localhost:${toString config.services.home-assistant.config.http.server_port}";
|
target = "http://localhost:${toString config.services.home-assistant.config.http.server_port}";
|
||||||
|
@ -44,15 +76,33 @@ in {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
add_header Upgrade $http_upgrade;
|
add_header Upgrade $http_upgrade;
|
||||||
add_header Connection \"upgrade\";
|
add_header Connection \"upgrade\";
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
proxy_set_header X-Forwarded-Host $server_name;
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|
||||||
|
proxy_buffering off;
|
||||||
|
|
||||||
proxy_read_timeout 90;
|
proxy_read_timeout 90;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
postgres = {
|
||||||
|
enable = true;
|
||||||
|
extraUsers = {
|
||||||
|
${db_user} = {
|
||||||
|
isClient = true;
|
||||||
|
createUser = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraDatabases = {
|
||||||
|
${db_user} = {
|
||||||
|
name = db_user;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(lib.mkIf config.host.impermanence.enable {
|
(lib.mkIf config.host.impermanence.enable {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
jellyfinPort = 8096;
|
jellyfinPort = 8096;
|
||||||
jellyfin_data_directory = "/var/lib/jellyfin";
|
jellyfin_data_directory = "/var/lib/jellyfin";
|
||||||
jellyfin_cache_directory = "/var/cache/jellyfin";
|
jellyfin_cache_directory = "/var/cache/jellyfin";
|
||||||
jellyfin_media_directory = "/srv/jellyfin/media";
|
|
||||||
in {
|
in {
|
||||||
options.host.jellyfin = {
|
options.host.jellyfin = {
|
||||||
enable = lib.mkEnableOption "should jellyfin be enabled on this computer";
|
enable = lib.mkEnableOption "should jellyfin be enabled on this computer";
|
||||||
|
@ -21,6 +20,11 @@ in {
|
||||||
description = "ex subdomain of base domain that jellyfin will be hosted at";
|
description = "ex subdomain of base domain that jellyfin will be hosted at";
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
|
media_directory = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "directory jellyfin media will be hosted at";
|
||||||
|
default = "/srv/jellyfin/media";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.host.jellyfin.enable (
|
config = lib.mkIf config.host.jellyfin.enable (
|
||||||
|
@ -126,7 +130,7 @@ in {
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
directories = [
|
directories = [
|
||||||
{
|
{
|
||||||
directory = jellyfin_media_directory;
|
directory = config.host.jellyfin.media_directory;
|
||||||
user = "jellyfin";
|
user = "jellyfin";
|
||||||
group = "jellyfin_media";
|
group = "jellyfin_media";
|
||||||
mode = "1770";
|
mode = "1770";
|
||||||
|
|
|
@ -57,7 +57,7 @@ in {
|
||||||
# create any folders that we need to have for our exports
|
# create any folders that we need to have for our exports
|
||||||
systemd.tmpfiles.rules =
|
systemd.tmpfiles.rules =
|
||||||
[
|
[
|
||||||
"d ${config.host.network_storage.export_directory} 2770 root root -"
|
"d ${config.host.network_storage.export_directory} 2775 root root -"
|
||||||
]
|
]
|
||||||
++ (
|
++ (
|
||||||
builtins.map (
|
builtins.map (
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
services.nfs.server = {
|
services.nfs.server = {
|
||||||
enable = true;
|
enable = true;
|
||||||
exports = lib.strings.concatLines (
|
exports = lib.strings.concatLines (
|
||||||
builtins.map (
|
lib.lists.imap0 (
|
||||||
directory: "${directory._directory} 100.64.0.0/10(rw,sync,no_subtree_check,crossmnt)"
|
i: directory: "${directory._directory} 100.64.0.0/10(rw,sync,no_subtree_check,crossmnt,fsid=${builtins.toString i})"
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
builtins.filter (
|
builtins.filter (
|
||||||
|
|
|
@ -65,6 +65,7 @@ in {
|
||||||
++ (
|
++ (
|
||||||
builtins.map (user: {
|
builtins.map (user: {
|
||||||
name = user.name;
|
name = user.name;
|
||||||
|
ensureDBOwnership = true;
|
||||||
})
|
})
|
||||||
createUsers
|
createUsers
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue